<?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.zbzbly.dao.impl.ZbZblyDaoImpl">

    <resultMap id="get-ZbZblyEntity-result" type="com.hzya.frame.grpU8.nxproof.zbzbly.entity.ZbZblyEntity" >
       <result property="gsdm" column="GSDM" jdbcType="VARCHAR"/>
           <result property="kjnd" column="KJND" jdbcType="VARCHAR"/>
           <result property="zblydm" column="ZBLYDM" jdbcType="VARCHAR"/>
           <result property="zblymc" column="ZBLYMC" jdbcType="VARCHAR"/>
           <result property="zjm" column="ZJM" jdbcType="VARCHAR"/>
           <result property="kzlkx" column="KZLKX" jdbcType="VARCHAR"/>
           <result property="kzdzk" column="KZDZK" jdbcType="VARCHAR"/>
           <result property="syzt" column="SYZT" jdbcType="VARCHAR"/>
           <result property="jlrId" column="JLR_ID" jdbcType="VARCHAR"/>
           <result property="jlRq" column="JL_RQ" jdbcType="VARCHAR"/>
           <result property="xgrId" column="XGR_ID" jdbcType="VARCHAR"/>
           <result property="xgRq" column="XG_RQ" jdbcType="VARCHAR"/>
           <result property="sfmx" column="SFMX" jdbcType="VARCHAR"/>
           <result property="sjdm" column="SJDM" jdbcType="VARCHAR"/>
           <result property="jc" column="JC" jdbcType="INTEGER"/>
           <result property="pxh" column="PXH" jdbcType="INTEGER"/>
           <result property="sjly" column="SJLY" jdbcType="VARCHAR"/>
        </resultMap>
    <!-- 查询的字段-->
    <sql id = "ZbZblyEntity_Base_Column_List">
        GSDM
       ,KJND 
        ,ZBLYDM 
        ,ZBLYMC 
        ,ZJM 
        ,KZLKX 
        ,KZDZK 
        ,SYZT 
        ,JLR_ID 
        ,JL_RQ 
        ,XGR_ID 
        ,XG_RQ 
        ,SFMX 
        ,SJDM 
        ,JC 
        ,PXH 
        ,SJLY 
     </sql>
 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-ZbZblyEntity-result" parameterType = "com.hzya.frame.grpU8.nxproof.zbzbly.entity.ZbZblyEntity">
    select
    <include refid="ZbZblyEntity_Base_Column_List" />
    from ZB_ZBLY
    <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="zblydm != null and zblydm != ''"> and ZBLYDM = #{zblydm} </if>
            <if test="zblymc != null and zblymc != ''"> and ZBLYMC = #{zblymc} </if>
            <if test="zjm != null and zjm != ''"> and ZJM = #{zjm} </if>
            <if test="kzlkx != null and kzlkx != ''"> and KZLKX = #{kzlkx} </if>
            <if test="kzdzk != null and kzdzk != ''"> and KZDZK = #{kzdzk} </if>
            <if test="syzt != null and syzt != ''"> and SYZT = #{syzt} </if>
            <if test="jlrId != null and jlrId != ''"> and JLR_ID = #{jlrId} </if>
            <if test="jlRq != null and jlRq != ''"> and JL_RQ = #{jlRq} </if>
            <if test="xgrId != null and xgrId != ''"> and XGR_ID = #{xgrId} </if>
            <if test="xgRq != null and xgRq != ''"> and XG_RQ = #{xgRq} </if>
            <if test="sfmx != null and sfmx != ''"> and SFMX = #{sfmx} </if>
            <if test="sjdm != null and sjdm != ''"> and SJDM = #{sjdm} </if>
            <if test="jc != null"> and JC = #{jc} </if>
            <if test="pxh != null"> and PXH = #{pxh} </if>
            <if test="sjly != null and sjly != ''"> and SJLY = #{sjly} </if>
    </trim>
</select>
    
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.grpU8.nxproof.zbzbly.entity.ZbZblyEntity">
        select  count(1)   from ZB_ZBLY
    <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="zblydm != null and zblydm != ''"> and ZBLYDM = #{zblydm} </if>
            <if test="zblymc != null and zblymc != ''"> and ZBLYMC = #{zblymc} </if>
            <if test="zjm != null and zjm != ''"> and ZJM = #{zjm} </if>
            <if test="kzlkx != null and kzlkx != ''"> and KZLKX = #{kzlkx} </if>
            <if test="kzdzk != null and kzdzk != ''"> and KZDZK = #{kzdzk} </if>
            <if test="syzt != null and syzt != ''"> and SYZT = #{syzt} </if>
            <if test="jlrId != null and jlrId != ''"> and JLR_ID = #{jlrId} </if>
            <if test="jlRq != null and jlRq != ''"> and JL_RQ = #{jlRq} </if>
            <if test="xgrId != null and xgrId != ''"> and XGR_ID = #{xgrId} </if>
            <if test="xgRq != null and xgRq != ''"> and XG_RQ = #{xgRq} </if>
            <if test="sfmx != null and sfmx != ''"> and SFMX = #{sfmx} </if>
            <if test="sjdm != null and sjdm != ''"> and SJDM = #{sjdm} </if>
            <if test="jc != null"> and JC = #{jc} </if>
            <if test="pxh != null"> and PXH = #{pxh} </if>
            <if test="sjly != null and sjly != ''"> and SJLY = #{sjly} </if>
    </trim>
    </select>

    <!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-ZbZblyEntity-result" parameterType = "com.hzya.frame.grpU8.nxproof.zbzbly.entity.ZbZblyEntity">
    select
    <include refid="ZbZblyEntity_Base_Column_List" />
    from ZB_ZBLY
    <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="zblydm != null and zblydm != ''"> and ZBLYDM like concat('%',#{zblydm},'%') </if>
            <if test="zblymc != null and zblymc != ''"> and ZBLYMC like concat('%',#{zblymc},'%') </if>
            <if test="zjm != null and zjm != ''"> and ZJM like concat('%',#{zjm},'%') </if>
            <if test="kzlkx != null and kzlkx != ''"> and KZLKX like concat('%',#{kzlkx},'%') </if>
            <if test="kzdzk != null and kzdzk != ''"> and KZDZK like concat('%',#{kzdzk},'%') </if>
            <if test="syzt != null and syzt != ''"> and SYZT like concat('%',#{syzt},'%') </if>
            <if test="jlrId != null and jlrId != ''"> 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 xgrId != ''"> and XGR_ID like concat('%',#{xgrId},'%') </if>
            <if test="xgRq != null and xgRq != ''"> and XG_RQ like concat('%',#{xgRq},'%') </if>
            <if test="sfmx != null and sfmx != ''"> and SFMX like concat('%',#{sfmx},'%') </if>
            <if test="sjdm != null and sjdm != ''"> and SJDM like concat('%',#{sjdm},'%') </if>
            <if test="jc != null"> and JC like concat('%',#{jc},'%') </if>
            <if test="pxh != null"> and PXH like concat('%',#{pxh},'%') </if>
            <if test="sjly != null and sjly != ''"> and SJLY like concat('%',#{sjly},'%') </if>
    </trim>
</select>

<!-- 查询列表 字段采用or格式 -->
<select id="ZbZblyentity_list_or" resultMap="get-ZbZblyEntity-result" parameterType = "com.hzya.frame.grpU8.nxproof.zbzbly.entity.ZbZblyEntity">
    select
    <include refid="ZbZblyEntity_Base_Column_List" />
    from ZB_ZBLY
    <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="zblydm != null and zblydm != ''"> or ZBLYDM = #{zblydm} </if>
             <if test="zblymc != null and zblymc != ''"> or ZBLYMC = #{zblymc} </if>
             <if test="zjm != null and zjm != ''"> or ZJM = #{zjm} </if>
             <if test="kzlkx != null and kzlkx != ''"> or KZLKX = #{kzlkx} </if>
             <if test="kzdzk != null and kzdzk != ''"> or KZDZK = #{kzdzk} </if>
             <if test="syzt != null and syzt != ''"> or SYZT = #{syzt} </if>
             <if test="jlrId != null and jlrId != ''"> or JLR_ID = #{jlrId} </if>
             <if test="jlRq != null and jlRq != ''"> or JL_RQ = #{jlRq} </if>
             <if test="xgrId != null and xgrId != ''"> or XGR_ID = #{xgrId} </if>
             <if test="xgRq != null and xgRq != ''"> or XG_RQ = #{xgRq} </if>
             <if test="sfmx != null and sfmx != ''"> or SFMX = #{sfmx} </if>
             <if test="sjdm != null and sjdm != ''"> or SJDM = #{sjdm} </if>
             <if test="jc != null"> or JC = #{jc} </if>
             <if test="pxh != null"> or PXH = #{pxh} </if>
             <if test="sjly != null and sjly != ''"> or SJLY = #{sjly} </if>
    </trim>
</select>

<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.grpU8.nxproof.zbzbly.entity.ZbZblyEntity" keyProperty="gsdm" useGeneratedKeys="true">
    insert into ZB_ZBLY(
  <trim suffix="" suffixOverrides=",">
       <if test="gsdm != null and gsdm != ''"> GSDM , </if>
            <if test="kjnd != null and kjnd != ''"> KJND , </if>
            <if test="zblydm != null and zblydm != ''"> ZBLYDM , </if>
            <if test="zblymc != null and zblymc != ''"> ZBLYMC , </if>
            <if test="zjm != null and zjm != ''"> ZJM , </if>
            <if test="kzlkx != null and kzlkx != ''"> KZLKX , </if>
            <if test="kzdzk != null and kzdzk != ''"> KZDZK , </if>
            <if test="syzt != null and syzt != ''"> SYZT , </if>
            <if test="jlrId != null and jlrId != ''"> JLR_ID , </if>
            <if test="jlRq != null and jlRq != ''"> JL_RQ , </if>
            <if test="xgrId != null and xgrId != ''"> XGR_ID , </if>
            <if test="xgRq != null and xgRq != ''"> XG_RQ , </if>
            <if test="sfmx != null and sfmx != ''"> SFMX , </if>
            <if test="sjdm != null and sjdm != ''"> SJDM , </if>
            <if test="jc != null"> JC , </if>
            <if test="pxh != null"> PXH , </if>
            <if test="sjly != null and sjly != ''"> SJLY , </if>
  </trim>
  )values(
 <trim suffix="" suffixOverrides=",">
       <if test="gsdm != null and gsdm != ''"> #{gsdm} ,</if>
            <if test="kjnd != null and kjnd != ''"> #{kjnd} ,</if>
            <if test="zblydm != null and zblydm != ''"> #{zblydm} ,</if>
            <if test="zblymc != null and zblymc != ''"> #{zblymc} ,</if>
            <if test="zjm != null and zjm != ''"> #{zjm} ,</if>
            <if test="kzlkx != null and kzlkx != ''"> #{kzlkx} ,</if>
            <if test="kzdzk != null and kzdzk != ''"> #{kzdzk} ,</if>
            <if test="syzt != null and syzt != ''"> #{syzt} ,</if>
            <if test="jlrId != null and jlrId != ''"> #{jlrId} ,</if>
            <if test="jlRq != null and jlRq != ''"> #{jlRq} ,</if>
            <if test="xgrId != null and xgrId != ''"> #{xgrId} ,</if>
            <if test="xgRq != null and xgRq != ''"> #{xgRq} ,</if>
            <if test="sfmx != null and sfmx != ''"> #{sfmx} ,</if>
            <if test="sjdm != null and sjdm != ''"> #{sjdm} ,</if>
            <if test="jc != null"> #{jc} ,</if>
            <if test="pxh != null"> #{pxh} ,</if>
            <if test="sjly != null and sjly != ''"> #{sjly} ,</if>
  </trim>
  )  
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="gsdm" useGeneratedKeys="true">
  insert into ZB_ZBLY(ZBLYMC, ZJM, KZLKX, KZDZK, SYZT, JLR_ID, JL_RQ, XGR_ID, XG_RQ, SFMX, SJDM, JC, PXH, SJLY,  sts) 
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.zblymc},#{entity.zjm},#{entity.kzlkx},#{entity.kzdzk},#{entity.syzt},#{entity.jlrId},#{entity.jlRq},#{entity.xgrId},#{entity.xgRq},#{entity.sfmx},#{entity.sjdm},#{entity.jc},#{entity.pxh},#{entity.sjly}, 'Y')
    </foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="gsdm" useGeneratedKeys="true">
    insert into ZB_ZBLY(ZBLYMC, ZJM, KZLKX, KZDZK, SYZT, JLR_ID, JL_RQ, XGR_ID, XG_RQ, SFMX, SJDM, JC, PXH, SJLY)
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.zblymc},#{entity.zjm},#{entity.kzlkx},#{entity.kzdzk},#{entity.syzt},#{entity.jlrId},#{entity.jlRq},#{entity.xgrId},#{entity.xgRq},#{entity.sfmx},#{entity.sjdm},#{entity.jc},#{entity.pxh},#{entity.sjly})
    </foreach>
    on duplicate key update
    ZBLYMC = values(ZBLYMC),
    ZJM = values(ZJM),
    KZLKX = values(KZLKX),
    KZDZK = values(KZDZK),
    SYZT = values(SYZT),
    JLR_ID = values(JLR_ID),
    JL_RQ = values(JL_RQ),
    XGR_ID = values(XGR_ID),
    XG_RQ = values(XG_RQ),
    SFMX = values(SFMX),
    SJDM = values(SJDM),
    JC = values(JC),
    PXH = values(PXH),
    SJLY = values(SJLY)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.grpU8.nxproof.zbzbly.entity.ZbZblyEntity" >
update ZB_ZBLY  set
<trim suffix="" suffixOverrides=",">
  <if test="zblymc != null and zblymc != ''"> ZBLYMC = #{zblymc},</if>
  <if test="zjm != null and zjm != ''"> ZJM = #{zjm},</if>
  <if test="kzlkx != null and kzlkx != ''"> KZLKX = #{kzlkx},</if>
  <if test="kzdzk != null and kzdzk != ''"> KZDZK = #{kzdzk},</if>
  <if test="syzt != null and syzt != ''"> SYZT = #{syzt},</if>
  <if test="jlrId != null and jlrId != ''"> JLR_ID = #{jlrId},</if>
  <if test="jlRq != null and jlRq != ''"> JL_RQ = #{jlRq},</if>
  <if test="xgrId != null and xgrId != ''"> XGR_ID = #{xgrId},</if>
  <if test="xgRq != null and xgRq != ''"> XG_RQ = #{xgRq},</if>
  <if test="sfmx != null and sfmx != ''"> SFMX = #{sfmx},</if>
  <if test="sjdm != null and sjdm != ''"> SJDM = #{sjdm},</if>
  <if test="jc != null"> JC = #{jc},</if>
  <if test="pxh != null"> PXH = #{pxh},</if>
  <if test="sjly != null and sjly != ''"> SJLY = #{sjly},</if>
</trim>
where GSDM = #{gsdm}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.grpU8.nxproof.zbzbly.entity.ZbZblyEntity" >
update ZB_ZBLY  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where GSDM = #{gsdm}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.grpU8.nxproof.zbzbly.entity.ZbZblyEntity" >
update ZB_ZBLY  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="zblydm != null and zblydm != ''"> and ZBLYDM = #{zblydm} </if>
            <if test="zblymc != null and zblymc != ''"> and ZBLYMC = #{zblymc} </if>
            <if test="zjm != null and zjm != ''"> and ZJM = #{zjm} </if>
            <if test="kzlkx != null and kzlkx != ''"> and KZLKX = #{kzlkx} </if>
            <if test="kzdzk != null and kzdzk != ''"> and KZDZK = #{kzdzk} </if>
            <if test="syzt != null and syzt != ''"> and SYZT = #{syzt} </if>
            <if test="jlrId != null and jlrId != ''"> and JLR_ID = #{jlrId} </if>
            <if test="jlRq != null and jlRq != ''"> and JL_RQ = #{jlRq} </if>
            <if test="xgrId != null and xgrId != ''"> and XGR_ID = #{xgrId} </if>
            <if test="xgRq != null and xgRq != ''"> and XG_RQ = #{xgRq} </if>
            <if test="sfmx != null and sfmx != ''"> and SFMX = #{sfmx} </if>
            <if test="sjdm != null and sjdm != ''"> and SJDM = #{sjdm} </if>
            <if test="jc != null"> and JC = #{jc} </if>
            <if test="pxh != null"> and PXH = #{pxh} </if>
            <if test="sjly != null and sjly != ''"> and SJLY = #{sjly} </if>
    </trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
    delete from ZB_ZBLY where GSDM = #{gsdm}
</delete>

</mapper>

