<?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.hzya.frame.grpU8.nxproof.pubkjqj.dao.impl.SenderPubkjqjDaoImpl">

    <resultMap id="get-SenderPubkjqjEntity-result" type="com.hzya.frame.grpU8.nxproof.pubkjqj.entity.SenderPubkjqjEntity" >
       <result property="gsdm" column="gsdm" jdbcType="VARCHAR"/>
           <result property="zth" column="ZTH" jdbcType="VARCHAR"/>
           <result property="kjnd" column="kjnd" jdbcType="VARCHAR"/>
           <result property="kjqjxh" column="kjqjxh" jdbcType="INTEGER"/>
           <result property="qsrq" column="qsrq" jdbcType="VARCHAR"/>
           <result property="jsrq" column="jsrq" jdbcType="VARCHAR"/>
           <result property="jzbz" column="jzbz" jdbcType="VARCHAR"/>
           <result property="zzqmcl" column="zzqmcl" jdbcType="VARCHAR"/>
           <result property="qmpzpc" column="qmpzpc" jdbcType="INTEGER"/>
           <result property="syzt" column="syzt" jdbcType="VARCHAR"/>
           <result property="xgzt" column="xgzt" jdbcType="VARCHAR"/>
           <result property="chjzbz" column="chjzbz" jdbcType="VARCHAR"/>
           <result property="jzzt" column="jzzt" jdbcType="VARCHAR"/>
        </resultMap>
    <!-- 查询的字段-->
    <sql id = "SenderPubkjqjEntity_Base_Column_List">
        gsdm
       ,ZTH
        ,kjnd
        ,kjqjxh
        ,qsrq
        ,jsrq
        ,jzbz
        ,zzqmcl
        ,qmpzpc
        ,syzt
        ,xgzt
        ,chjzbz
        ,jzzt
     </sql>
 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-SenderPubkjqjEntity-result" parameterType = "com.hzya.frame.grpU8.nxproof.pubkjqj.entity.SenderPubkjqjEntity">
    select
    <include refid="SenderPubkjqjEntity_Base_Column_List" />
    from pubkjqj
    <trim prefix="where" prefixOverrides="and"> 
        <if test="gsdm != null and gsdm != ''"> and gsdm = #{gsdm} </if>
            <if test="zth != null and zth != ''"> and ZTH = #{zth} </if>
            <if test="kjnd != null and kjnd != ''"> and kjnd = #{kjnd} </if>
            <if test="kjqjxh != null"> and kjqjxh = #{kjqjxh} </if>
            <if test="qsrq != null and qsrq != ''"> and qsrq = #{qsrq} </if>
            <if test="jsrq != null and jsrq != ''"> and jsrq = #{jsrq} </if>
            <if test="jzbz != null and jzbz != ''"> and jzbz = #{jzbz} </if>
            <if test="zzqmcl != null and zzqmcl != ''"> and zzqmcl = #{zzqmcl} </if>
            <if test="qmpzpc != null"> and qmpzpc = #{qmpzpc} </if>
            <if test="syzt != null and syzt != ''"> and syzt = #{syzt} </if>
            <if test="xgzt != null and xgzt != ''"> and xgzt = #{xgzt} </if>
            <if test="chjzbz != null and chjzbz != ''"> and chjzbz = #{chjzbz} </if>
            <if test="jzzt != null and jzzt != ''"> and jzzt = #{jzzt} </if>
       -- and zth in('004','005','009','010','011','012','014')
    </trim>
</select>
    
<!-- 查询符合条件的数量 -->
<select id="SenderPubkjqjEntity_count" resultType="Integer" parameterType = "com.hzya.frame.grpU8.nxproof.pubkjqj.entity.SenderPubkjqjEntity">
        select  count(1)   from pubkjqj
    <trim prefix="where" prefixOverrides="and"> 
        <if test="gsdm != null and gsdm != ''"> and gsdm = #{gsdm} </if>
            <if test="zth != null and zth != ''"> and ZTH = #{zth} </if>
            <if test="kjnd != null and kjnd != ''"> and kjnd = #{kjnd} </if>
            <if test="kjqjxh != null"> and kjqjxh = #{kjqjxh} </if>
            <if test="qsrq != null and qsrq != ''"> and qsrq = #{qsrq} </if>
            <if test="jsrq != null and jsrq != ''"> and jsrq = #{jsrq} </if>
            <if test="jzbz != null and jzbz != ''"> and jzbz = #{jzbz} </if>
            <if test="zzqmcl != null and zzqmcl != ''"> and zzqmcl = #{zzqmcl} </if>
            <if test="qmpzpc != null"> and qmpzpc = #{qmpzpc} </if>
            <if test="syzt != null and syzt != ''"> and syzt = #{syzt} </if>
            <if test="xgzt != null and xgzt != ''"> and xgzt = #{xgzt} </if>
            <if test="chjzbz != null and chjzbz != ''"> and chjzbz = #{chjzbz} </if>
            <if test="jzzt != null and jzzt != ''"> and jzzt = #{jzzt} </if>
    </trim>
    </select>

    <!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-SenderPubkjqjEntity-result" parameterType = "com.hzya.frame.grpU8.nxproof.pubkjqj.entity.SenderPubkjqjEntity">
    select
    <include refid="SenderPubkjqjEntity_Base_Column_List" />
    from pubkjqj
    <trim prefix="where" prefixOverrides="and"> 
        <if test="gsdm != null and gsdm != ''"> and gsdm like concat('%',#{gsdm},'%') </if>
            <if test="zth != null and zth != ''"> and ZTH like concat('%',#{zth},'%') </if>
            <if test="kjnd != null and kjnd != ''"> and kjnd like concat('%',#{kjnd},'%') </if>
            <if test="kjqjxh != null"> and kjqjxh like concat('%',#{kjqjxh},'%') </if>
            <if test="qsrq != null and qsrq != ''"> and qsrq like concat('%',#{qsrq},'%') </if>
            <if test="jsrq != null and jsrq != ''"> and jsrq like concat('%',#{jsrq},'%') </if>
            <if test="jzbz != null and jzbz != ''"> and jzbz like concat('%',#{jzbz},'%') </if>
            <if test="zzqmcl != null and zzqmcl != ''"> and zzqmcl like concat('%',#{zzqmcl},'%') </if>
            <if test="qmpzpc != null"> and qmpzpc like concat('%',#{qmpzpc},'%') </if>
            <if test="syzt != null and syzt != ''"> and syzt like concat('%',#{syzt},'%') </if>
            <if test="xgzt != null and xgzt != ''"> and xgzt like concat('%',#{xgzt},'%') </if>
            <if test="chjzbz != null and chjzbz != ''"> and chjzbz like concat('%',#{chjzbz},'%') </if>
            <if test="jzzt != null and jzzt != ''"> and jzzt like concat('%',#{jzzt},'%') </if>
    </trim>
</select>

<!-- 查询列表 字段采用or格式 -->
<select id="SenderPubkjqjEntity_list_or" resultMap="get-SenderPubkjqjEntity-result" parameterType = "com.hzya.frame.grpU8.nxproof.pubkjqj.entity.SenderPubkjqjEntity">
    select
    <include refid="SenderPubkjqjEntity_Base_Column_List" />
    from pubkjqj
    <trim prefix="where" prefixOverrides="and"> 
         <if test="gsdm != null and gsdm != ''"> or gsdm = #{gsdm} </if>
             <if test="zth != null and zth != ''"> or ZTH = #{zth} </if>
             <if test="kjnd != null and kjnd != ''"> or kjnd = #{kjnd} </if>
             <if test="kjqjxh != null"> or kjqjxh = #{kjqjxh} </if>
             <if test="qsrq != null and qsrq != ''"> or qsrq = #{qsrq} </if>
             <if test="jsrq != null and jsrq != ''"> or jsrq = #{jsrq} </if>
             <if test="jzbz != null and jzbz != ''"> or jzbz = #{jzbz} </if>
             <if test="zzqmcl != null and zzqmcl != ''"> or zzqmcl = #{zzqmcl} </if>
             <if test="qmpzpc != null"> or qmpzpc = #{qmpzpc} </if>
             <if test="syzt != null and syzt != ''"> or syzt = #{syzt} </if>
             <if test="xgzt != null and xgzt != ''"> or xgzt = #{xgzt} </if>
             <if test="chjzbz != null and chjzbz != ''"> or chjzbz = #{chjzbz} </if>
             <if test="jzzt != null and jzzt != ''"> or jzzt = #{jzzt} </if>
    </trim>
</select>

<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.grpU8.nxproof.pubkjqj.entity.SenderPubkjqjEntity" keyProperty="" useGeneratedKeys="true">
    insert into pubkjqj(
    <trim suffix="" suffixOverrides=",">
        <if test="zth != null and zth != ''"> ZTH , </if>
        <if test="kjnd != null and kjnd != ''"> kjnd , </if>
        <if test="kjqjxh != null"> kjqjxh , </if>
        <if test="qsrq != null and qsrq != ''"> qsrq , </if>
        <if test="jsrq != null and jsrq != ''"> jsrq , </if>
        <if test="jzbz != null and jzbz != ''"> jzbz , </if>
        <if test="zzqmcl != null and zzqmcl != ''"> zzqmcl , </if>
        <if test="qmpzpc != null"> qmpzpc , </if>
        <if test="syzt != null and syzt != ''"> syzt , </if>
        <if test="xgzt != null and xgzt != ''"> xgzt , </if>
        <if test="chjzbz != null and chjzbz != ''"> chjzbz , </if>
        <if test="jzzt != null and jzzt != ''"> jzzt , </if>
        <if test="gsdm != null and gsdm != ''"> gsdm  </if>
    </trim>
    )values(
    <trim suffix="" suffixOverrides=",">
        <if test="zth != null and zth != ''"> #{zth} ,</if>
        <if test="kjnd != null and kjnd != ''"> #{kjnd} ,</if>
        <if test="kjqjxh != null"> #{kjqjxh} ,</if>
        <if test="qsrq != null and qsrq != ''"> #{qsrq} ,</if>
        <if test="jsrq != null and jsrq != ''"> #{jsrq} ,</if>
        <if test="jzbz != null and jzbz != ''"> #{jzbz} ,</if>
        <if test="zzqmcl != null and zzqmcl != ''"> #{zzqmcl} ,</if>
        <if test="qmpzpc != null"> #{qmpzpc} ,</if>
        <if test="syzt != null and syzt != ''"> #{syzt} ,</if>
        <if test="xgzt != null and xgzt != ''"> #{xgzt} ,</if>
        <if test="chjzbz != null and chjzbz != ''"> #{chjzbz} ,</if>
        <if test="jzzt != null and jzzt != ''"> #{jzzt} ,</if>
        <if test="gsdm != null and gsdm != ''"> #{gsdm} </if>
    </trim>
    )
</insert>


<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="" useGeneratedKeys="true">
  insert into pubkjqj(id,gsdm, ZTH, kjnd, kjqjxh, qsrq, jsrq, jzbz, zzqmcl, qmpzpc, syzt, xgzt, chjzbz, jzzt)
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.id},#{entity.gsdm},#{entity.zth},#{entity.kjnd},#{entity.kjqjxh},#{entity.qsrq},#{entity.jsrq},#{entity.jzbz},#{entity.zzqmcl},#{entity.qmpzpc},#{entity.syzt},#{entity.xgzt},#{entity.chjzbz},#{entity.jzzt})
    </foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="" useGeneratedKeys="true">
    insert into pubkjqj(id,gsdm, ZTH, kjnd, kjqjxh, qsrq, jsrq, jzbz, zzqmcl, qmpzpc, syzt, xgzt, chjzbz, jzzt)
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.id},#{entity.gsdm},#{entity.zth},#{entity.kjnd},#{entity.kjqjxh},#{entity.qsrq},#{entity.jsrq},#{entity.jzbz},#{entity.zzqmcl},#{entity.qmpzpc},#{entity.syzt},#{entity.xgzt},#{entity.chjzbz},#{entity.jzzt})
    </foreach>
    on duplicate key update
    gsdm = values(gsdm),
    ZTH = values(ZTH),
    kjnd = values(kjnd),
    kjqjxh = values(kjqjxh),
    qsrq = values(qsrq),
    jsrq = values(jsrq),
    jzbz = values(jzbz),
    zzqmcl = values(zzqmcl),
    qmpzpc = values(qmpzpc),
    syzt = values(syzt),
    xgzt = values(xgzt),
    chjzbz = values(chjzbz),
    jzzt = values(jzzt)</insert>

<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.grpU8.nxproof.pubkjqj.entity.SenderPubkjqjEntity" >
    update pubkjqj  set
    <trim suffix="" suffixOverrides=",">
        <if test="gsdm != null and gsdm != ''"> gsdm = #{gsdm},</if>
        <if test="zth != null and zth != ''"> ZTH = #{zth},</if>
        <if test="kjnd != null and kjnd != ''"> kjnd = #{kjnd},</if>
        <if test="kjqjxh != null"> kjqjxh = #{kjqjxh},</if>
        <if test="qsrq != null and qsrq != ''"> qsrq = #{qsrq},</if>
        <if test="jsrq != null and jsrq != ''"> jsrq = #{jsrq},</if>
        <if test="jzbz != null and jzbz != ''"> jzbz = #{jzbz},</if>
        <if test="zzqmcl != null and zzqmcl != ''"> zzqmcl = #{zzqmcl},</if>
        <if test="qmpzpc != null"> qmpzpc = #{qmpzpc},</if>
        <if test="syzt != null and syzt != ''"> syzt = #{syzt},</if>
        <if test="xgzt != null and xgzt != ''"> xgzt = #{xgzt},</if>
        <if test="chjzbz != null and chjzbz != ''"> chjzbz = #{chjzbz},</if>
        <if test="jzzt != null and jzzt != ''"> jzzt = #{jzzt}</if>
    </trim>
    where  kjnd= #{kjnd} and gsdm=#{gsdm} and zth=#{zth} and kjqjxh=#{kjqjxh}
</update>


<!-- 逻辑删除 -->
<update id="SenderPubkjqjEntity_logicDelete" parameterType = "com.hzya.frame.grpU8.nxproof.pubkjqj.entity.SenderPubkjqjEntity" >
update pubkjqj  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where  id= #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="SenderPubkjqjEntity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.grpU8.nxproof.pubkjqj.entity.SenderPubkjqjEntity" >
update pubkjqj  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
 <trim prefix="where" prefixOverrides="and"> 
        <if test="gsdm != null and gsdm != ''"> and gsdm = #{gsdm} </if>
            <if test="zth != null and zth != ''"> and ZTH = #{zth} </if>
            <if test="kjnd != null and kjnd != ''"> and kjnd = #{kjnd} </if>
            <if test="kjqjxh != null"> and kjqjxh = #{kjqjxh} </if>
            <if test="qsrq != null and qsrq != ''"> and qsrq = #{qsrq} </if>
            <if test="jsrq != null and jsrq != ''"> and jsrq = #{jsrq} </if>
            <if test="jzbz != null and jzbz != ''"> and jzbz = #{jzbz} </if>
            <if test="zzqmcl != null and zzqmcl != ''"> and zzqmcl = #{zzqmcl} </if>
            <if test="qmpzpc != null"> and qmpzpc = #{qmpzpc} </if>
            <if test="syzt != null and syzt != ''"> and syzt = #{syzt} </if>
            <if test="xgzt != null and xgzt != ''"> and xgzt = #{xgzt} </if>
            <if test="chjzbz != null and chjzbz != ''"> and chjzbz = #{chjzbz} </if>
            <if test="jzzt != null and jzzt != ''"> and jzzt = #{jzzt} </if>
            and sts='Y'
    </trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
    delete from pubkjqj where  id= #{id}
</delete>

    <!--通过主键删除-->
    <delete id="SenderPubkjqjEntity_delete_kjqj">
        delete from pubkjqj where  kjnd= #{kjnd} and gsdm=#{gsdm} and zth=#{zth} and kjqjxh=#{kjqjxh}
    </delete>

</mapper>

