<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.syzy.mapper.BBusiMbtiRecordsMapper">

  <resultMap type="BBusiMbtiRecords" id="BBusiMbtiRecordsResult">
    <result property="id" column="id" />
    <result property="customerCode" column="customerCode" />
    <result property="code" column="code" />
    <result property="ruleCode" column="ruleCode" />
    <result property="scoreE" column="score_e" />
    <result property="scoreI" column="score_i" />
    <result property="scoreS" column="score_s" />
    <result property="scoreN" column="score_n" />
    <result property="scoreT" column="score_t" />
    <result property="scoreF" column="score_f" />
    <result property="scoreJ" column="score_j" />
    <result property="scoreP" column="score_p" />
    <result property="createTime" column="createTime" />
    <result property="status" column="status" />
  </resultMap>

  <sql id="selectBBusiMbtiRecordsVo">
    select id, customerCode, code, ruleCode, score_e, score_i, score_s, score_n, score_t, score_f, score_j, score_p, createTime, status from b_busi_mbti_records
  </sql>

  <select id="selectBBusiMbtiRecordsList" parameterType="BBusiMbtiRecords" resultMap="BBusiMbtiRecordsResult">
    <include refid="selectBBusiMbtiRecordsVo" />
    <where>
      <if test="customerCode != null  and customerCode != ''"> and customerCode = #{customerCode}</if>
      <if test="code != null  and code != ''"> and code = #{code}</if>
      <if test="ruleCode != null  and ruleCode != ''"> and ruleCode = #{ruleCode}</if>
      <if test="scoreE != null "> and score_e = #{scoreE}</if>
      <if test="scoreI != null "> and score_i = #{scoreI}</if>
      <if test="scoreS != null "> and score_s = #{scoreS}</if>
      <if test="scoreN != null "> and score_n = #{scoreN}</if>
      <if test="scoreT != null "> and score_t = #{scoreT}</if>
      <if test="scoreF != null "> and score_f = #{scoreF}</if>
      <if test="scoreJ != null "> and score_j = #{scoreJ}</if>
      <if test="scoreP != null "> and score_p = #{scoreP}</if>
      <if test="createTime != null "> and createTime = #{createTime}</if>
      <if test="status != null "> and status = #{status}</if>
    </where>
  </select>

  <select id="selectBBusiMbtiRecordsById" parameterType="Long" resultMap="BBusiMbtiRecordsResult">
    <include refid="selectBBusiMbtiRecordsVo" />
    where id = #{id}
  </select>

  <insert id="insertBBusiMbtiRecords" parameterType="BBusiMbtiRecords" useGeneratedKeys="true" keyProperty="id">
    insert into b_busi_mbti_records
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="customerCode != null and customerCode != ''">customerCode,</if>
      <if test="code != null and code != ''">code,</if>
      <if test="ruleCode != null and ruleCode != ''">ruleCode,</if>
      <if test="scoreE != null">score_e,</if>
      <if test="scoreI != null">score_i,</if>
      <if test="scoreS != null">score_s,</if>
      <if test="scoreN != null">score_n,</if>
      <if test="scoreT != null">score_t,</if>
      <if test="scoreF != null">score_f,</if>
      <if test="scoreJ != null">score_j,</if>
      <if test="scoreP != null">score_p,</if>
      <if test="createTime != null">createTime,</if>
      <if test="status != null">status,</if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="customerCode != null and customerCode != ''">#{customerCode},</if>
      <if test="code != null and code != ''">#{code},</if>
      <if test="ruleCode != null and ruleCode != ''">#{ruleCode},</if>
      <if test="scoreE != null">#{scoreE},</if>
      <if test="scoreI != null">#{scoreI},</if>
      <if test="scoreS != null">#{scoreS},</if>
      <if test="scoreN != null">#{scoreN},</if>
      <if test="scoreT != null">#{scoreT},</if>
      <if test="scoreF != null">#{scoreF},</if>
      <if test="scoreJ != null">#{scoreJ},</if>
      <if test="scoreP != null">#{scoreP},</if>
      <if test="createTime != null">#{createTime},</if>
      <if test="status != null">#{status},</if>
    </trim>
  </insert>

  <update id="updateBBusiMbtiRecords" parameterType="BBusiMbtiRecords">
    update b_busi_mbti_records
    <trim prefix="SET" suffixOverrides=",">
      <if test="customerCode != null and customerCode != ''">customerCode = #{customerCode},</if>
      <if test="code != null and code != ''">code = #{code},</if>
      <if test="ruleCode != null and ruleCode != ''">ruleCode = #{ruleCode},</if>
      <if test="scoreE != null">score_e = #{scoreE},</if>
      <if test="scoreI != null">score_i = #{scoreI},</if>
      <if test="scoreS != null">score_s = #{scoreS},</if>
      <if test="scoreN != null">score_n = #{scoreN},</if>
      <if test="scoreT != null">score_t = #{scoreT},</if>
      <if test="scoreF != null">score_f = #{scoreF},</if>
      <if test="scoreJ != null">score_j = #{scoreJ},</if>
      <if test="scoreP != null">score_p = #{scoreP},</if>
      <if test="createTime != null">createTime = #{createTime},</if>
      <if test="status != null">status = #{status},</if>
    </trim>
    where id = #{id}
  </update>

  <delete id="deleteBBusiMbtiRecordsById" parameterType="Long">
    delete from b_busi_mbti_records where id = #{id}
  </delete>

  <delete id="deleteBBusiMbtiRecordsByIds" parameterType="String">
    delete from b_busi_mbti_records where id in
    <foreach item="id" collection="array" open="(" separator="," close=")">
      #{id}
    </foreach>
  </delete>
</mapper>