<?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.unis.base.server.dao.ShouGouZiGeDao'>
  
  <!--lipenghe-->
  <!--真收购资格表  单表[TY_SHOUGOUZIGE]表
        和实体基础映射-->
  <resultMap id='ResultMapBase' type='com.unis.base.server.entity.ShouGouZiGeDO'>
    <id column='SGZGID' jdbcType='DECIMAL' property='sgzgid' /><!--收购资格id#<主键><唯一><检索><非空>-->
    <result column='YYZZZCH' jdbcType='VARCHAR' property='yyzzzch' /><!--营业执照注册号#<检索>-->
    <result column='TYSHXYDM' jdbcType='VARCHAR' property='tyshxydm' /><!--统一社会信用代码#<检索><非空>-->
    <result column='SCZTMC' jdbcType='VARCHAR' property='scztmc' /><!--市场主体名称#<检索><非空>-->
    <result column='ZZJGDM' jdbcType='VARCHAR' property='zzjgdm' /><!--组织机构代码#<检索>-->
    <result column='XKWJMC' jdbcType='VARCHAR' property='xkwjmc' /><!--许可文件名称-->
    <result column='XKWJBH' jdbcType='VARCHAR' property='xkwjbh' /><!--许可文件编号#<非空>-->
    <result column='XKNR' jdbcType='VARCHAR' property='xknr' /><!--许可内容-->
    <result column='YXQQ' jdbcType='DECIMAL' property='yxqq' /><!--有效期起#<检索>-->
    <result column='YXQZ' jdbcType='DECIMAL' property='yxqz' /><!--有效期止#<检索>-->
    <result column='XKJGBM' jdbcType='VARCHAR' property='xkjgbm' /><!--许可机关编码#<检索>-->
    <result column='XKJGBMMC' jdbcType='VARCHAR' property='xkjgbmmc' /><!--许可机关编码名称#<检索>-->
    <result column='YXZT' jdbcType='DECIMAL' property='yxzt' /><!--有效状态#<检索>1有效0无效-->
    <result column='STATUS' jdbcType='DECIMAL' property='status' /><!--数据状态-->
    <result column='VERSION' jdbcType='DECIMAL' property='version' /><!--数据版本-->
    <result column='CREATOR' jdbcType='VARCHAR' property='creator' /><!--创建人-->
    <result column='CREATOR_CODE' jdbcType='VARCHAR' property='creatorCode' /><!--创建人编码-->
    <result column='CREATE_DATE' jdbcType='TIMESTAMP' property='createDate' /><!--创建时间#<默认值:current>-->
    <result column='REFRESHER' jdbcType='VARCHAR' property='refresher' /><!--修改人-->
    <result column='REFRESHER_CODE' jdbcType='VARCHAR' property='refresherCode' /><!--修改人编码-->
    <result column='REFRESH_TIME' jdbcType='TIMESTAMP' property='refreshTime' /><!--修改时间#<默认值:current>-->
    <result column='REMARK' jdbcType='VARCHAR' property='remark' /><!--备注-->
  </resultMap>
  
  <!--[TY_SHOUGOUZIGE]表基础列-->
  <sql id='Column_Base_List'>
    SGZGID, YYZZZCH, TYSHXYDM, SCZTMC, ZZJGDM, XKWJMC, XKWJBH, XKNR, YXQQ, YXQZ, XKJGBM, 
    XKJGBMMC, YXZT, STATUS, VERSION, CREATOR, CREATOR_CODE, CREATE_DATE, REFRESHER, REFRESHER_CODE, 
    REFRESH_TIME, REMARK
  </sql>
  
  <!--[TY_SHOUGOUZIGE]带别名的表基础列,别名为大写表名-->
  <sql id='Column_Alias_List'>
    A.SGZGID, A.YYZZZCH, A.TYSHXYDM, A.SCZTMC, A.ZZJGDM, A.XKWJMC, A.XKWJBH, A.XKNR, 
    A.YXQQ, A.YXQZ, A.XKJGBM, A.XKJGBMMC, A.YXZT, A.STATUS, A.VERSION, A.CREATOR, A.CREATOR_CODE, 
    A.CREATE_DATE, A.REFRESHER, A.REFRESHER_CODE, A.REFRESH_TIME, A.REMARK
  </sql>
  
  <!--[TY_SHOUGOUZIGE]表 order by 条件-->
  <sql id='Order_By_Clause'>
    ORDER BY SGZGID DESC
  </sql>
  
  <!--[TY_SHOUGOUZIGE]表 order by 条件-->
  <sql id='Order_By_Alias_Clause'>
    ORDER BY A.SGZGID DESC
  </sql>
  
  <!--批量插入全部字段,[GBase Server]特别注意:批量插入全部字段时,数据库默认值会不起效-->
  <insert id='insertBatchEntityList'>
    insert into TY_SHOUGOUZIGE (SGZGID, YYZZZCH, TYSHXYDM, 
      SCZTMC, ZZJGDM, XKWJMC, 
      XKWJBH, XKNR, YXQQ, 
      YXQZ, XKJGBM, XKJGBMMC, 
      YXZT, STATUS, VERSION, 
      CREATOR, CREATOR_CODE, CREATE_DATE, 
      REFRESHER, REFRESHER_CODE, REFRESH_TIME, 
      REMARK)  SELECT * FROM 
    <foreach close=')' collection='list' index='index' item='item' open='(' separator='UNION ALL'>
       SELECT #{item.sgzgid,jdbcType=DECIMAL}, #{item.yyzzzch,jdbcType=VARCHAR}, #{item.tyshxydm,jdbcType=VARCHAR}, 
        #{item.scztmc,jdbcType=VARCHAR}, #{item.zzjgdm,jdbcType=VARCHAR}, #{item.xkwjmc,jdbcType=VARCHAR}, 
        #{item.xkwjbh,jdbcType=VARCHAR}, #{item.xknr,jdbcType=VARCHAR}, #{item.yxqq,jdbcType=DECIMAL}, 
        #{item.yxqz,jdbcType=DECIMAL}, #{item.xkjgbm,jdbcType=VARCHAR}, #{item.xkjgbmmc,jdbcType=VARCHAR}, 
        #{item.yxzt,jdbcType=DECIMAL}, #{item.status,jdbcType=DECIMAL}, #{item.version,jdbcType=DECIMAL}, 
        #{item.creator,jdbcType=VARCHAR}, #{item.creatorCode,jdbcType=VARCHAR}, #{item.createDate,jdbcType=TIMESTAMP}, 
        #{item.refresher,jdbcType=VARCHAR}, #{item.refresherCode,jdbcType=VARCHAR}, #{item.refreshTime,jdbcType=TIMESTAMP}, 
        #{item.remark,jdbcType=VARCHAR} FROM DUAL 
    </foreach>
  </insert>
  
  <!--更改状态-->
  <update id='updateStatusByEntity'>
    update TY_SHOUGOUZIGE
    <set>
      <if test='scztmc != null'>
        SCZTMC = #{scztmc,jdbcType=VARCHAR},
      </if>
      <if test='yxzt != null'>
        YXZT = #{yxzt,jdbcType=DECIMAL},
      </if>
      <if test='tyshxydm != null'>
        TYSHXYDM = #{tyshxydm,jdbcType=VARCHAR},
      </if>
      <if test='refresher != null'>
        REFRESHER = #{refresher,jdbcType=VARCHAR},
      </if>
      <if test='refresherCode != null'>
        REFRESHER_CODE = #{refresherCode,jdbcType=VARCHAR},
      </if>
      <if test='refreshTime != null'>
        REFRESH_TIME = #{refreshTime,jdbcType=TIMESTAMP},
      </if>
      <if test='xkwjbh != null'>
        XKWJBH = #{xkwjbh,jdbcType=VARCHAR},
      </if>
      <if test='xkjgbm != null'>
        XKJGBM = #{xkjgbm,jdbcType=VARCHAR},
      </if>
      <if test='xkjgbmmc != null'>
        XKJGBMMC = #{xkjgbmmc,jdbcType=VARCHAR},
      </if>
      <if test='yxqz != null'>
        YXQZ = #{yxqz,jdbcType=DECIMAL},
      </if>
      <if test='xkwjmc != null'>
        XKWJMC = #{xkwjmc,jdbcType=VARCHAR},
      </if>
      <if test='creatorCode != null'>
        CREATOR_CODE = #{creatorCode,jdbcType=VARCHAR},
      </if>
        VERSION = VERSION +1 
    </set>
    <where>
      <!--此处为必填条件,如不满足则不执行,以免更新全部-->
      <choose>
        <when test='sgzgid !=null'>
          AND SGZGID = #{sgzgid,jdbcType=DECIMAL}
        </when>
        <otherwise>
          AND 1=0
        </otherwise>
      </choose>
      <!--version乐观锁-->
      <if test='version !=null'>
        AND VERSION = #{version,jdbcType=DECIMAL}
      </if>
    </where>
  </update>
  
  <!--根据实体批量更新全部字段,[GBase Server]批量更新全部字段-->
  <update id='updateBatchByEntityList' parameterType='java.util.List'>
    <foreach collection='list' index='index' item='item' separator=';'>
      update TY_SHOUGOUZIGE
      set YYZZZCH = #{item.yyzzzch,jdbcType=VARCHAR},
        TYSHXYDM = #{item.tyshxydm,jdbcType=VARCHAR},
        SCZTMC = #{item.scztmc,jdbcType=VARCHAR},
        ZZJGDM = #{item.zzjgdm,jdbcType=VARCHAR},
        XKWJMC = #{item.xkwjmc,jdbcType=VARCHAR},
        XKWJBH = #{item.xkwjbh,jdbcType=VARCHAR},
        XKNR = #{item.xknr,jdbcType=VARCHAR},
        YXQQ = #{item.yxqq,jdbcType=DECIMAL},
        YXQZ = #{item.yxqz,jdbcType=DECIMAL},
        XKJGBM = #{item.xkjgbm,jdbcType=VARCHAR},
        XKJGBMMC = #{item.xkjgbmmc,jdbcType=VARCHAR},
        YXZT = #{item.yxzt,jdbcType=DECIMAL},
        STATUS = #{item.status,jdbcType=DECIMAL},
        REFRESHER = #{item.refresher,jdbcType=VARCHAR},
        REFRESHER_CODE = #{item.refresherCode,jdbcType=VARCHAR},
        REFRESH_TIME = #{item.refreshTime,jdbcType=TIMESTAMP},
        REMARK = #{item.remark,jdbcType=VARCHAR}
      <where>
        <!--此处为必填条件,如不满足则不执行,以免更新全部-->
        <choose>
          <when test='item.sgzgid !=null'>
            SGZGID = #{item.sgzgid,jdbcType=DECIMAL}
          </when>
          <otherwise>
            AND 1=0
          </otherwise>
        </choose>
        <!--此处可添加状态条件等-->
        <if test='item.status!=null'>
          AND STATUS = #{item.status,jdbcType=DECIMAL}
        </if>
      </where>
    </foreach>
  </update>
  
  <!--根据实体某些属性更新全部字段-->
  <update id='updateByEntity'>
    update TY_SHOUGOUZIGE
    set YYZZZCH = #{yyzzzch,jdbcType=VARCHAR},
      TYSHXYDM = #{tyshxydm,jdbcType=VARCHAR},
      SCZTMC = #{scztmc,jdbcType=VARCHAR},
      ZZJGDM = #{zzjgdm,jdbcType=VARCHAR},
      XKWJMC = #{xkwjmc,jdbcType=VARCHAR},
      XKWJBH = #{xkwjbh,jdbcType=VARCHAR},
      XKNR = #{xknr,jdbcType=VARCHAR},
      YXQQ = #{yxqq,jdbcType=DECIMAL},
      YXQZ = #{yxqz,jdbcType=DECIMAL},
      XKJGBM = #{xkjgbm,jdbcType=VARCHAR},
      XKJGBMMC = #{xkjgbmmc,jdbcType=VARCHAR},
      YXZT = #{yxzt,jdbcType=DECIMAL},
      STATUS = #{status,jdbcType=DECIMAL},
      REFRESHER = #{refresher,jdbcType=VARCHAR},
      REFRESHER_CODE = #{refresherCode,jdbcType=VARCHAR},
      REFRESH_TIME = #{refreshTime,jdbcType=TIMESTAMP},
      REMARK = #{remark,jdbcType=VARCHAR},
      VERSION = VERSION +1 
    <where>
      <!--此处为必填条件,如不满足则不执行,以免更新全部-->
      <choose>
        <when test='sgzgid !=null'>
          AND SGZGID = #{sgzgid,jdbcType=DECIMAL}
        </when>
        <otherwise>
          AND 1=0
        </otherwise>
      </choose>
      <!--version乐观锁-->
      <if test='version !=null'>
        AND VERSION = #{version,jdbcType=DECIMAL}
      </if>
      <!--此处可添加状态条件等-->
      <if test='status!=null'>
        AND STATUS = #{status,jdbcType=DECIMAL}
      </if>
    </where>
  </update>
  
  <!--根据实体不为空的属性,选择性更新字段-->
  <update id='updateByEntitySelective'>
    update TY_SHOUGOUZIGE
    <set>
      <if test='yyzzzch != null'>
        YYZZZCH = #{yyzzzch,jdbcType=VARCHAR},
      </if>
      <if test='tyshxydm != null'>
        TYSHXYDM = #{tyshxydm,jdbcType=VARCHAR},
      </if>
      <if test='scztmc != null'>
        SCZTMC = #{scztmc,jdbcType=VARCHAR},
      </if>
      <if test='zzjgdm != null'>
        ZZJGDM = #{zzjgdm,jdbcType=VARCHAR},
      </if>
      <if test='xkwjmc != null'>
        XKWJMC = #{xkwjmc,jdbcType=VARCHAR},
      </if>
      <if test='xkwjbh != null'>
        XKWJBH = #{xkwjbh,jdbcType=VARCHAR},
      </if>
      <if test='xknr != null'>
        XKNR = #{xknr,jdbcType=VARCHAR},
      </if>
      <if test='yxqq != null'>
        YXQQ = #{yxqq,jdbcType=DECIMAL},
      </if>
      <if test='yxqz != null'>
        YXQZ = #{yxqz,jdbcType=DECIMAL},
      </if>
      <if test='xkjgbm != null'>
        XKJGBM = #{xkjgbm,jdbcType=VARCHAR},
      </if>
      <if test='xkjgbmmc != null'>
        XKJGBMMC = #{xkjgbmmc,jdbcType=VARCHAR},
      </if>
      <if test='yxzt != null'>
        YXZT = #{yxzt,jdbcType=DECIMAL},
      </if>
      <if test='status != null'>
        STATUS = #{status,jdbcType=DECIMAL},
      </if>
      <if test='refresher != null'>
        REFRESHER = #{refresher,jdbcType=VARCHAR},
      </if>
      <if test='refresherCode != null'>
        REFRESHER_CODE = #{refresherCode,jdbcType=VARCHAR},
      </if>
      <if test='refreshTime != null'>
        REFRESH_TIME = #{refreshTime,jdbcType=TIMESTAMP},
      </if>
      <if test='remark != null'>
        REMARK = #{remark,jdbcType=VARCHAR},
      </if>
        VERSION = VERSION +1 
    </set>
    <where>
      <!--此处为必填条件,如不满足则不执行,以免更新全部-->
      <choose>
        <when test='sgzgid !=null'>
          AND SGZGID = #{sgzgid,jdbcType=DECIMAL}
        </when>
        <when test='yyzzzch !=null'>
          AND YYZZZCH = #{yyzzzch,jdbcType=VARCHAR}
        </when>
        <when test='tyshxydm !=null'>
          AND TYSHXYDM = #{tyshxydm,jdbcType=VARCHAR}
        </when>
        <otherwise>
          AND 1=0
        </otherwise>
      </choose>
      <!--version乐观锁-->
      <if test='version !=null'>
        AND VERSION = #{version,jdbcType=DECIMAL}
      </if>
      <!--此处可添加状态条件等-->
      <if test='status!=null'>
        AND STATUS = #{status,jdbcType=DECIMAL}
      </if>
    </where>
  </update>
  
  <!--[真删除]根据实体的某些属性进行单条或者批量删除
          此处不支持id集合的形式,如有其他情况自行添加-->
  <delete id='deleteByEntity'>
    DELETE FROM TY_SHOUGOUZIGE
    <where>
      <!--此处为必填条件,如不满足则不执行,以免更新全部-->
      <choose>
        <when test='sgzgid !=null'>
          AND SGZGID = #{sgzgid,jdbcType=DECIMAL}
        </when>
        <otherwise>
          AND 1=0
        </otherwise>
      </choose>
      <!--此处可添加状态条件等-->
      <if test='status!=null'>
        AND STATUS = #{status,jdbcType=DECIMAL}
      </if>
    </where>
  </delete>
  
  <!--[假删除]根据实体的某些属性进行单条或者批量删除
          此处不支持id集合的形式,如有其他情况自行添加-->
  <update id='deleteShamByEntity'>
    update TY_SHOUGOUZIGE
    set 
    STATUS = #{status,jdbcType=DECIMAL}
    <where>
      <!--此处为必填条件,如不满足则不执行,以免更新全部-->
      <choose>
        <when test='sgzgid !=null'>
          AND SGZGID = #{sgzgid,jdbcType=DECIMAL}
        </when>
        <otherwise>
          AND 1=0
        </otherwise>
      </choose>
    </where>
  </update>
  
  <!--根据实体的某些属性查询数量-->
  <select id='selectCountByEntity' resultType='java.lang.Integer'>
    SELECT 
    COUNT(1)
    FROM TY_SHOUGOUZIGE
    <where>
      <!--自定义配置的检索条件-->
      <if test='sgzgid !=null'>
        AND SGZGID = #{sgzgid,jdbcType=DECIMAL}
      </if>
      <if test='yyzzzch !=null and yyzzzch != ""'>
        AND YYZZZCH = #{yyzzzch,jdbcType=VARCHAR}
      </if>
      <if test='tyshxydm !=null and tyshxydm != ""'>
        AND TYSHXYDM LIKE CONCAT('%',CONCAT(#{tyshxydm,jdbcType=VARCHAR},'%'))
      </if>
      <if test='scztmc !=null and scztmc != ""'>
        AND SCZTMC LIKE CONCAT('%',CONCAT(#{scztmc,jdbcType=VARCHAR},'%'))
      </if>
      <if test='zzjgdm !=null and zzjgdm != ""'>
        AND ZZJGDM = #{zzjgdm,jdbcType=VARCHAR}
      </if>
      <if test='xkjgbm !=null and xkjgbm != ""'>
        AND XKJGBM = #{xkjgbm,jdbcType=VARCHAR}
      </if>
      <if test='xkjgbmmc !=null and xkjgbmmc != ""'>
        AND XKJGBMMC LIKE CONCAT('%',CONCAT(#{xkjgbmmc,jdbcType=VARCHAR},'%'))
      </if>
      <if test='yxzt !=null'>
        AND YXZT = #{yxzt,jdbcType=DECIMAL}
      </if>
      <if test='yxqq !=null'>
        <![CDATA[
        AND YXQQ >= #{yxqq,jdbcType=DECIMAL}
        ]]>
      </if>
      <if test='yxqz !=null'>
        <![CDATA[
        AND YXQZ <= #{yxqz,jdbcType=DECIMAL}
        ]]>
      </if>
      <!--if条件要注意,以免误删除或者更新全部-->
      <!--此处可添加状态条件等-->
      <if test='status!=null'>
        AND STATUS = #{status,jdbcType=DECIMAL}
      </if>
    </where>
  </select>
  
  <!--根据实体的唯一属性查询数量-->
  <select id='selectCountById' resultType='java.lang.Integer'>
    SELECT 
    COUNT(1)
    FROM TY_SHOUGOUZIGE
    <where>
      <if test='sgzgid !=null'>
        OR SGZGID = #{sgzgid,jdbcType=DECIMAL}
      </if>
      <if test='yyzzzch !=null'>
        OR yyzzzch = #{yyzzzch,jdbcType=VARCHAR}
      </if>
      <if test='tyshxydm !=null'>
        OR TYSHXYDM = #{tyshxydm,jdbcType=VARCHAR}
      </if>
    </where>
  </select>
  
  <!--根据实体的业务唯一属性(且非指定主键数据)判断是否存在-->
  <select id='selectExistsByEntity' resultType='java.lang.Integer'>
    SELECT
    COUNT(1)
    FROM TY_SHOUGOUZIGE
    <where>
      <if test='sgzgid !=null'>
        AND SGZGID != #{sgzgid,jdbcType=DECIMAL}
      </if>
      <!--此处可添加状态条件等-->
      <!--
      <if test='status!=null'>
        AND STATUS = #{status,jdbcType=DECIMAL}
      </if>
      -->
    </where>
  </select>
  
  <!--根据实体(唯一标示)查询一条数据,如id,联合主键,业务唯一标示等,多种方式均可,但要保证数据唯一
          此处只使用系统id,如有其他情况自行添加-->
  <select id='selectById' resultType='com.unis.base.common.vo.ShouGouZiGeVO'>
    SELECT 
    <include refid='Column_Base_List' />
    FROM TY_SHOUGOUZIGE
    <where>
      <!--此处为必填条件,如不满足则不执行,以免查询全部-->
      <choose>
        <when test='sgzgid !=null'>
          AND SGZGID = #{sgzgid,jdbcType=DECIMAL}
        </when>
        <otherwise>
          AND 1=0
        </otherwise>
      </choose>
      <!--此处可添加状态条件等-->
      <if test='status!=null'>
        AND STATUS = #{status,jdbcType=DECIMAL}
      </if>
    </where>
  </select>
  
  <!--根据实体的某些属性查询分页数据
          此处选取其中1-2个字段,需要根据实际情况修改-->
  <select id='selectPageByEntity' resultType='com.unis.base.common.vo.ShouGouZiGeVO'>
    SELECT 
    <include refid='Column_Alias_List' />,C.QYXZ
    FROM TY_SHOUGOUZIGE A
   <!-- JOIN (
      SELECT MAX(SGZGID) AS SGZGID FROM TY_SHOUGOUZIGE
      <where>
        <if test='status!=null'>
          AND STATUS = #{status,jdbcType=DECIMAL}
        </if>
        <if test='yxqq !=null'>
          <![CDATA[
        AND A.YXQQ >= #{yxqq,jdbcType=DECIMAL}
        ]]>
        </if>
        <if test='yxqz !=null'>
          <![CDATA[
        AND A.YXQZ <= #{yxqz,jdbcType=DECIMAL}
        ]]>
        </if>
        <if test='yxzt !=null'>
          AND A.YXZT = #{yxzt,jdbcType=DECIMAL}
        </if>
      </where>
      GROUP BY  TYSHXYDM
    ) B ON A.SGZGID = B.SGZGID-->
    JOIN TZ_SLQY C  on A.TYSHXYDM=C.TYSHXYDM
    <where>
      <!--自定义配置的检索条件-->
      <if test='sgzgid !=null'>
        AND A.SGZGID = #{sgzgid,jdbcType=DECIMAL}
      </if>
      <if test='yyzzzch !=null and yyzzzch != ""'>
        AND A.YYZZZCH LIKE CONCAT('%',CONCAT(#{yyzzzch,jdbcType=VARCHAR},'%'))
      </if>
      <if test='tyshxydm !=null and tyshxydm != ""'>
        AND A.TYSHXYDM LIKE CONCAT('%',CONCAT(#{tyshxydm,jdbcType=VARCHAR},'%'))
      </if>
      <if test='scztmc !=null and scztmc != ""'>
        AND A.SCZTMC LIKE CONCAT('%',CONCAT(#{scztmc,jdbcType=VARCHAR},'%'))
      </if>
      <if test='zzjgdm !=null and zzjgdm != ""'>
        AND A.ZZJGDM = #{zzjgdm,jdbcType=VARCHAR}
      </if>
      <if test='xkjgbm !=null and xkjgbm != ""'>
        AND A.XKJGBM = #{xkjgbm,jdbcType=VARCHAR}
      </if>
      <if test='xkjgbmmc !=null and xkjgbmmc != ""'>
        AND A.XKJGBMMC LIKE CONCAT('%',CONCAT(#{xkjgbmmc,jdbcType=VARCHAR},'%'))
      </if>
      <if test='yxzt !=null'>
        AND A.YXZT = #{yxzt,jdbcType=DECIMAL}
      </if>
      <if test='yxqq !=null'>
        <![CDATA[
        AND A.YXQQ >= #{yxqq,jdbcType=DECIMAL}
        ]]>
      </if>
      <if test='yxqz !=null'>
        <![CDATA[
        AND A.YXQZ <= #{yxqz,jdbcType=DECIMAL}
        ]]>
      </if>
      <!--if条件要注意,以免误删除或者更新全部-->
      <!--此处可添加状态条件等-->
      <if test='status!=null'>
        AND A.STATUS = #{status,jdbcType=DECIMAL}
      </if>
      <if test='qyxz !=null and qyxz != ""'>
        AND C.QYXZ = #{qyxz,jdbcType=VARCHAR}
      </if>
    </where>
    <include refid='Order_By_Alias_Clause' />
  </select>
  
  <!--根据实体的某些属性查询列表
          此处选取其中1-2个字段,需要根据实际情况修改-->
  <select id='selectByEntity' resultType='com.unis.base.common.vo.ShouGouZiGeVO'>
    SELECT 
    <include refid='Column_Base_List' />
    FROM TY_SHOUGOUZIGE
    <where>
      <!--自定义配置的检索条件-->
      <if test='sgzgid !=null'>
        AND SGZGID = #{sgzgid,jdbcType=DECIMAL}
      </if>
      <if test='yyzzzch !=null and yyzzzch != ""'>
        AND YYZZZCH = #{yyzzzch,jdbcType=VARCHAR}
      </if>
      <if test='tyshxydm !=null and tyshxydm != ""'>
        AND TYSHXYDM LIKE CONCAT('%',CONCAT(#{tyshxydm,jdbcType=VARCHAR},'%'))
      </if>
      <if test='scztmc !=null and scztmc != ""'>
        AND SCZTMC LIKE CONCAT('%',CONCAT(#{scztmc,jdbcType=VARCHAR},'%'))
      </if>
      <if test='zzjgdm !=null and zzjgdm != ""'>
        AND ZZJGDM = #{zzjgdm,jdbcType=VARCHAR}
      </if>
      <if test='xkjgbm !=null and xkjgbm != ""'>
        AND XKJGBM = #{xkjgbm,jdbcType=VARCHAR}
      </if>
      <if test='xkjgbmmc !=null and xkjgbmmc != ""'>
        AND XKJGBMMC LIKE CONCAT('%',CONCAT(#{xkjgbmmc,jdbcType=VARCHAR},'%'))
      </if>
      <if test='yxzt !=null'>
        AND YXZT = #{yxzt,jdbcType=DECIMAL}
      </if>
      <if test='yxqq !=null'>
        <![CDATA[
        AND YXQQ >= #{yxqq,jdbcType=DECIMAL}
        ]]>
      </if>
      <if test='yxqz !=null'>
        <![CDATA[
        AND YXQZ <= #{yxqz,jdbcType=DECIMAL}
        ]]>
      </if>
      <!--if条件要注意,以免误删除或者更新全部-->
      <!--此处可添加状态条件等-->
      <if test='status!=null'>
        AND STATUS = #{status,jdbcType=DECIMAL}
      </if>
    </where>
    <include refid='Order_By_Clause' />
  </select>
</mapper>