<?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.pubbmxx.dao.impl.SenderPubbmxxDaoImpl">

    <resultMap id="get-SenderPubbmxxEntity-result" type="com.hzya.frame.grpU8.nxproof.pubbmxx.entity.SenderPubbmxxEntity" >
       <result property="gsdm" column="gsdm" jdbcType="VARCHAR"/>
           <result property="kjnd" column="kjnd" jdbcType="VARCHAR"/>
           <result property="bmdm" column="bmdm" jdbcType="VARCHAR"/>
           <result property="bmmc" column="bmmc" jdbcType="VARCHAR"/>
           <result property="bmlb" column="bmlb" jdbcType="VARCHAR"/>
           <result property="fzrdm" column="fzrdm" jdbcType="VARCHAR"/>
           <result property="tel" column="tel" jdbcType="VARCHAR"/>
           <result property="xjbms" column="xjbms" jdbcType="INTEGER"/>
           <result property="zgrs" column="zgrs" jdbcType="INTEGER"/>
           <result property="syzt" column="syzt" jdbcType="VARCHAR"/>
           <result property="jlrId" column="Jlr_ID" jdbcType="INTEGER"/>
           <result property="jlRq" column="Jl_RQ" jdbcType="VARCHAR"/>
           <result property="xgrId" column="Xgr_ID" jdbcType="INTEGER"/>
           <result property="xgRq" column="Xg_RQ" jdbcType="VARCHAR"/>
           <result property="sjly" column="Sjly" jdbcType="VARCHAR"/>
           <result property="sfmx" column="SFMX" jdbcType="VARCHAR"/>
           <result property="zjm" column="zjm" jdbcType="VARCHAR"/>
           <result property="fzrdm2" column="fzrdm2" jdbcType="VARCHAR"/>
           <result property="fzrdm3" column="fzrdm3" jdbcType="VARCHAR"/>
           <result property="sftck" column="sftck" jdbcType="VARCHAR"/>
        </resultMap>
    <!-- 查询的字段-->
    <sql id = "SenderPubbmxxEntity_Base_Column_List">
        gsdm
       ,kjnd 
        ,bmdm 
        ,bmmc 
        ,bmlb 
        ,fzrdm 
        ,tel 
        ,xjbms 
        ,zgrs 
        ,syzt 
        ,Jlr_ID 
        ,Jl_RQ 
        ,Xgr_ID 
        ,Xg_RQ 
        ,Sjly 
        ,SFMX 
        ,zjm 
        ,fzrdm2 
        ,fzrdm3 
        ,sftck
     </sql>
 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-SenderPubbmxxEntity-result" parameterType = "com.hzya.frame.grpU8.nxproof.pubbmxx.entity.SenderPubbmxxEntity">
    select
    <include refid="SenderPubbmxxEntity_Base_Column_List" />
    from pubbmxx
    <trim prefix="where" prefixOverrides="and"> 
        <if test="gsdm != null and gsdm != ''"> and gsdm = #{gsdm} </if>
            <if test="kjnd != null and kjnd != ''"> and kjnd = #{kjnd} </if>
            <if test="bmdm != null and bmdm != ''"> and bmdm = #{bmdm} </if>
            <if test="bmmc != null and bmmc != ''"> and bmmc = #{bmmc} </if>
            <if test="bmlb != null and bmlb != ''"> and bmlb = #{bmlb} </if>
            <if test="fzrdm != null and fzrdm != ''"> and fzrdm = #{fzrdm} </if>
            <if test="tel != null and tel != ''"> and tel = #{tel} </if>
            <if test="xjbms != null"> and xjbms = #{xjbms} </if>
            <if test="zgrs != null"> and zgrs = #{zgrs} </if>
            <if test="syzt != null and syzt != ''"> and syzt = #{syzt} </if>
            <if test="jlrId != null"> and Jlr_ID = #{jlrId} </if>
            <if test="jlRq != null and jlRq != ''"> and Jl_RQ = #{jlRq} </if>
            <if test="xgrId != null"> and Xgr_ID = #{xgrId} </if>
            <if test="xgRq != null and xgRq != ''"> and Xg_RQ >= #{xgRq} </if>
            <if test="sjly != null and sjly != ''"> and Sjly = #{sjly} </if>
            <if test="sfmx != null and sfmx != ''"> and SFMX = #{sfmx} </if>
            <if test="zjm != null and zjm != ''"> and zjm = #{zjm} </if>
            <if test="fzrdm2 != null and fzrdm2 != ''"> and fzrdm2 = #{fzrdm2} </if>
            <if test="fzrdm3 != null and fzrdm3 != ''"> and fzrdm3 = #{fzrdm3} </if>
            <if test="sftck != null and sftck != ''"> and sftck = #{sftck} </if>
       -- and gsdm in ('0101010201','0101010202')
    </trim>
</select>
    
<!-- 查询符合条件的数量 -->
<select id="SenderPubbmxxEntity_count" resultType="Integer" parameterType = "com.hzya.frame.grpU8.nxproof.pubbmxx.entity.SenderPubbmxxEntity">
        select  count(1)   from pubbmxx
    <trim prefix="where" prefixOverrides="and"> 
        <if test="gsdm != null and gsdm != ''"> and gsdm = #{gsdm} </if>
            <if test="kjnd != null and kjnd != ''"> and kjnd = #{kjnd} </if>
            <if test="bmdm != null and bmdm != ''"> and bmdm = #{bmdm} </if>
            <if test="bmmc != null and bmmc != ''"> and bmmc = #{bmmc} </if>
            <if test="bmlb != null and bmlb != ''"> and bmlb = #{bmlb} </if>
            <if test="fzrdm != null and fzrdm != ''"> and fzrdm = #{fzrdm} </if>
            <if test="tel != null and tel != ''"> and tel = #{tel} </if>
            <if test="xjbms != null"> and xjbms = #{xjbms} </if>
            <if test="zgrs != null"> and zgrs = #{zgrs} </if>
            <if test="syzt != null and syzt != ''"> and syzt = #{syzt} </if>
            <if test="jlrId != null"> and Jlr_ID = #{jlrId} </if>
            <if test="jlRq != null and jlRq != ''"> and Jl_RQ = #{jlRq} </if>
            <if test="xgrId != null"> and Xgr_ID = #{xgrId} </if>
            <if test="xgRq != null and xgRq != ''"> and Xg_RQ = #{xgRq} </if>
            <if test="sjly != null and sjly != ''"> and Sjly = #{sjly} </if>
            <if test="sfmx != null and sfmx != ''"> and SFMX = #{sfmx} </if>
            <if test="zjm != null and zjm != ''"> and zjm = #{zjm} </if>
            <if test="fzrdm2 != null and fzrdm2 != ''"> and fzrdm2 = #{fzrdm2} </if>
            <if test="fzrdm3 != null and fzrdm3 != ''"> and fzrdm3 = #{fzrdm3} </if>
    </trim>
    </select>

    <!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-SenderPubbmxxEntity-result" parameterType = "com.hzya.frame.grpU8.nxproof.pubbmxx.entity.SenderPubbmxxEntity">
    select
    <include refid="SenderPubbmxxEntity_Base_Column_List" />
    from pubbmxx
    <trim prefix="where" prefixOverrides="and"> 
        <if test="gsdm != null and gsdm != ''"> and gsdm like concat('%',#{gsdm},'%') </if>
            <if test="kjnd != null and kjnd != ''"> and kjnd like concat('%',#{kjnd},'%') </if>
            <if test="bmdm != null and bmdm != ''"> and bmdm like concat('%',#{bmdm},'%') </if>
            <if test="bmmc != null and bmmc != ''"> and bmmc like concat('%',#{bmmc},'%') </if>
            <if test="bmlb != null and bmlb != ''"> and bmlb like concat('%',#{bmlb},'%') </if>
            <if test="fzrdm != null and fzrdm != ''"> and fzrdm like concat('%',#{fzrdm},'%') </if>
            <if test="tel != null and tel != ''"> and tel like concat('%',#{tel},'%') </if>
            <if test="xjbms != null"> and xjbms like concat('%',#{xjbms},'%') </if>
            <if test="zgrs != null"> and zgrs like concat('%',#{zgrs},'%') </if>
            <if test="syzt != null and syzt != ''"> and syzt like concat('%',#{syzt},'%') </if>
            <if test="jlrId != null"> and Jlr_ID like concat('%',#{jlrId},'%') </if>
            <if test="jlRq != null and jlRq != ''"> and Jl_RQ like concat('%',#{jlRq},'%') </if>
            <if test="xgrId != null"> and Xgr_ID like concat('%',#{xgrId},'%') </if>
            <if test="xgRq != null and xgRq != ''"> and Xg_RQ like concat('%',#{xgRq},'%') </if>
            <if test="sjly != null and sjly != ''"> and Sjly like concat('%',#{sjly},'%') </if>
            <if test="sfmx != null and sfmx != ''"> and SFMX like concat('%',#{sfmx},'%') </if>
            <if test="zjm != null and zjm != ''"> and zjm like concat('%',#{zjm},'%') </if>
            <if test="fzrdm2 != null and fzrdm2 != ''"> and fzrdm2 like concat('%',#{fzrdm2},'%') </if>
            <if test="fzrdm3 != null and fzrdm3 != ''"> and fzrdm3 like concat('%',#{fzrdm3},'%') </if>
    </trim>
</select>

<!-- 查询列表 字段采用or格式 -->
<select id="SenderPubbmxxEntity_list_or" resultMap="get-SenderPubbmxxEntity-result" parameterType = "com.hzya.frame.grpU8.nxproof.pubbmxx.entity.SenderPubbmxxEntity">
    select
    <include refid="SenderPubbmxxEntity_Base_Column_List" />
    from pubbmxx
    <trim prefix="where" prefixOverrides="and"> 
         <if test="gsdm != null and gsdm != ''"> or gsdm = #{gsdm} </if>
             <if test="kjnd != null and kjnd != ''"> or kjnd = #{kjnd} </if>
             <if test="bmdm != null and bmdm != ''"> or bmdm = #{bmdm} </if>
             <if test="bmmc != null and bmmc != ''"> or bmmc = #{bmmc} </if>
             <if test="bmlb != null and bmlb != ''"> or bmlb = #{bmlb} </if>
             <if test="fzrdm != null and fzrdm != ''"> or fzrdm = #{fzrdm} </if>
             <if test="tel != null and tel != ''"> or tel = #{tel} </if>
             <if test="xjbms != null"> or xjbms = #{xjbms} </if>
             <if test="zgrs != null"> or zgrs = #{zgrs} </if>
             <if test="syzt != null and syzt != ''"> or syzt = #{syzt} </if>
             <if test="jlrId != null"> or Jlr_ID = #{jlrId} </if>
             <if test="jlRq != null and jlRq != ''"> or Jl_RQ = #{jlRq} </if>
             <if test="xgrId != null"> or Xgr_ID = #{xgrId} </if>
             <if test="xgRq != null and xgRq != ''"> or Xg_RQ = #{xgRq} </if>
             <if test="sjly != null and sjly != ''"> or Sjly = #{sjly} </if>
             <if test="sfmx != null and sfmx != ''"> or SFMX = #{sfmx} </if>
             <if test="zjm != null and zjm != ''"> or zjm = #{zjm} </if>
             <if test="fzrdm2 != null and fzrdm2 != ''"> or fzrdm2 = #{fzrdm2} </if>
             <if test="fzrdm3 != null and fzrdm3 != ''"> or fzrdm3 = #{fzrdm3} </if>
    </trim>
</select>

<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.grpU8.nxproof.pubbmxx.entity.SenderPubbmxxEntity" keyProperty="" useGeneratedKeys="true">
    insert into pubbmxx(
    <trim suffix="" suffixOverrides=",">
        <if test="kjnd != null and kjnd != ''"> kjnd , </if>
        <if test="bmdm != null and bmdm != ''"> bmdm , </if>
        <if test="bmmc != null and bmmc != ''"> bmmc , </if>
        <if test="bmlb != null and bmlb != ''"> bmlb , </if>
        <if test="fzrdm != null and fzrdm != ''"> fzrdm , </if>
        <if test="tel != null and tel != ''"> tel , </if>
        <if test="xjbms != null"> xjbms , </if>
        <if test="zgrs != null"> zgrs , </if>
        <if test="syzt != null and syzt != ''"> syzt , </if>
        <if test="jlrId != null"> Jlr_ID , </if>
        <if test="jlRq != null and jlRq != ''"> Jl_RQ , </if>
        <if test="xgrId != null"> Xgr_ID , </if>
        <if test="xgRq != null and xgRq != ''"> Xg_RQ , </if>
        <if test="sjly != null and sjly != ''"> Sjly , </if>
        <if test="sfmx != null and sfmx != ''"> SFMX , </if>
        <if test="zjm != null and zjm != ''"> zjm , </if>
        <if test="fzrdm2 != null and fzrdm2 != ''"> fzrdm2 , </if>
        <if test="fzrdm3 != null and fzrdm3 != ''"> fzrdm3 , </if>
        <if test="sftck != null and sftck != ''"> sftck , </if>
        <if test="gsdm != null and gsdm != ''"> gsdm  </if>
    </trim>
    )values(
    <trim suffix="" suffixOverrides=",">
        <if test="kjnd != null and kjnd != ''"> #{kjnd} ,</if>
        <if test="bmdm != null and bmdm != ''"> #{bmdm} ,</if>
        <if test="bmmc != null and bmmc != ''"> #{bmmc} ,</if>
        <if test="bmlb != null and bmlb != ''"> #{bmlb} ,</if>
        <if test="fzrdm != null and fzrdm != ''"> #{fzrdm} ,</if>
        <if test="tel != null and tel != ''"> #{tel} ,</if>
        <if test="xjbms != null"> #{xjbms} ,</if>
        <if test="zgrs != null"> #{zgrs} ,</if>
        <if test="syzt != null and syzt != ''"> #{syzt} ,</if>
        <if test="jlrId != null"> #{jlrId} ,</if>
        <if test="jlRq != null and jlRq != ''"> #{jlRq} ,</if>
        <if test="xgrId != null"> #{xgrId} ,</if>
        <if test="xgRq != null and xgRq != ''"> #{xgRq} ,</if>
        <if test="sjly != null and sjly != ''"> #{sjly} ,</if>
        <if test="sfmx != null and sfmx != ''"> #{sfmx} ,</if>
        <if test="zjm != null and zjm != ''"> #{zjm} ,</if>
        <if test="fzrdm2 != null and fzrdm2 != ''"> #{fzrdm2} ,</if>
        <if test="fzrdm3 != null and fzrdm3 != ''"> #{fzrdm3} ,</if>
        <if test="sftck != null and sftck != ''"> #{sftck} ,</if>
        <if test="gsdm != null and gsdm != ''"> #{gsdm} </if>
    </trim>
    )
</insert>


<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="" useGeneratedKeys="true">
  insert into pubbmxx(id,gsdm, kjnd, bmdm, bmmc, bmlb, fzrdm, tel, xjbms, zgrs, syzt, Jlr_ID, Jl_RQ, Xgr_ID, Xg_RQ, Sjly, SFMX, zjm, fzrdm2, fzrdm3)
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.id},#{entity.gsdm},#{entity.kjnd},#{entity.bmdm},#{entity.bmmc},#{entity.bmlb},#{entity.fzrdm},#{entity.tel},#{entity.xjbms},#{entity.zgrs},#{entity.syzt},#{entity.jlrId},#{entity.jlRq},#{entity.xgrId},#{entity.xgRq},#{entity.sjly},#{entity.sfmx},#{entity.zjm},#{entity.fzrdm2},#{entity.fzrdm3})
    </foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="" useGeneratedKeys="true">
    insert into pubbmxx(id,gsdm, kjnd, bmdm, bmmc, bmlb, fzrdm, tel, xjbms, zgrs, syzt, Jlr_ID, Jl_RQ, Xgr_ID, Xg_RQ, Sjly, SFMX, zjm, fzrdm2, fzrdm3)
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.id},#{entity.gsdm},#{entity.kjnd},#{entity.bmdm},#{entity.bmmc},#{entity.bmlb},#{entity.fzrdm},#{entity.tel},#{entity.xjbms},#{entity.zgrs},#{entity.syzt},#{entity.jlrId},#{entity.jlRq},#{entity.xgrId},#{entity.xgRq},#{entity.sjly},#{entity.sfmx},#{entity.zjm},#{entity.fzrdm2},#{entity.fzrdm3})
    </foreach>
    on duplicate key update
    gsdm = values(gsdm),
    kjnd = values(kjnd),
    bmdm = values(bmdm),
    bmmc = values(bmmc),
    bmlb = values(bmlb),
    fzrdm = values(fzrdm),
    tel = values(tel),
    xjbms = values(xjbms),
    zgrs = values(zgrs),
    syzt = values(syzt),
    Jlr_ID = values(Jlr_ID),
    Jl_RQ = values(Jl_RQ),
    Xgr_ID = values(Xgr_ID),
    Xg_RQ = values(Xg_RQ),
    Sjly = values(Sjly),
    SFMX = values(SFMX),
    zjm = values(zjm),
    fzrdm2 = values(fzrdm2),
    fzrdm3 = values(fzrdm3)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.grpU8.nxproof.pubbmxx.entity.SenderPubbmxxEntity" >
    update pubbmxx  set
    <trim suffix="" suffixOverrides=",">
        <if test="gsdm != null and gsdm != ''"> gsdm = #{gsdm},</if>
        <if test="kjnd != null and kjnd != ''"> kjnd = #{kjnd},</if>
        <if test="bmdm != null and bmdm != ''"> bmdm = #{bmdm},</if>
        <if test="bmmc != null and bmmc != ''"> bmmc = #{bmmc},</if>
        <if test="bmlb != null and bmlb != ''"> bmlb = #{bmlb},</if>
        <if test="fzrdm != null and fzrdm != ''"> fzrdm = #{fzrdm},</if>
        <if test="tel != null and tel != ''"> tel = #{tel},</if>
        <if test="xjbms != null"> xjbms = #{xjbms},</if>
        <if test="zgrs != null"> zgrs = #{zgrs},</if>
        <if test="syzt != null and syzt != ''"> syzt = #{syzt},</if>
        <if test="jlrId != null"> Jlr_ID = #{jlrId},</if>
        <if test="jlRq != null and jlRq != ''"> Jl_RQ = #{jlRq},</if>
        <if test="xgrId != null"> Xgr_ID = #{xgrId},</if>
        <if test="xgRq != null and xgRq != ''"> Xg_RQ = #{xgRq},</if>
        <if test="sjly != null and sjly != ''"> Sjly = #{sjly},</if>
        <if test="sfmx != null and sfmx != ''"> SFMX = #{sfmx},</if>
        <if test="zjm != null and zjm != ''"> zjm = #{zjm},</if>
        <if test="fzrdm2 != null and fzrdm2 != ''"> fzrdm2 = #{fzrdm2},</if>
        <if test="fzrdm3 != null and fzrdm3 != ''"> fzrdm3 = #{fzrdm3},</if>
        <if test="sftck != null and sftck != ''"> sftck = #{sftck}</if>
    </trim>
    where  kjnd= #{kjnd} and gsdm=#{gsdm} and bmdm=#{bmdm}
</update>


<!-- 逻辑删除 -->
<update id="SenderPubbmxxEntity_logicDelete" parameterType = "com.hzya.frame.grpU8.nxproof.pubbmxx.entity.SenderPubbmxxEntity" >
update pubbmxx  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where  id= #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="SenderPubbmxxEntity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.grpU8.nxproof.pubbmxx.entity.SenderPubbmxxEntity" >
update pubbmxx  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="kjnd != null and kjnd != ''"> and kjnd = #{kjnd} </if>
            <if test="bmdm != null and bmdm != ''"> and bmdm = #{bmdm} </if>
            <if test="bmmc != null and bmmc != ''"> and bmmc = #{bmmc} </if>
            <if test="bmlb != null and bmlb != ''"> and bmlb = #{bmlb} </if>
            <if test="fzrdm != null and fzrdm != ''"> and fzrdm = #{fzrdm} </if>
            <if test="tel != null and tel != ''"> and tel = #{tel} </if>
            <if test="xjbms != null"> and xjbms = #{xjbms} </if>
            <if test="zgrs != null"> and zgrs = #{zgrs} </if>
            <if test="syzt != null and syzt != ''"> and syzt = #{syzt} </if>
            <if test="jlrId != null"> and Jlr_ID = #{jlrId} </if>
            <if test="jlRq != null and jlRq != ''"> and Jl_RQ = #{jlRq} </if>
            <if test="xgrId != null"> and Xgr_ID = #{xgrId} </if>
            <if test="xgRq != null and xgRq != ''"> and Xg_RQ = #{xgRq} </if>
            <if test="sjly != null and sjly != ''"> and Sjly = #{sjly} </if>
            <if test="sfmx != null and sfmx != ''"> and SFMX = #{sfmx} </if>
            <if test="zjm != null and zjm != ''"> and zjm = #{zjm} </if>
            <if test="fzrdm2 != null and fzrdm2 != ''"> and fzrdm2 = #{fzrdm2} </if>
            <if test="fzrdm3 != null and fzrdm3 != ''"> and fzrdm3 = #{fzrdm3} </if>
            and sts='Y'
    </trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
    delete from pubbmxx where   id= #{id}
</delete>

    <!--通过会计年度，公司代码，部门代码删除-->
    <delete id="SenderPubbmxxEntity_delete_bmxx">
        delete from pubbmxx where   kjnd= #{kjnd} and gsdm=#{gsdm}
        <if test="bmdm != null and bmdm != ''"> and bmdm = #{bmdm} </if>
    </delete>

</mapper>

