<?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.basic.dao.ibatis.BasicSetDaoImpl">

    <!-- 字段和属性映射 -->
    <resultMap type="BasicSetEntity" id="BasicSetEntity-Map">
            <id  property="id" column="id" />
            <result property="showPhoto" column="showPhoto" />
            <result property="showName" column="showName" />
            <result property="showPost" column="showPost" />
            <result property="showWork" column="showWork" />
            <result property="showPhone" column="showPhone" />
            <result property="showElect" column="showElect" />
            <result property="showElectDesc" column="showElectDesc" />
            <result property="showMeet" column="showMeet" />
            <result property="showMeetDesc" column="showMeetDesc" />
            <result property="remark" column="remark" />
            <result property="createUserId" column="createUserId" />
            <result property="createTime" column="createTime" />
            <result property="updateUserId" column="updateUserId" />
            <result property="updateTime" column="updateTime" />
            <collection property="basicStatusList" column="id" ofType="BasicStatusEntity" javaType="ArrayList" select="getBasicStatusByBasicSetId"></collection>
    </resultMap>
    <resultMap type="BasicStatusEntity" id="BasicStatusEntity-Map">
            <result property="id" column="id" />
            <result property="basicSetId" column="basicSetId" />
            <result property="statusName" column="statusName" />
            <result property="statusColor" column="statusColor" />
            <result property="remark" column="remark" />
            <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('showPhoto') or colPickMode == 1 and data.containsKey('showPhoto')))">
                    a.showPhoto,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('showName') or colPickMode == 1 and data.containsKey('showName')))">
                    a.showName,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('showPost') or colPickMode == 1 and data.containsKey('showPost')))">
                    a.showPost,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('showWork') or colPickMode == 1 and data.containsKey('showWork')))">
                    a.showWork,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('showPhone') or colPickMode == 1 and data.containsKey('showPhone')))">
                    a.showPhone,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('showElect') or colPickMode == 1 and data.containsKey('showElect')))">
                    a.showElect,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('showElectDesc') or colPickMode == 1 and data.containsKey('showElectDesc')))">
                    a.showElectDesc,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('showMeet') or colPickMode == 1 and data.containsKey('showMeet')))">
                    a.showMeet,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('showMeetDesc') or colPickMode == 1 and data.containsKey('showMeetDesc')))">
                    a.showMeetDesc,
                </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('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>
    <!-- 子表所有列 -->
    <sql id="_columns_sub">
        <trim suffixOverrides="," suffix="">
            b.id,b.basicSetId,b.statusName,b.statusColor,b.remark,b.createUserId,b.createTime,b.updateUserId,b.updateTime,
        </trim>
    </sql>
    <!-- 新增 区分主键自增加还是业务插入 -->
    <insert id="insert" parameterType="BasicSetEntity"  useGeneratedKeys="true" keyProperty="id">
        insert into mortals_xhx_basic_set
        (showPhoto,showName,showPost,showWork,showPhone,showElect,showElectDesc,showMeet,showMeetDesc,remark,createUserId,createTime,updateUserId,updateTime)
        VALUES
        (#{showPhoto},#{showName},#{showPost},#{showWork},#{showPhone},#{showElect},#{showElectDesc},#{showMeet},#{showMeetDesc},#{remark},#{createUserId},#{createTime},#{updateUserId},#{updateTime})
    </insert>

    <!-- 批量新增 -->
    <insert id="insertBatch" parameterType="paramDto">
        insert into mortals_xhx_basic_set
        (showPhoto,showName,showPost,showWork,showPhone,showElect,showElectDesc,showMeet,showMeetDesc,remark,createUserId,createTime,updateUserId,updateTime)
        VALUES
        <foreach collection="data.dataList" item="item" index="index" separator="," >
            (#{item.showPhoto},#{item.showName},#{item.showPost},#{item.showWork},#{item.showPhone},#{item.showElect},#{item.showElectDesc},#{item.showMeet},#{item.showMeetDesc},#{item.remark},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime})
        </foreach>
    </insert>


    <!-- 根据ParamDto更新 -->
    <update id="update" parameterType="paramDto">
        update mortals_xhx_basic_set as a
        set
        <trim suffixOverrides="," suffix="">
            <if test="(colPickMode==0 and data.containsKey('showPhoto')) or (colPickMode==1 and !data.containsKey('showPhoto'))">
                a.showPhoto=#{data.showPhoto},
            </if>
            <if test="(colPickMode==0 and data.containsKey('showPhotoIncrement')) or (colPickMode==1 and !data.containsKey('showPhotoIncrement'))">
                a.showPhoto=ifnull(a.showPhoto,0) + #{data.showPhotoIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('showName')) or (colPickMode==1 and !data.containsKey('showName'))">
                a.showName=#{data.showName},
            </if>
            <if test="(colPickMode==0 and data.containsKey('showNameIncrement')) or (colPickMode==1 and !data.containsKey('showNameIncrement'))">
                a.showName=ifnull(a.showName,0) + #{data.showNameIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('showPost')) or (colPickMode==1 and !data.containsKey('showPost'))">
                a.showPost=#{data.showPost},
            </if>
            <if test="(colPickMode==0 and data.containsKey('showPostIncrement')) or (colPickMode==1 and !data.containsKey('showPostIncrement'))">
                a.showPost=ifnull(a.showPost,0) + #{data.showPostIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('showWork')) or (colPickMode==1 and !data.containsKey('showWork'))">
                a.showWork=#{data.showWork},
            </if>
            <if test="(colPickMode==0 and data.containsKey('showWorkIncrement')) or (colPickMode==1 and !data.containsKey('showWorkIncrement'))">
                a.showWork=ifnull(a.showWork,0) + #{data.showWorkIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('showPhone')) or (colPickMode==1 and !data.containsKey('showPhone'))">
                a.showPhone=#{data.showPhone},
            </if>
            <if test="(colPickMode==0 and data.containsKey('showPhoneIncrement')) or (colPickMode==1 and !data.containsKey('showPhoneIncrement'))">
                a.showPhone=ifnull(a.showPhone,0) + #{data.showPhoneIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('showElect')) or (colPickMode==1 and !data.containsKey('showElect'))">
                a.showElect=#{data.showElect},
            </if>
            <if test="(colPickMode==0 and data.containsKey('showElectIncrement')) or (colPickMode==1 and !data.containsKey('showElectIncrement'))">
                a.showElect=ifnull(a.showElect,0) + #{data.showElectIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('showElectDesc')) or (colPickMode==1 and !data.containsKey('showElectDesc'))">
                a.showElectDesc=#{data.showElectDesc},
            </if>
            <if test="(colPickMode==0 and data.containsKey('showMeet')) or (colPickMode==1 and !data.containsKey('showMeet'))">
                a.showMeet=#{data.showMeet},
            </if>
            <if test="(colPickMode==0 and data.containsKey('showMeetIncrement')) or (colPickMode==1 and !data.containsKey('showMeetIncrement'))">
                a.showMeet=ifnull(a.showMeet,0) + #{data.showMeetIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('showMeetDesc')) or (colPickMode==1 and !data.containsKey('showMeetDesc'))">
                a.showMeetDesc=#{data.showMeetDesc},
            </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('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_basic_set as a
        <trim prefix="set" suffixOverrides=",">
                        <trim prefix="showPhoto=(case" suffix="ELSE showPhoto end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('showPhoto')) or (colPickMode==1 and !item.containsKey('showPhoto'))">
                                        when a.id=#{item.id} then #{item.showPhoto}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('showPhotoIncrement')) or (colPickMode==1 and !item.containsKey('showPhotoIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.showPhoto,0) + #{item.showPhotoIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                        <trim prefix="showName=(case" suffix="ELSE showName end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('showName')) or (colPickMode==1 and !item.containsKey('showName'))">
                                        when a.id=#{item.id} then #{item.showName}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('showNameIncrement')) or (colPickMode==1 and !item.containsKey('showNameIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.showName,0) + #{item.showNameIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                        <trim prefix="showPost=(case" suffix="ELSE showPost end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('showPost')) or (colPickMode==1 and !item.containsKey('showPost'))">
                                        when a.id=#{item.id} then #{item.showPost}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('showPostIncrement')) or (colPickMode==1 and !item.containsKey('showPostIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.showPost,0) + #{item.showPostIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                        <trim prefix="showWork=(case" suffix="ELSE showWork end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('showWork')) or (colPickMode==1 and !item.containsKey('showWork'))">
                                        when a.id=#{item.id} then #{item.showWork}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('showWorkIncrement')) or (colPickMode==1 and !item.containsKey('showWorkIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.showWork,0) + #{item.showWorkIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                        <trim prefix="showPhone=(case" suffix="ELSE showPhone end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('showPhone')) or (colPickMode==1 and !item.containsKey('showPhone'))">
                                        when a.id=#{item.id} then #{item.showPhone}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('showPhoneIncrement')) or (colPickMode==1 and !item.containsKey('showPhoneIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.showPhone,0) + #{item.showPhoneIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                        <trim prefix="showElect=(case" suffix="ELSE showElect end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('showElect')) or (colPickMode==1 and !item.containsKey('showElect'))">
                                        when a.id=#{item.id} then #{item.showElect}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('showElectIncrement')) or (colPickMode==1 and !item.containsKey('showElectIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.showElect,0) + #{item.showElectIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                <trim prefix="showElectDesc=(case" suffix="ELSE showElectDesc end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('showElectDesc')) or (colPickMode==1 and !item.containsKey('showElectDesc'))">
                            when a.id=#{item.id} then #{item.showElectDesc}
                        </if>
                    </foreach>
                </trim>
                        <trim prefix="showMeet=(case" suffix="ELSE showMeet end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('showMeet')) or (colPickMode==1 and !item.containsKey('showMeet'))">
                                        when a.id=#{item.id} then #{item.showMeet}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('showMeetIncrement')) or (colPickMode==1 and !item.containsKey('showMeetIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.showMeet,0) + #{item.showMeetIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                <trim prefix="showMeetDesc=(case" suffix="ELSE showMeetDesc end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('showMeetDesc')) or (colPickMode==1 and !item.containsKey('showMeetDesc'))">
                            when a.id=#{item.id} then #{item.showMeetDesc}
                        </if>
                    </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="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="BasicSetEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_basic_set as a
        where a.id=#{condition.id}
    </select>
    <!-- 根据主健删除 -->
    <delete id="deleteByKey" parameterType="paramDto">
        delete a.* from mortals_xhx_basic_set as a where a.id=#{condition.id}
    </delete>
    <!-- 根据主健删除一批，针对单一主健有效 -->
    <delete id="deleteByKeys">
        delete from mortals_xhx_basic_set where id in
        <foreach collection="array" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>
    <!-- 根据主健列表删除一批，针对单一主健有效 -->
    <delete id="deleteByKeyList">
        delete from mortals_xhx_basic_set where id in
        <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>

    <!-- 根据对象列表删除一批，针对单一主健有效 -->
    <delete id="deleteByEntityList">
        delete from mortals_xhx_basic_set 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_basic_set as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </delete>
    <!-- 获取列表 -->
    <select id="getList" parameterType="paramDto" resultMap="BasicSetEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_basic_set as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
        <include refid="_orderCols_"/>
    </select>
    <!-- 获取子列表 -->
    <select id="getBasicStatusByBasicSetId" parameterType="java.lang.Long" resultMap="BasicStatusEntity-Map">
        select <include refid="_columns_sub"/>
        from mortals_xhx_basic_status as b
        <trim suffixOverrides="where" suffix="">
            where b.basicSetId = #{id}
        </trim>
    </select>



    <!-- 获取 -->
    <select id="getListCount" parameterType="paramDto" resultType="int">
        select count(1)
        from mortals_xhx_basic_set 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('showPhoto')">
                <if test="conditionParamRef.showPhoto != null ">
                    ${_conditionType_} a.showPhoto = #{${_conditionParam_}.showPhoto}
                </if>
                <if test="conditionParamRef.showPhoto == null">
                    ${_conditionType_} a.showPhoto is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('showPhotoList') and conditionParamRef.showPhotoList.size() > 0">
                ${_conditionType_} a.showPhoto in
                <foreach collection="conditionParamRef.showPhotoList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showPhotoNotList') and conditionParamRef.showPhotoNotList.size() > 0">
                ${_conditionType_} a.showPhoto not in
                <foreach collection="conditionParamRef.showPhotoNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showPhotoStart') and conditionParamRef.showPhotoStart != null">
                ${_conditionType_} a.showPhoto <![CDATA[ >= ]]> #{${_conditionParam_}.showPhotoStart}
            </if>
            <if test="conditionParamRef.containsKey('showPhotoEnd') and conditionParamRef.showPhotoEnd != null">
                ${_conditionType_} a.showPhoto <![CDATA[ <= ]]> #{${_conditionParam_}.showPhotoEnd}
            </if>

            <if test="conditionParamRef.containsKey('showName')">
                <if test="conditionParamRef.showName != null ">
                    ${_conditionType_} a.showName = #{${_conditionParam_}.showName}
                </if>
                <if test="conditionParamRef.showName == null">
                    ${_conditionType_} a.showName is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('showNameList') and conditionParamRef.showNameList.size() > 0">
                ${_conditionType_} a.showName in
                <foreach collection="conditionParamRef.showNameList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showNameNotList') and conditionParamRef.showNameNotList.size() > 0">
                ${_conditionType_} a.showName not in
                <foreach collection="conditionParamRef.showNameNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showNameStart') and conditionParamRef.showNameStart != null">
                ${_conditionType_} a.showName <![CDATA[ >= ]]> #{${_conditionParam_}.showNameStart}
            </if>
            <if test="conditionParamRef.containsKey('showNameEnd') and conditionParamRef.showNameEnd != null">
                ${_conditionType_} a.showName <![CDATA[ <= ]]> #{${_conditionParam_}.showNameEnd}
            </if>

            <if test="conditionParamRef.containsKey('showPost')">
                <if test="conditionParamRef.showPost != null ">
                    ${_conditionType_} a.showPost = #{${_conditionParam_}.showPost}
                </if>
                <if test="conditionParamRef.showPost == null">
                    ${_conditionType_} a.showPost is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('showPostList') and conditionParamRef.showPostList.size() > 0">
                ${_conditionType_} a.showPost in
                <foreach collection="conditionParamRef.showPostList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showPostNotList') and conditionParamRef.showPostNotList.size() > 0">
                ${_conditionType_} a.showPost not in
                <foreach collection="conditionParamRef.showPostNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showPostStart') and conditionParamRef.showPostStart != null">
                ${_conditionType_} a.showPost <![CDATA[ >= ]]> #{${_conditionParam_}.showPostStart}
            </if>
            <if test="conditionParamRef.containsKey('showPostEnd') and conditionParamRef.showPostEnd != null">
                ${_conditionType_} a.showPost <![CDATA[ <= ]]> #{${_conditionParam_}.showPostEnd}
            </if>

            <if test="conditionParamRef.containsKey('showWork')">
                <if test="conditionParamRef.showWork != null ">
                    ${_conditionType_} a.showWork = #{${_conditionParam_}.showWork}
                </if>
                <if test="conditionParamRef.showWork == null">
                    ${_conditionType_} a.showWork is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('showWorkList') and conditionParamRef.showWorkList.size() > 0">
                ${_conditionType_} a.showWork in
                <foreach collection="conditionParamRef.showWorkList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showWorkNotList') and conditionParamRef.showWorkNotList.size() > 0">
                ${_conditionType_} a.showWork not in
                <foreach collection="conditionParamRef.showWorkNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showWorkStart') and conditionParamRef.showWorkStart != null">
                ${_conditionType_} a.showWork <![CDATA[ >= ]]> #{${_conditionParam_}.showWorkStart}
            </if>
            <if test="conditionParamRef.containsKey('showWorkEnd') and conditionParamRef.showWorkEnd != null">
                ${_conditionType_} a.showWork <![CDATA[ <= ]]> #{${_conditionParam_}.showWorkEnd}
            </if>

            <if test="conditionParamRef.containsKey('showPhone')">
                <if test="conditionParamRef.showPhone != null ">
                    ${_conditionType_} a.showPhone = #{${_conditionParam_}.showPhone}
                </if>
                <if test="conditionParamRef.showPhone == null">
                    ${_conditionType_} a.showPhone is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('showPhoneList') and conditionParamRef.showPhoneList.size() > 0">
                ${_conditionType_} a.showPhone in
                <foreach collection="conditionParamRef.showPhoneList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showPhoneNotList') and conditionParamRef.showPhoneNotList.size() > 0">
                ${_conditionType_} a.showPhone not in
                <foreach collection="conditionParamRef.showPhoneNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showPhoneStart') and conditionParamRef.showPhoneStart != null">
                ${_conditionType_} a.showPhone <![CDATA[ >= ]]> #{${_conditionParam_}.showPhoneStart}
            </if>
            <if test="conditionParamRef.containsKey('showPhoneEnd') and conditionParamRef.showPhoneEnd != null">
                ${_conditionType_} a.showPhone <![CDATA[ <= ]]> #{${_conditionParam_}.showPhoneEnd}
            </if>

            <if test="conditionParamRef.containsKey('showElect')">
                <if test="conditionParamRef.showElect != null ">
                    ${_conditionType_} a.showElect = #{${_conditionParam_}.showElect}
                </if>
                <if test="conditionParamRef.showElect == null">
                    ${_conditionType_} a.showElect is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('showElectList') and conditionParamRef.showElectList.size() > 0">
                ${_conditionType_} a.showElect in
                <foreach collection="conditionParamRef.showElectList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showElectNotList') and conditionParamRef.showElectNotList.size() > 0">
                ${_conditionType_} a.showElect not in
                <foreach collection="conditionParamRef.showElectNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showElectStart') and conditionParamRef.showElectStart != null">
                ${_conditionType_} a.showElect <![CDATA[ >= ]]> #{${_conditionParam_}.showElectStart}
            </if>
            <if test="conditionParamRef.containsKey('showElectEnd') and conditionParamRef.showElectEnd != null">
                ${_conditionType_} a.showElect <![CDATA[ <= ]]> #{${_conditionParam_}.showElectEnd}
            </if>


            <if test="conditionParamRef.containsKey('showElectDesc')">
                <if test="conditionParamRef.showElectDesc != null and conditionParamRef.showElectDesc != ''">
                    ${_conditionType_} a.showElectDesc like #{${_conditionParam_}.showElectDesc}
                </if>
                <if test="conditionParamRef.showElectDesc == null">
                    ${_conditionType_} a.showElectDesc is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('showElectDescList') and conditionParamRef.showElectDescList.size() > 0">
                ${_conditionType_} a.showElectDesc in
                <foreach collection="conditionParamRef.showElectDescList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showElectDescNotList') and conditionParamRef.showElectDescNotList.size() > 0">
                ${_conditionType_} a.showElectDesc not in
                <foreach collection="conditionParamRef.showElectDescNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showMeet')">
                <if test="conditionParamRef.showMeet != null ">
                    ${_conditionType_} a.showMeet = #{${_conditionParam_}.showMeet}
                </if>
                <if test="conditionParamRef.showMeet == null">
                    ${_conditionType_} a.showMeet is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('showMeetList') and conditionParamRef.showMeetList.size() > 0">
                ${_conditionType_} a.showMeet in
                <foreach collection="conditionParamRef.showMeetList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showMeetNotList') and conditionParamRef.showMeetNotList.size() > 0">
                ${_conditionType_} a.showMeet not in
                <foreach collection="conditionParamRef.showMeetNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showMeetStart') and conditionParamRef.showMeetStart != null">
                ${_conditionType_} a.showMeet <![CDATA[ >= ]]> #{${_conditionParam_}.showMeetStart}
            </if>
            <if test="conditionParamRef.containsKey('showMeetEnd') and conditionParamRef.showMeetEnd != null">
                ${_conditionType_} a.showMeet <![CDATA[ <= ]]> #{${_conditionParam_}.showMeetEnd}
            </if>


            <if test="conditionParamRef.containsKey('showMeetDesc')">
                <if test="conditionParamRef.showMeetDesc != null and conditionParamRef.showMeetDesc != ''">
                    ${_conditionType_} a.showMeetDesc like #{${_conditionParam_}.showMeetDesc}
                </if>
                <if test="conditionParamRef.showMeetDesc == null">
                    ${_conditionType_} a.showMeetDesc is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('showMeetDescList') and conditionParamRef.showMeetDescList.size() > 0">
                ${_conditionType_} a.showMeetDesc in
                <foreach collection="conditionParamRef.showMeetDescList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('showMeetDescNotList') and conditionParamRef.showMeetDescNotList.size() > 0">
                ${_conditionType_} a.showMeetDesc not in
                <foreach collection="conditionParamRef.showMeetDescNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </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('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('showPhoto')">
                        a.showPhoto
                        <if test='orderCol.showPhoto != null and "DESC".equalsIgnoreCase(orderCol.showPhoto)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('showName')">
                        a.showName
                        <if test='orderCol.showName != null and "DESC".equalsIgnoreCase(orderCol.showName)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('showPost')">
                        a.showPost
                        <if test='orderCol.showPost != null and "DESC".equalsIgnoreCase(orderCol.showPost)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('showWork')">
                        a.showWork
                        <if test='orderCol.showWork != null and "DESC".equalsIgnoreCase(orderCol.showWork)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('showPhone')">
                        a.showPhone
                        <if test='orderCol.showPhone != null and "DESC".equalsIgnoreCase(orderCol.showPhone)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('showElect')">
                        a.showElect
                        <if test='orderCol.showElect != null and "DESC".equalsIgnoreCase(orderCol.showElect)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('showElectDesc')">
                        a.showElectDesc
                        <if test='orderCol.showElectDesc != null and "DESC".equalsIgnoreCase(orderCol.showElectDesc)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('showMeet')">
                        a.showMeet
                        <if test='orderCol.showMeet != null and "DESC".equalsIgnoreCase(orderCol.showMeet)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('showMeetDesc')">
                        a.showMeetDesc
                        <if test='orderCol.showMeetDesc != null and "DESC".equalsIgnoreCase(orderCol.showMeetDesc)'>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('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>