<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.person.dao.ibatis.PersonDaoImpl">

    <!-- 字段和属性映射 -->
    <resultMap type="PersonEntity" id="PersonEntity-Map">
        <id  property="id" column="id" />
        <result property="siteId" column="siteId" />
        <result property="siteName" column="siteName" />
        <result property="name" column="name" />
        <result property="idCard" column="idCard" />
        <result property="gender" column="gender" />
        <result property="phone" column="phone" />
        <result property="birthday" column="birthday" />
        <result property="address" column="address" />
        <result property="photo" column="photo" />
        <result property="sourcePhotoUri" column="sourcePhotoUri" />
        <result property="sourceId" column="sourceId" />
        <result property="remark" column="remark" />
        <result property="source" column="source" />
        <result property="inFaceHk" column="inFaceHk" />
        <result property="indexCode" column="indexCode" />
        <result property="ifaceGroupIndexCode" column="ifaceGroupIndexCode" />
        <result property="createUserId" column="createUserId" />
        <result property="createTime" column="createTime" />
        <result property="updateUserId" column="updateUserId" />
        <result property="updateTime" column="updateTime" />

    </resultMap>


    <!-- 表所有列 -->
    <sql id="_columns">
        <trim suffixOverrides="," suffix="">
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('id') or colPickMode == 1 and data.containsKey('id')))">
                a.id,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('siteId') or colPickMode == 1 and data.containsKey('siteId')))">
                a.siteId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('siteName') or colPickMode == 1 and data.containsKey('siteName')))">
                a.siteName,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('name') or colPickMode == 1 and data.containsKey('name')))">
                a.name,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('idCard') or colPickMode == 1 and data.containsKey('idCard')))">
                a.idCard,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('gender') or colPickMode == 1 and data.containsKey('gender')))">
                a.gender,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('phone') or colPickMode == 1 and data.containsKey('phone')))">
                a.phone,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('birthday') or colPickMode == 1 and data.containsKey('birthday')))">
                a.birthday,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('address') or colPickMode == 1 and data.containsKey('address')))">
                a.address,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('photo') or colPickMode == 1 and data.containsKey('photo')))">
                a.photo,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('sourcePhotoUri') or colPickMode == 1 and data.containsKey('sourcePhotoUri')))">
                a.sourcePhotoUri,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('sourceId') or colPickMode == 1 and data.containsKey('sourceId')))">
                a.sourceId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('remark') or colPickMode == 1 and data.containsKey('remark')))">
                a.remark,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('source') or colPickMode == 1 and data.containsKey('source')))">
                a.source,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('inFaceHk') or colPickMode == 1 and data.containsKey('inFaceHk')))">
                a.inFaceHk,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('indexCode') or colPickMode == 1 and data.containsKey('indexCode')))">
                a.indexCode,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('ifaceGroupIndexCode') or colPickMode == 1 and data.containsKey('ifaceGroupIndexCode')))">
                a.ifaceGroupIndexCode,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserId') or colPickMode == 1 and data.containsKey('createUserId')))">
                a.createUserId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
                a.createTime,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateUserId') or colPickMode == 1 and data.containsKey('updateUserId')))">
                a.updateUserId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
                a.updateTime,
            </if>
        </trim>
    </sql>
    <!-- 新增 区分主键自增加还是业务插入 -->
    <insert id="insert" parameterType="PersonEntity"  useGeneratedKeys="true" keyProperty="id">
        insert into mortals_xhx_person
        (siteId,siteName,name,idCard,gender,phone,birthday,address,photo,sourcePhotoUri,sourceId,remark,source,inFaceHk,indexCode,ifaceGroupIndexCode,createUserId,createTime,updateUserId,updateTime)
        VALUES
        (#{siteId},#{siteName},#{name},#{idCard},#{gender},#{phone},#{birthday},#{address},#{photo},#{sourcePhotoUri},#{sourceId},#{remark},#{source},#{inFaceHk},#{indexCode},#{ifaceGroupIndexCode},#{createUserId},#{createTime},#{updateUserId},#{updateTime})
    </insert>

    <!-- 批量新增 -->
    <insert id="insertBatch" parameterType="paramDto">
        insert into mortals_xhx_person
        (siteId,siteName,name,idCard,gender,phone,birthday,address,photo,sourcePhotoUri,sourceId,remark,source,inFaceHk,indexCode,ifaceGroupIndexCode,createUserId,createTime,updateUserId,updateTime)
        VALUES
        <foreach collection="data.dataList" item="item" index="index" separator="," >
            (#{item.siteId},#{item.siteName},#{item.name},#{item.idCard},#{item.gender},#{item.phone},#{item.birthday},#{item.address},#{item.photo},#{item.sourcePhotoUri},#{item.sourceId},#{item.remark},#{item.source},#{item.inFaceHk},#{item.indexCode},#{item.ifaceGroupIndexCode},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime})
        </foreach>
    </insert>


    <!-- 根据ParamDto更新 -->
    <update id="update" parameterType="paramDto">
        update mortals_xhx_person as a
        set
        <trim suffixOverrides="," suffix="">
            <if test="(colPickMode==0 and data.containsKey('siteId')) or (colPickMode==1 and !data.containsKey('siteId'))">
                a.siteId=#{data.siteId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('siteIdIncrement')) or (colPickMode==1 and !data.containsKey('siteIdIncrement'))">
                a.siteId=ifnull(a.siteId,0) + #{data.siteIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('siteName')) or (colPickMode==1 and !data.containsKey('siteName'))">
                a.siteName=#{data.siteName},
            </if>
            <if test="(colPickMode==0 and data.containsKey('name')) or (colPickMode==1 and !data.containsKey('name'))">
                a.name=#{data.name},
            </if>
            <if test="(colPickMode==0 and data.containsKey('idCard')) or (colPickMode==1 and !data.containsKey('idCard'))">
                a.idCard=#{data.idCard},
            </if>
            <if test="(colPickMode==0 and data.containsKey('gender')) or (colPickMode==1 and !data.containsKey('gender'))">
                a.gender=#{data.gender},
            </if>
            <if test="(colPickMode==0 and data.containsKey('genderIncrement')) or (colPickMode==1 and !data.containsKey('genderIncrement'))">
                a.gender=ifnull(a.gender,0) + #{data.genderIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('phone')) or (colPickMode==1 and !data.containsKey('phone'))">
                a.phone=#{data.phone},
            </if>
            <if test="(colPickMode==0 and data.containsKey('birthday')) or (colPickMode==1 and !data.containsKey('birthday'))">
                a.birthday=#{data.birthday},
            </if>
            <if test="(colPickMode==0 and data.containsKey('address')) or (colPickMode==1 and !data.containsKey('address'))">
                a.address=#{data.address},
            </if>
            <if test="(colPickMode==0 and data.containsKey('photo')) or (colPickMode==1 and !data.containsKey('photo'))">
                a.photo=#{data.photo},
            </if>
            <if test="(colPickMode==0 and data.containsKey('sourcePhotoUri')) or (colPickMode==1 and !data.containsKey('sourcePhotoUri'))">
                a.sourcePhotoUri=#{data.sourcePhotoUri},
            </if>
            <if test="(colPickMode==0 and data.containsKey('sourceId')) or (colPickMode==1 and !data.containsKey('sourceId'))">
                a.sourceId=#{data.sourceId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('sourceIdIncrement')) or (colPickMode==1 and !data.containsKey('sourceIdIncrement'))">
                a.sourceId=ifnull(a.sourceId,0) + #{data.sourceIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('remark')) or (colPickMode==1 and !data.containsKey('remark'))">
                a.remark=#{data.remark},
            </if>
            <if test="(colPickMode==0 and data.containsKey('source')) or (colPickMode==1 and !data.containsKey('source'))">
                a.source=#{data.source},
            </if>
            <if test="(colPickMode==0 and data.containsKey('sourceIncrement')) or (colPickMode==1 and !data.containsKey('sourceIncrement'))">
                a.source=ifnull(a.source,0) + #{data.sourceIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('inFaceHk')) or (colPickMode==1 and !data.containsKey('inFaceHk'))">
                a.inFaceHk=#{data.inFaceHk},
            </if>
            <if test="(colPickMode==0 and data.containsKey('inFaceHkIncrement')) or (colPickMode==1 and !data.containsKey('inFaceHkIncrement'))">
                a.inFaceHk=ifnull(a.inFaceHk,0) + #{data.inFaceHkIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('indexCode')) or (colPickMode==1 and !data.containsKey('indexCode'))">
                a.indexCode=#{data.indexCode},
            </if>
            <if test="(colPickMode==0 and data.containsKey('ifaceGroupIndexCode')) or (colPickMode==1 and !data.containsKey('ifaceGroupIndexCode'))">
                a.ifaceGroupIndexCode=#{data.ifaceGroupIndexCode},
            </if>
            <if test="(colPickMode==0 and data.containsKey('createUserId')) or (colPickMode==1 and !data.containsKey('createUserId'))">
                a.createUserId=#{data.createUserId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('createUserIdIncrement')) or (colPickMode==1 and !data.containsKey('createUserIdIncrement'))">
                a.createUserId=ifnull(a.createUserId,0) + #{data.createUserIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
                a.createTime=#{data.createTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('updateUserId')) or (colPickMode==1 and !data.containsKey('updateUserId'))">
                a.updateUserId=#{data.updateUserId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('updateUserIdIncrement')) or (colPickMode==1 and !data.containsKey('updateUserIdIncrement'))">
                a.updateUserId=ifnull(a.updateUserId,0) + #{data.updateUserIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
                a.updateTime=#{data.updateTime},
            </if>
        </trim>
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </update>
    <!-- 批量更新 -->
    <update id="updateBatch" parameterType="paramDto">
        update mortals_xhx_person as a
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="siteId=(case" suffix="ELSE siteId end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('siteId')) or (colPickMode==1 and !item.containsKey('siteId'))">
                            when a.id=#{item.id} then #{item.siteId}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('siteIdIncrement')) or (colPickMode==1 and !item.containsKey('siteIdIncrement'))">
                            when a.id=#{item.id} then ifnull(a.siteId,0) + #{item.siteIdIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="siteName=(case" suffix="ELSE siteName end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('siteName')) or (colPickMode==1 and !item.containsKey('siteName'))">
                        when a.id=#{item.id} then #{item.siteName}
                    </if>
                </foreach>
            </trim>
            <trim prefix="name=(case" suffix="ELSE name end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('name')) or (colPickMode==1 and !item.containsKey('name'))">
                        when a.id=#{item.id} then #{item.name}
                    </if>
                </foreach>
            </trim>
            <trim prefix="idCard=(case" suffix="ELSE idCard end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('idCard')) or (colPickMode==1 and !item.containsKey('idCard'))">
                        when a.id=#{item.id} then #{item.idCard}
                    </if>
                </foreach>
            </trim>
            <trim prefix="gender=(case" suffix="ELSE gender end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('gender')) or (colPickMode==1 and !item.containsKey('gender'))">
                            when a.id=#{item.id} then #{item.gender}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('genderIncrement')) or (colPickMode==1 and !item.containsKey('genderIncrement'))">
                            when a.id=#{item.id} then ifnull(a.gender,0) + #{item.genderIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="phone=(case" suffix="ELSE phone end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('phone')) or (colPickMode==1 and !item.containsKey('phone'))">
                        when a.id=#{item.id} then #{item.phone}
                    </if>
                </foreach>
            </trim>
            <trim prefix="birthday=(case" suffix="ELSE birthday end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('birthday')) or (colPickMode==1 and !item.containsKey('birthday'))">
                        when a.id=#{item.id} then #{item.birthday}
                    </if>
                </foreach>
            </trim>
            <trim prefix="address=(case" suffix="ELSE address end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('address')) or (colPickMode==1 and !item.containsKey('address'))">
                        when a.id=#{item.id} then #{item.address}
                    </if>
                </foreach>
            </trim>
            <trim prefix="photo=(case" suffix="ELSE photo end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('photo')) or (colPickMode==1 and !item.containsKey('photo'))">
                        when a.id=#{item.id} then #{item.photo}
                    </if>
                </foreach>
            </trim>
            <trim prefix="sourcePhotoUri=(case" suffix="ELSE sourcePhotoUri end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('sourcePhotoUri')) or (colPickMode==1 and !item.containsKey('sourcePhotoUri'))">
                        when a.id=#{item.id} then #{item.sourcePhotoUri}
                    </if>
                </foreach>
            </trim>
            <trim prefix="sourceId=(case" suffix="ELSE sourceId end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('sourceId')) or (colPickMode==1 and !item.containsKey('sourceId'))">
                            when a.id=#{item.id} then #{item.sourceId}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('sourceIdIncrement')) or (colPickMode==1 and !item.containsKey('sourceIdIncrement'))">
                            when a.id=#{item.id} then ifnull(a.sourceId,0) + #{item.sourceIdIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="remark=(case" suffix="ELSE remark end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('remark')) or (colPickMode==1 and !item.containsKey('remark'))">
                        when a.id=#{item.id} then #{item.remark}
                    </if>
                </foreach>
            </trim>
            <trim prefix="source=(case" suffix="ELSE source end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('source')) or (colPickMode==1 and !item.containsKey('source'))">
                            when a.id=#{item.id} then #{item.source}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('sourceIncrement')) or (colPickMode==1 and !item.containsKey('sourceIncrement'))">
                            when a.id=#{item.id} then ifnull(a.source,0) + #{item.sourceIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="inFaceHk=(case" suffix="ELSE inFaceHk end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('inFaceHk')) or (colPickMode==1 and !item.containsKey('inFaceHk'))">
                            when a.id=#{item.id} then #{item.inFaceHk}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('inFaceHkIncrement')) or (colPickMode==1 and !item.containsKey('inFaceHkIncrement'))">
                            when a.id=#{item.id} then ifnull(a.inFaceHk,0) + #{item.inFaceHkIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="indexCode=(case" suffix="ELSE indexCode end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('indexCode')) or (colPickMode==1 and !item.containsKey('indexCode'))">
                        when a.id=#{item.id} then #{item.indexCode}
                    </if>
                </foreach>
            </trim>
            <trim prefix="ifaceGroupIndexCode=(case" suffix="ELSE ifaceGroupIndexCode end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('ifaceGroupIndexCode')) or (colPickMode==1 and !item.containsKey('ifaceGroupIndexCode'))">
                        when a.id=#{item.id} then #{item.ifaceGroupIndexCode}
                    </if>
                </foreach>
            </trim>
            <trim prefix="createUserId=(case" suffix="ELSE createUserId end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('createUserId')) or (colPickMode==1 and !item.containsKey('createUserId'))">
                            when a.id=#{item.id} then #{item.createUserId}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('createUserIdIncrement')) or (colPickMode==1 and !item.containsKey('createUserIdIncrement'))">
                            when a.id=#{item.id} then ifnull(a.createUserId,0) + #{item.createUserIdIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="createTime=(case" suffix="ELSE createTime end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('createTime')) or (colPickMode==1 and !item.containsKey('createTime'))">
                        when a.id=#{item.id} then #{item.createTime}
                    </if>
                </foreach>
            </trim>
            <trim prefix="updateUserId=(case" suffix="ELSE updateUserId end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('updateUserId')) or (colPickMode==1 and !item.containsKey('updateUserId'))">
                            when a.id=#{item.id} then #{item.updateUserId}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('updateUserIdIncrement')) or (colPickMode==1 and !item.containsKey('updateUserIdIncrement'))">
                            when a.id=#{item.id} then ifnull(a.updateUserId,0) + #{item.updateUserIdIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="updateTime=(case" suffix="ELSE updateTime end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('updateTime')) or (colPickMode==1 and !item.containsKey('updateTime'))">
                        when a.id=#{item.id} then #{item.updateTime}
                    </if>
                </foreach>
            </trim>
        </trim>
        where id in
        <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
            #{item.id}
        </foreach>
    </update>
    <!-- 根据主健查询 -->
    <select id="getByKey" parameterType="paramDto" resultMap="PersonEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_person as a
        where a.id=#{condition.id}
    </select>
    <!-- 根据主健删除 -->
    <delete id="deleteByKey" parameterType="paramDto">
        delete a.* from mortals_xhx_person as a where a.id=#{condition.id}
    </delete>
    <!-- 根据主健删除一批，针对单一主健有效 -->
    <delete id="deleteByKeys">
        delete from mortals_xhx_person where id in
        <foreach collection="array" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>
    <!-- 根据主健列表删除一批，针对单一主健有效 -->
    <delete id="deleteByKeyList">
        delete from mortals_xhx_person where id in
        <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>

    <!-- 根据对象列表删除一批，针对单一主健有效 -->
    <delete id="deleteByEntityList">
        delete from mortals_xhx_person where id in
        <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
            #{item.id}
        </foreach>
    </delete>
    <!-- 根据paramDto删除一批 -->
    <delete id="deleteByMap" parameterType="paramDto">
        delete a.* from mortals_xhx_person as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </delete>
    <!-- 获取列表 -->
    <select id="getList" parameterType="paramDto" resultMap="PersonEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_person as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
        <include refid="_orderCols_"/>
    </select>



    <!-- 获取 -->
    <select id="getListCount" parameterType="paramDto" resultType="int">
        select count(1)
        from mortals_xhx_person as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </select>
    <!-- 条件映射 -->
    <sql id="_condition_">
        <if test="condition != null and !condition.isEmpty()">
            <!-- 条件映射-普通条件 -->
            <include refid="_condition_param_">
                <property name="_conditionParam_" value="condition"/>
                <property name="_conditionType_" value="and"/>
            </include>
            <!-- 条件映射-集合之间使用AND，集合中元素使用OR-(list[0].1 or list[0].2) and (list[1].3 or list[1].4) -->
            <if test="condition.containsKey('andConditionList') and !condition.andConditionList.isEmpty()">
                and
                <foreach collection="condition.andConditionList" open="(" close=")" index="index" item="andCondition" separator=" and ">
                    <trim prefixOverrides="or" prefix="(" suffix=")">
                        <include refid="_condition_param_">
                            <property name="_conditionParam_" value="andCondition"/>
                            <property name="_conditionType_" value="or"/>
                        </include>
                    </trim>
                </foreach>
            </if>
            <!-- 条件映射-集合之间使用OR，集合中元素使用AND-(list[0].1 and list[0].2) or (list[1].3 and list[1].4) -->
            <if test="condition.containsKey('orConditionList') and !condition.orConditionList.isEmpty()">
                and
                <foreach collection="condition.orConditionList" open="(" close=")" index="index" item="orCondition" separator=" or ">
                    <trim prefixOverrides="and" prefix="(" suffix=")">
                        <include refid="_condition_param_">
                            <property name="_conditionParam_" value="orCondition"/>
                            <property name="_conditionType_" value="and"/>
                        </include>
                    </trim>
                </foreach>
            </if>
        </if>
    </sql>
    <!-- 条件映射-代参数 -->
    <sql id="_condition_param_">
        <bind name="conditionParamRef" value="${_conditionParam_}"/>
        <if test="conditionParamRef.containsKey('id')">
            <if test="conditionParamRef.id != null">
                ${_conditionType_} a.id=#{${_conditionParam_}.id}
            </if>
        </if>
        <if test="conditionParamRef.containsKey('id')">
            <if test="conditionParamRef.id != null ">
                ${_conditionType_} a.id = #{${_conditionParam_}.id}
            </if>
            <if test="conditionParamRef.id == null">
                ${_conditionType_} a.id is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('idList') and conditionParamRef.idList.size() > 0">
            ${_conditionType_} a.id in
            <foreach collection="conditionParamRef.idList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('idNotList') and conditionParamRef.idNotList.size() > 0">
            ${_conditionType_} a.id not in
            <foreach collection="conditionParamRef.idNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('idStart') and conditionParamRef.idStart != null">
            ${_conditionType_} a.id <![CDATA[ >= ]]> #{${_conditionParam_}.idStart}
        </if>
        <if test="conditionParamRef.containsKey('idEnd') and conditionParamRef.idEnd != null">
            ${_conditionType_} a.id <![CDATA[ <= ]]> #{${_conditionParam_}.idEnd}
        </if>

        <if test="conditionParamRef.containsKey('siteId')">
            <if test="conditionParamRef.siteId != null ">
                ${_conditionType_} a.siteId = #{${_conditionParam_}.siteId}
            </if>
            <if test="conditionParamRef.siteId == null">
                ${_conditionType_} a.siteId is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('siteIdList') and conditionParamRef.siteIdList.size() > 0">
            ${_conditionType_} a.siteId in
            <foreach collection="conditionParamRef.siteIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('siteIdNotList') and conditionParamRef.siteIdNotList.size() > 0">
            ${_conditionType_} a.siteId not in
            <foreach collection="conditionParamRef.siteIdNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('siteIdStart') and conditionParamRef.siteIdStart != null">
            ${_conditionType_} a.siteId <![CDATA[ >= ]]> #{${_conditionParam_}.siteIdStart}
        </if>
        <if test="conditionParamRef.containsKey('siteIdEnd') and conditionParamRef.siteIdEnd != null">
            ${_conditionType_} a.siteId <![CDATA[ <= ]]> #{${_conditionParam_}.siteIdEnd}
        </if>


        <if test="conditionParamRef.containsKey('siteName')">
            <if test="conditionParamRef.siteName != null and conditionParamRef.siteName != ''">
                ${_conditionType_} a.siteName like #{${_conditionParam_}.siteName}
            </if>
            <if test="conditionParamRef.siteName == null">
                ${_conditionType_} a.siteName is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('siteNameList') and conditionParamRef.siteNameList.size() > 0">
            ${_conditionType_} a.siteName in
            <foreach collection="conditionParamRef.siteNameList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('siteNameNotList') and conditionParamRef.siteNameNotList.size() > 0">
            ${_conditionType_} a.siteName not in
            <foreach collection="conditionParamRef.siteNameNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>

        <if test="conditionParamRef.containsKey('name')">
            <if test="conditionParamRef.name != null and conditionParamRef.name != ''">
                ${_conditionType_} a.name like #{${_conditionParam_}.name}
            </if>
            <if test="conditionParamRef.name == null">
                ${_conditionType_} a.name is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('nameList') and conditionParamRef.nameList.size() > 0">
            ${_conditionType_} a.name in
            <foreach collection="conditionParamRef.nameList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('nameNotList') and conditionParamRef.nameNotList.size() > 0">
            ${_conditionType_} a.name not in
            <foreach collection="conditionParamRef.nameNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>

        <if test="conditionParamRef.containsKey('idCard')">
            <if test="conditionParamRef.idCard != null and conditionParamRef.idCard != ''">
                ${_conditionType_} a.idCard like #{${_conditionParam_}.idCard}
            </if>
            <if test="conditionParamRef.idCard == null">
                ${_conditionType_} a.idCard is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('idCardList') and conditionParamRef.idCardList.size() > 0">
            ${_conditionType_} a.idCard in
            <foreach collection="conditionParamRef.idCardList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('idCardNotList') and conditionParamRef.idCardNotList.size() > 0">
            ${_conditionType_} a.idCard not in
            <foreach collection="conditionParamRef.idCardNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('gender')">
            <if test="conditionParamRef.gender != null ">
                ${_conditionType_} a.gender = #{${_conditionParam_}.gender}
            </if>
            <if test="conditionParamRef.gender == null">
                ${_conditionType_} a.gender is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('genderList') and conditionParamRef.genderList.size() > 0">
            ${_conditionType_} a.gender in
            <foreach collection="conditionParamRef.genderList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('genderNotList') and conditionParamRef.genderNotList.size() > 0">
            ${_conditionType_} a.gender not in
            <foreach collection="conditionParamRef.genderNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('genderStart') and conditionParamRef.genderStart != null">
            ${_conditionType_} a.gender <![CDATA[ >= ]]> #{${_conditionParam_}.genderStart}
        </if>
        <if test="conditionParamRef.containsKey('genderEnd') and conditionParamRef.genderEnd != null">
            ${_conditionType_} a.gender <![CDATA[ <= ]]> #{${_conditionParam_}.genderEnd}
        </if>


        <if test="conditionParamRef.containsKey('phone')">
            <if test="conditionParamRef.phone != null and conditionParamRef.phone != ''">
                ${_conditionType_} a.phone like #{${_conditionParam_}.phone}
            </if>
            <if test="conditionParamRef.phone == null">
                ${_conditionType_} a.phone is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('phoneList') and conditionParamRef.phoneList.size() > 0">
            ${_conditionType_} a.phone in
            <foreach collection="conditionParamRef.phoneList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('phoneNotList') and conditionParamRef.phoneNotList.size() > 0">
            ${_conditionType_} a.phone not in
            <foreach collection="conditionParamRef.phoneNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>

        <if test="conditionParamRef.containsKey('birthday')">
            <if test="conditionParamRef.birthday != null ">
                ${_conditionType_} a.birthday = #{${_conditionParam_}.birthday}
            </if>
            <if test="conditionParamRef.birthday == null">
                ${_conditionType_} a.birthday is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('birthdayStart') and conditionParamRef.birthdayStart != null and conditionParamRef.birthdayStart!=''">
            ${_conditionType_} a.birthday <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.birthdayStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('birthdayEnd') and conditionParamRef.birthdayEnd != null and conditionParamRef.birthdayEnd!=''">
            ${_conditionType_} a.birthday <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.birthdayEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
        </if>

        <if test="conditionParamRef.containsKey('address')">
            <if test="conditionParamRef.address != null and conditionParamRef.address != ''">
                ${_conditionType_} a.address like #{${_conditionParam_}.address}
            </if>
            <if test="conditionParamRef.address == null">
                ${_conditionType_} a.address is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('addressList') and conditionParamRef.addressList.size() > 0">
            ${_conditionType_} a.address in
            <foreach collection="conditionParamRef.addressList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('addressNotList') and conditionParamRef.addressNotList.size() > 0">
            ${_conditionType_} a.address not in
            <foreach collection="conditionParamRef.addressNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>

        <if test="conditionParamRef.containsKey('photo')">
            <if test="conditionParamRef.photo != null and conditionParamRef.photo != ''">
                ${_conditionType_} a.photo like #{${_conditionParam_}.photo}
            </if>
            <if test="conditionParamRef.photo == null">
                ${_conditionType_} a.photo is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('photoList') and conditionParamRef.photoList.size() > 0">
            ${_conditionType_} a.photo in
            <foreach collection="conditionParamRef.photoList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('photoNotList') and conditionParamRef.photoNotList.size() > 0">
            ${_conditionType_} a.photo not in
            <foreach collection="conditionParamRef.photoNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>

        <if test="conditionParamRef.containsKey('sourcePhotoUri')">
            <if test="conditionParamRef.sourcePhotoUri != null and conditionParamRef.sourcePhotoUri != ''">
                ${_conditionType_} a.sourcePhotoUri like #{${_conditionParam_}.sourcePhotoUri}
            </if>
            <if test="conditionParamRef.sourcePhotoUri == null">
                ${_conditionType_} a.sourcePhotoUri is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('sourcePhotoUriList') and conditionParamRef.sourcePhotoUriList.size() > 0">
            ${_conditionType_} a.sourcePhotoUri in
            <foreach collection="conditionParamRef.sourcePhotoUriList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('sourcePhotoUriNotList') and conditionParamRef.sourcePhotoUriNotList.size() > 0">
            ${_conditionType_} a.sourcePhotoUri not in
            <foreach collection="conditionParamRef.sourcePhotoUriNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('sourceId')">
            <if test="conditionParamRef.sourceId != null ">
                ${_conditionType_} a.sourceId = #{${_conditionParam_}.sourceId}
            </if>
            <if test="conditionParamRef.sourceId == null">
                ${_conditionType_} a.sourceId is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('sourceIdList') and conditionParamRef.sourceIdList.size() > 0">
            ${_conditionType_} a.sourceId in
            <foreach collection="conditionParamRef.sourceIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('sourceIdNotList') and conditionParamRef.sourceIdNotList.size() > 0">
            ${_conditionType_} a.sourceId not in
            <foreach collection="conditionParamRef.sourceIdNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('sourceIdStart') and conditionParamRef.sourceIdStart != null">
            ${_conditionType_} a.sourceId <![CDATA[ >= ]]> #{${_conditionParam_}.sourceIdStart}
        </if>
        <if test="conditionParamRef.containsKey('sourceIdEnd') and conditionParamRef.sourceIdEnd != null">
            ${_conditionType_} a.sourceId <![CDATA[ <= ]]> #{${_conditionParam_}.sourceIdEnd}
        </if>


        <if test="conditionParamRef.containsKey('remark')">
            <if test="conditionParamRef.remark != null and conditionParamRef.remark != ''">
                ${_conditionType_} a.remark like #{${_conditionParam_}.remark}
            </if>
            <if test="conditionParamRef.remark == null">
                ${_conditionType_} a.remark is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('remarkList') and conditionParamRef.remarkList.size() > 0">
            ${_conditionType_} a.remark in
            <foreach collection="conditionParamRef.remarkList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('remarkNotList') and conditionParamRef.remarkNotList.size() > 0">
            ${_conditionType_} a.remark not in
            <foreach collection="conditionParamRef.remarkNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('source')">
            <if test="conditionParamRef.source != null ">
                ${_conditionType_} a.source = #{${_conditionParam_}.source}
            </if>
            <if test="conditionParamRef.source == null">
                ${_conditionType_} a.source is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('sourceList') and conditionParamRef.sourceList.size() > 0">
            ${_conditionType_} a.source in
            <foreach collection="conditionParamRef.sourceList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('sourceNotList') and conditionParamRef.sourceNotList.size() > 0">
            ${_conditionType_} a.source not in
            <foreach collection="conditionParamRef.sourceNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('sourceStart') and conditionParamRef.sourceStart != null">
            ${_conditionType_} a.source <![CDATA[ >= ]]> #{${_conditionParam_}.sourceStart}
        </if>
        <if test="conditionParamRef.containsKey('sourceEnd') and conditionParamRef.sourceEnd != null">
            ${_conditionType_} a.source <![CDATA[ <= ]]> #{${_conditionParam_}.sourceEnd}
        </if>

        <if test="conditionParamRef.containsKey('inFaceHk')">
            <if test="conditionParamRef.inFaceHk != null ">
                ${_conditionType_} a.inFaceHk = #{${_conditionParam_}.inFaceHk}
            </if>
            <if test="conditionParamRef.inFaceHk == null">
                ${_conditionType_} a.inFaceHk is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('inFaceHkList') and conditionParamRef.inFaceHkList.size() > 0">
            ${_conditionType_} a.inFaceHk in
            <foreach collection="conditionParamRef.inFaceHkList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('inFaceHkNotList') and conditionParamRef.inFaceHkNotList.size() > 0">
            ${_conditionType_} a.inFaceHk not in
            <foreach collection="conditionParamRef.inFaceHkNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('inFaceHkStart') and conditionParamRef.inFaceHkStart != null">
            ${_conditionType_} a.inFaceHk <![CDATA[ >= ]]> #{${_conditionParam_}.inFaceHkStart}
        </if>
        <if test="conditionParamRef.containsKey('inFaceHkEnd') and conditionParamRef.inFaceHkEnd != null">
            ${_conditionType_} a.inFaceHk <![CDATA[ <= ]]> #{${_conditionParam_}.inFaceHkEnd}
        </if>


        <if test="conditionParamRef.containsKey('indexCode')">
            <if test="conditionParamRef.indexCode != null and conditionParamRef.indexCode != ''">
                ${_conditionType_} a.indexCode like #{${_conditionParam_}.indexCode}
            </if>
            <if test="conditionParamRef.indexCode == null">
                ${_conditionType_} a.indexCode is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('indexCodeList') and conditionParamRef.indexCodeList.size() > 0">
            ${_conditionType_} a.indexCode in
            <foreach collection="conditionParamRef.indexCodeList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('indexCodeNotList') and conditionParamRef.indexCodeNotList.size() > 0">
            ${_conditionType_} a.indexCode not in
            <foreach collection="conditionParamRef.indexCodeNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>

        <if test="conditionParamRef.containsKey('ifaceGroupIndexCode')">
            <if test="conditionParamRef.ifaceGroupIndexCode != null and conditionParamRef.ifaceGroupIndexCode != ''">
                ${_conditionType_} a.ifaceGroupIndexCode like #{${_conditionParam_}.ifaceGroupIndexCode}
            </if>
            <if test="conditionParamRef.ifaceGroupIndexCode == null">
                ${_conditionType_} a.ifaceGroupIndexCode is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('ifaceGroupIndexCodeList') and conditionParamRef.ifaceGroupIndexCodeList.size() > 0">
            ${_conditionType_} a.ifaceGroupIndexCode in
            <foreach collection="conditionParamRef.ifaceGroupIndexCodeList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('ifaceGroupIndexCodeNotList') and conditionParamRef.ifaceGroupIndexCodeNotList.size() > 0">
            ${_conditionType_} a.ifaceGroupIndexCode not in
            <foreach collection="conditionParamRef.ifaceGroupIndexCodeNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('createUserId')">
            <if test="conditionParamRef.createUserId != null ">
                ${_conditionType_} a.createUserId = #{${_conditionParam_}.createUserId}
            </if>
            <if test="conditionParamRef.createUserId == null">
                ${_conditionType_} a.createUserId is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('createUserIdList') and conditionParamRef.createUserIdList.size() > 0">
            ${_conditionType_} a.createUserId in
            <foreach collection="conditionParamRef.createUserIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('createUserIdNotList') and conditionParamRef.createUserIdNotList.size() > 0">
            ${_conditionType_} a.createUserId not in
            <foreach collection="conditionParamRef.createUserIdNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('createUserIdStart') and conditionParamRef.createUserIdStart != null">
            ${_conditionType_} a.createUserId <![CDATA[ >= ]]> #{${_conditionParam_}.createUserIdStart}
        </if>
        <if test="conditionParamRef.containsKey('createUserIdEnd') and conditionParamRef.createUserIdEnd != null">
            ${_conditionType_} a.createUserId <![CDATA[ <= ]]> #{${_conditionParam_}.createUserIdEnd}
        </if>


        <if test="conditionParamRef.containsKey('createTime')">
            <if test="conditionParamRef.createTime != null ">
                ${_conditionType_} a.createTime = #{${_conditionParam_}.createTime}
            </if>
            <if test="conditionParamRef.createTime == null">
                ${_conditionType_} a.createTime is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('createTimeStart') and conditionParamRef.createTimeStart != null and conditionParamRef.createTimeStart!=''">
            ${_conditionType_} a.createTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('createTimeEnd') and conditionParamRef.createTimeEnd != null and conditionParamRef.createTimeEnd!=''">
            ${_conditionType_} a.createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('updateUserId')">
            <if test="conditionParamRef.updateUserId != null ">
                ${_conditionType_} a.updateUserId = #{${_conditionParam_}.updateUserId}
            </if>
            <if test="conditionParamRef.updateUserId == null">
                ${_conditionType_} a.updateUserId is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('updateUserIdList') and conditionParamRef.updateUserIdList.size() > 0">
            ${_conditionType_} a.updateUserId in
            <foreach collection="conditionParamRef.updateUserIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('updateUserIdNotList') and conditionParamRef.updateUserIdNotList.size() > 0">
            ${_conditionType_} a.updateUserId not in
            <foreach collection="conditionParamRef.updateUserIdNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('updateUserIdStart') and conditionParamRef.updateUserIdStart != null">
            ${_conditionType_} a.updateUserId <![CDATA[ >= ]]> #{${_conditionParam_}.updateUserIdStart}
        </if>
        <if test="conditionParamRef.containsKey('updateUserIdEnd') and conditionParamRef.updateUserIdEnd != null">
            ${_conditionType_} a.updateUserId <![CDATA[ <= ]]> #{${_conditionParam_}.updateUserIdEnd}
        </if>


        <if test="conditionParamRef.containsKey('updateTime')">
            <if test="conditionParamRef.updateTime != null ">
                ${_conditionType_} a.updateTime = #{${_conditionParam_}.updateTime}
            </if>
            <if test="conditionParamRef.updateTime == null">
                ${_conditionType_} a.updateTime is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('updateTimeStart') and conditionParamRef.updateTimeStart != null and conditionParamRef.updateTimeStart!=''">
            ${_conditionType_} a.updateTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
            ${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
        </if>
    </sql>
    <sql id="_orderCols_">
        <if test="orderColList != null and !orderColList.isEmpty()">
            order by
            <trim suffixOverrides=","  suffix="">
                <foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
                    ${item.colName} ${item.sortKind}
                </foreach>
            </trim>
        </if>
        <if test="(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()">
            order by
            <trim suffixOverrides=","  suffix="">
                <if test="orderCol.containsKey('id')">
                    a.id
                    <if test='orderCol.id != null and "DESC".equalsIgnoreCase(orderCol.id)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('siteId')">
                    a.siteId
                    <if test='orderCol.siteId != null and "DESC".equalsIgnoreCase(orderCol.siteId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('siteName')">
                    a.siteName
                    <if test='orderCol.siteName != null and "DESC".equalsIgnoreCase(orderCol.siteName)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('name')">
                    a.name
                    <if test='orderCol.name != null and "DESC".equalsIgnoreCase(orderCol.name)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('idCard')">
                    a.idCard
                    <if test='orderCol.idCard != null and "DESC".equalsIgnoreCase(orderCol.idCard)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('gender')">
                    a.gender
                    <if test='orderCol.gender != null and "DESC".equalsIgnoreCase(orderCol.gender)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('phone')">
                    a.phone
                    <if test='orderCol.phone != null and "DESC".equalsIgnoreCase(orderCol.phone)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('birthday')">
                    a.birthday
                    <if test='orderCol.birthday != null and "DESC".equalsIgnoreCase(orderCol.birthday)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('address')">
                    a.address
                    <if test='orderCol.address != null and "DESC".equalsIgnoreCase(orderCol.address)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('photo')">
                    a.photo
                    <if test='orderCol.photo != null and "DESC".equalsIgnoreCase(orderCol.photo)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('sourcePhotoUri')">
                    a.sourcePhotoUri
                    <if test='orderCol.sourcePhotoUri != null and "DESC".equalsIgnoreCase(orderCol.sourcePhotoUri)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('sourceId')">
                    a.sourceId
                    <if test='orderCol.sourceId != null and "DESC".equalsIgnoreCase(orderCol.sourceId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('remark')">
                    a.remark
                    <if test='orderCol.remark != null and "DESC".equalsIgnoreCase(orderCol.remark)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('source')">
                    a.source
                    <if test='orderCol.source != null and "DESC".equalsIgnoreCase(orderCol.source)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('inFaceHk')">
                    a.inFaceHk
                    <if test='orderCol.inFaceHk != null and "DESC".equalsIgnoreCase(orderCol.inFaceHk)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('indexCode')">
                    a.indexCode
                    <if test='orderCol.indexCode != null and "DESC".equalsIgnoreCase(orderCol.indexCode)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('ifaceGroupIndexCode')">
                    a.ifaceGroupIndexCode
                    <if test='orderCol.ifaceGroupIndexCode != null and "DESC".equalsIgnoreCase(orderCol.ifaceGroupIndexCode)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('createUserId')">
                    a.createUserId
                    <if test='orderCol.createUserId != null and "DESC".equalsIgnoreCase(orderCol.createUserId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('createTime')">
                    a.createTime
                    <if test='orderCol.createTime != null and "DESC".equalsIgnoreCase(orderCol.createTime)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('updateUserId')">
                    a.updateUserId
                    <if test='orderCol.updateUserId != null and "DESC".equalsIgnoreCase(orderCol.updateUserId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('updateTime')">
                    a.updateTime
                    <if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
                    ,
                </if>
            </trim>
        </if>
    </sql>
    <sql id="_group_by_">
        <if test="groupList != null and !groupList.isEmpty()">
            GROUP BY
            <trim suffixOverrides=","  suffix="">
                <foreach collection="groupList" open="" close="" index="index" item="item" separator=",">
                    ${item}
                </foreach>
            </trim>
        </if>
    </sql>
</mapper>