<?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.zcxk.rmcp.core.dao.ImportFileMapper">
  <resultMap id="BaseResultMap" type="com.zcxk.rmcp.core.entity.ImportFile">
    <!--@mbg.generated-->
    <!--@Table rmcp_import_file-->
    <id column="id" property="id" />
    <result column="tenant_id" property="tenantId" />
    <result column="user_id" property="userId" />
    <result column="type" property="type" />
    <result column="import_file_path" property="importFilePath" />
    <result column="import_file_name" property="importFileName" />
    <result column="fail_file_path" property="failFilePath" />
    <result column="import_status" property="importStatus" />
    <result column="success_num" property="successNum" />
    <result column="fail_num" property="failNum" />
    <result column="status" property="status" />
    <result column="create_date" property="createDate" />
    <result column="create_by" property="createBy" />
    <result column="update_date" property="updateDate" />
    <result column="update_by" property="updateBy" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, tenant_id, user_id, `type`, import_file_path, import_file_name, fail_file_path, 
    import_status, success_num, fail_num, `status`, create_date, create_by, update_date, 
    update_by
  </sql>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.zcxk.rmcp.core.entity.ImportFile" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into rmcp_import_file
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="tenantId != null">
        tenant_id,
      </if>
      <if test="userId != null">
        user_id,
      </if>
      <if test="type != null">
        `type`,
      </if>
      <if test="importFilePath != null">
        import_file_path,
      </if>
      <if test="importFileName != null">
        import_file_name,
      </if>
      <if test="failFilePath != null">
        fail_file_path,
      </if>
      <if test="importStatus != null">
        import_status,
      </if>
      <if test="successNum != null">
        success_num,
      </if>
      <if test="failNum != null">
        fail_num,
      </if>
      <if test="status != null">
        `status`,
      </if>
      <if test="createDate != null">
        create_date,
      </if>
      <if test="createBy != null">
        create_by,
      </if>
      <if test="updateDate != null">
        update_date,
      </if>
      <if test="updateBy != null">
        update_by,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="tenantId != null">
        #{tenantId},
      </if>
      <if test="userId != null">
        #{userId},
      </if>
      <if test="type != null">
        #{type},
      </if>
      <if test="importFilePath != null">
        #{importFilePath},
      </if>
      <if test="importFileName != null">
        #{importFileName},
      </if>
      <if test="failFilePath != null">
        #{failFilePath},
      </if>
      <if test="importStatus != null">
        #{importStatus},
      </if>
      <if test="successNum != null">
        #{successNum},
      </if>
      <if test="failNum != null">
        #{failNum},
      </if>
      <if test="status != null">
        #{status},
      </if>
      <if test="createDate != null">
        #{createDate},
      </if>
      <if test="createBy != null">
        #{createBy},
      </if>
      <if test="updateDate != null">
        #{updateDate},
      </if>
      <if test="updateBy != null">
        #{updateBy},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.zcxk.rmcp.core.entity.ImportFile">
    <!--@mbg.generated-->
    update rmcp_import_file
    <set>
      <if test="tenantId != null">
        tenant_id = #{tenantId},
      </if>
      <if test="userId != null">
        user_id = #{userId},
      </if>
      <if test="type != null">
        `type` = #{type},
      </if>
      <if test="importFilePath != null">
        import_file_path = #{importFilePath},
      </if>
      <if test="importFileName != null">
        import_file_name = #{importFileName},
      </if>
      <if test="failFilePath != null">
        fail_file_path = #{failFilePath},
      </if>
      <if test="importStatus != null">
        import_status = #{importStatus},
      </if>
      <if test="successNum != null">
        success_num = #{successNum},
      </if>
      <if test="failNum != null">
        fail_num = #{failNum},
      </if>
      <if test="status != null">
        `status` = #{status},
      </if>
      <if test="createDate != null">
        create_date = #{createDate},
      </if>
      <if test="createBy != null">
        create_by = #{createBy},
      </if>
      <if test="updateDate != null">
        update_date = #{updateDate},
      </if>
      <if test="updateBy != null">
        update_by = #{updateBy},
      </if>
    </set>
    where id = #{id}
  </update>

  <select id="findById" resultMap="BaseResultMap">
    select * from rmcp_import_file where status = 1 and id = #{id}
    </select>
</mapper>