<?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.base.system.gentable.dao.ibatis.GentableColumnDaoImpl">

    <!-- 字段和属性映射 -->
    <resultMap type="GentableColumnEntity" id="GentableColumnEntity-Map">
        <id  property="id" column="id" />
        <result property="tableId" column="tableId" />
        <result property="columnName" column="columnName" />
        <result property="columnComment" column="columnComment" />
        <result property="columnType" column="columnType" />
        <result property="javaType" column="javaType" />
        <result property="javaField" column="javaField" />
        <result property="isPrimaryKey" column="isPrimaryKey" />
        <result property="isIncrement" column="isIncrement" />
        <result property="isRequired" column="isRequired" />
        <result property="isInsert" column="isInsert" />
        <result property="isEdit" column="isEdit" />
        <result property="isList" column="isList" />
        <result property="isQuery" column="isQuery" />
        <result property="isExport" column="isExport" />
        <result property="isSerialize" column="isSerialize" />
        <result property="htmlType" column="htmlType" />
        <result property="queryType" column="queryType" />
        <result property="defaultValue" column="defaultValue" />
        <result property="sort" column="sort" />
        <result property="updateTime" column="updateTime" />
        <result property="updateUser" column="updateUser" />
        <result property="createTime" column="createTime" />
        <result property="createUser" column="createUser" />

    </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 as id,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('tableId') or colPickMode == 1 and data.containsKey('tableId')))">
                a.tableId as tableId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('columnName') or colPickMode == 1 and data.containsKey('columnName')))">
                a.columnName as columnName,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('columnComment') or colPickMode == 1 and data.containsKey('columnComment')))">
                a.columnComment as columnComment,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('columnType') or colPickMode == 1 and data.containsKey('columnType')))">
                a.columnType as columnType,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('javaType') or colPickMode == 1 and data.containsKey('javaType')))">
                a.javaType as javaType,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('javaField') or colPickMode == 1 and data.containsKey('javaField')))">
                a.javaField as javaField,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('isPrimaryKey') or colPickMode == 1 and data.containsKey('isPrimaryKey')))">
                a.isPrimaryKey as isPrimaryKey,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('isIncrement') or colPickMode == 1 and data.containsKey('isIncrement')))">
                a.isIncrement as isIncrement,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('isRequired') or colPickMode == 1 and data.containsKey('isRequired')))">
                a.isRequired as isRequired,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('isInsert') or colPickMode == 1 and data.containsKey('isInsert')))">
                a.isInsert as isInsert,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('isEdit') or colPickMode == 1 and data.containsKey('isEdit')))">
                a.isEdit as isEdit,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('isList') or colPickMode == 1 and data.containsKey('isList')))">
                a.isList as isList,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('isQuery') or colPickMode == 1 and data.containsKey('isQuery')))">
                a.isQuery as isQuery,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('isExport') or colPickMode == 1 and data.containsKey('isExport')))">
                a.isExport as isExport,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('isSerialize') or colPickMode == 1 and data.containsKey('isSerialize')))">
                a.isSerialize as isSerialize,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('htmlType') or colPickMode == 1 and data.containsKey('htmlType')))">
                a.htmlType as htmlType,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('queryType') or colPickMode == 1 and data.containsKey('queryType')))">
                a.queryType as queryType,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('defaultValue') or colPickMode == 1 and data.containsKey('defaultValue')))">
                a.defaultValue as defaultValue,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('sort') or colPickMode == 1 and data.containsKey('sort')))">
                a.sort as sort,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
                a.updateTime as updateTime,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateUser') or colPickMode == 1 and data.containsKey('updateUser')))">
                a.updateUser as updateUser,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
                a.createTime as createTime,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUser') or colPickMode == 1 and data.containsKey('createUser')))">
                a.createUser as createUser,
            </if>
        </trim>
    </sql>
    <!-- 新增 区分主键自增加还是业务插入 -->
    <insert id="insert" parameterType="GentableColumnEntity"  useGeneratedKeys="true" keyProperty="id">
        insert into mortals_xhx_gentable_column
        (tableId,columnName,columnComment,columnType,javaType,javaField,isPrimaryKey,isIncrement,isRequired,isInsert,isEdit,isList,isQuery,isExport,isSerialize,htmlType,queryType,defaultValue,sort,updateTime,updateUser,createTime,createUser)
        VALUES
        (#{tableId},#{columnName},#{columnComment},#{columnType},#{javaType},#{javaField},#{isPrimaryKey},#{isIncrement},#{isRequired},#{isInsert},#{isEdit},#{isList},#{isQuery},#{isExport},#{isSerialize},#{htmlType},#{queryType},#{defaultValue},#{sort},#{updateTime},#{updateUser},#{createTime},#{createUser})
    </insert>

    <!-- 批量新增 -->
    <insert id="insertBatch" parameterType="paramDto">
        insert into mortals_xhx_gentable_column
        (tableId,columnName,columnComment,columnType,javaType,javaField,isPrimaryKey,isIncrement,isRequired,isInsert,isEdit,isList,isQuery,isExport,isSerialize,htmlType,queryType,defaultValue,sort,updateTime,updateUser,createTime,createUser)
        VALUES
        <foreach collection="data.dataList" item="item" index="index" separator="," >
            (#{item.tableId},#{item.columnName},#{item.columnComment},#{item.columnType},#{item.javaType},#{item.javaField},#{item.isPrimaryKey},#{item.isIncrement},#{item.isRequired},#{item.isInsert},#{item.isEdit},#{item.isList},#{item.isQuery},#{item.isExport},#{item.isSerialize},#{item.htmlType},#{item.queryType},#{item.defaultValue},#{item.sort},#{item.updateTime},#{item.updateUser},#{item.createTime},#{item.createUser})
        </foreach>
    </insert>


    <!-- 根据ParamDto更新 -->
    <update id="update" parameterType="paramDto">
        update mortals_xhx_gentable_column as a
        set
        <trim suffixOverrides="," suffix="">
            <if test="(colPickMode==0 and data.containsKey('tableId')) or (colPickMode==1 and !data.containsKey('tableId'))">
                a.tableId=#{data.tableId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('tableIdIncrement')) or (colPickMode==1 and !data.containsKey('tableIdIncrement'))">
                a.tableId=ifnull(a.tableId,0) + #{data.tableIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('columnName')) or (colPickMode==1 and !data.containsKey('columnName'))">
                a.columnName=#{data.columnName},
            </if>
            <if test="(colPickMode==0 and data.containsKey('columnComment')) or (colPickMode==1 and !data.containsKey('columnComment'))">
                a.columnComment=#{data.columnComment},
            </if>
            <if test="(colPickMode==0 and data.containsKey('columnType')) or (colPickMode==1 and !data.containsKey('columnType'))">
                a.columnType=#{data.columnType},
            </if>
            <if test="(colPickMode==0 and data.containsKey('javaType')) or (colPickMode==1 and !data.containsKey('javaType'))">
                a.javaType=#{data.javaType},
            </if>
            <if test="(colPickMode==0 and data.containsKey('javaField')) or (colPickMode==1 and !data.containsKey('javaField'))">
                a.javaField=#{data.javaField},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isPrimaryKey')) or (colPickMode==1 and !data.containsKey('isPrimaryKey'))">
                a.isPrimaryKey=#{data.isPrimaryKey},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isPrimaryKeyIncrement')) or (colPickMode==1 and !data.containsKey('isPrimaryKeyIncrement'))">
                a.isPrimaryKey=ifnull(a.isPrimaryKey,0) + #{data.isPrimaryKeyIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isIncrement')) or (colPickMode==1 and !data.containsKey('isIncrement'))">
                a.isIncrement=#{data.isIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isIncrementIncrement')) or (colPickMode==1 and !data.containsKey('isIncrementIncrement'))">
                a.isIncrement=ifnull(a.isIncrement,0) + #{data.isIncrementIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isRequired')) or (colPickMode==1 and !data.containsKey('isRequired'))">
                a.isRequired=#{data.isRequired},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isRequiredIncrement')) or (colPickMode==1 and !data.containsKey('isRequiredIncrement'))">
                a.isRequired=ifnull(a.isRequired,0) + #{data.isRequiredIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isInsert')) or (colPickMode==1 and !data.containsKey('isInsert'))">
                a.isInsert=#{data.isInsert},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isInsertIncrement')) or (colPickMode==1 and !data.containsKey('isInsertIncrement'))">
                a.isInsert=ifnull(a.isInsert,0) + #{data.isInsertIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isEdit')) or (colPickMode==1 and !data.containsKey('isEdit'))">
                a.isEdit=#{data.isEdit},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isEditIncrement')) or (colPickMode==1 and !data.containsKey('isEditIncrement'))">
                a.isEdit=ifnull(a.isEdit,0) + #{data.isEditIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isList')) or (colPickMode==1 and !data.containsKey('isList'))">
                a.isList=#{data.isList},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isListIncrement')) or (colPickMode==1 and !data.containsKey('isListIncrement'))">
                a.isList=ifnull(a.isList,0) + #{data.isListIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isQuery')) or (colPickMode==1 and !data.containsKey('isQuery'))">
                a.isQuery=#{data.isQuery},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isQueryIncrement')) or (colPickMode==1 and !data.containsKey('isQueryIncrement'))">
                a.isQuery=ifnull(a.isQuery,0) + #{data.isQueryIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isExport')) or (colPickMode==1 and !data.containsKey('isExport'))">
                a.isExport=#{data.isExport},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isExportIncrement')) or (colPickMode==1 and !data.containsKey('isExportIncrement'))">
                a.isExport=ifnull(a.isExport,0) + #{data.isExportIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isSerialize')) or (colPickMode==1 and !data.containsKey('isSerialize'))">
                a.isSerialize=#{data.isSerialize},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isSerializeIncrement')) or (colPickMode==1 and !data.containsKey('isSerializeIncrement'))">
                a.isSerialize=ifnull(a.isSerialize,0) + #{data.isSerializeIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('htmlType')) or (colPickMode==1 and !data.containsKey('htmlType'))">
                a.htmlType=#{data.htmlType},
            </if>
            <if test="(colPickMode==0 and data.containsKey('htmlTypeIncrement')) or (colPickMode==1 and !data.containsKey('htmlTypeIncrement'))">
                a.htmlType=ifnull(a.htmlType,0) + #{data.htmlTypeIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('queryType')) or (colPickMode==1 and !data.containsKey('queryType'))">
                a.queryType=#{data.queryType},
            </if>
            <if test="(colPickMode==0 and data.containsKey('defaultValue')) or (colPickMode==1 and !data.containsKey('defaultValue'))">
                a.defaultValue=#{data.defaultValue},
            </if>
            <if test="(colPickMode==0 and data.containsKey('sort')) or (colPickMode==1 and !data.containsKey('sort'))">
                a.sort=#{data.sort},
            </if>
            <if test="(colPickMode==0 and data.containsKey('sortIncrement')) or (colPickMode==1 and !data.containsKey('sortIncrement'))">
                a.sort=ifnull(a.sort,0) + #{data.sortIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
                a.updateTime=#{data.updateTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('updateUser')) or (colPickMode==1 and !data.containsKey('updateUser'))">
                a.updateUser=#{data.updateUser},
            </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('createUser')) or (colPickMode==1 and !data.containsKey('createUser'))">
                a.createUser=#{data.createUser},
            </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_gentable_column as a
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="tableId=(case" suffix="ELSE tableId end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('tableId')) or (colPickMode==1 and !item.containsKey('tableId'))">
                            when a.id=#{item.id} then #{item.tableId}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('tableIdIncrement')) or (colPickMode==1 and !item.containsKey('tableIdIncrement'))">
                            when a.id=#{item.id} then ifnull(a.tableId,0) + #{item.tableIdIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="columnName=(case" suffix="ELSE columnName end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('columnName')) or (colPickMode==1 and !item.containsKey('columnName'))">
                        when a.id=#{item.id} then #{item.columnName}
                    </if>
                </foreach>
            </trim>
            <trim prefix="columnComment=(case" suffix="ELSE columnComment end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('columnComment')) or (colPickMode==1 and !item.containsKey('columnComment'))">
                        when a.id=#{item.id} then #{item.columnComment}
                    </if>
                </foreach>
            </trim>
            <trim prefix="columnType=(case" suffix="ELSE columnType end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('columnType')) or (colPickMode==1 and !item.containsKey('columnType'))">
                        when a.id=#{item.id} then #{item.columnType}
                    </if>
                </foreach>
            </trim>
            <trim prefix="javaType=(case" suffix="ELSE javaType end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('javaType')) or (colPickMode==1 and !item.containsKey('javaType'))">
                        when a.id=#{item.id} then #{item.javaType}
                    </if>
                </foreach>
            </trim>
            <trim prefix="javaField=(case" suffix="ELSE javaField end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('javaField')) or (colPickMode==1 and !item.containsKey('javaField'))">
                        when a.id=#{item.id} then #{item.javaField}
                    </if>
                </foreach>
            </trim>
            <trim prefix="isPrimaryKey=(case" suffix="ELSE isPrimaryKey end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('isPrimaryKey')) or (colPickMode==1 and !item.containsKey('isPrimaryKey'))">
                            when a.id=#{item.id} then #{item.isPrimaryKey}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('isPrimaryKeyIncrement')) or (colPickMode==1 and !item.containsKey('isPrimaryKeyIncrement'))">
                            when a.id=#{item.id} then ifnull(a.isPrimaryKey,0) + #{item.isPrimaryKeyIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="isIncrement=(case" suffix="ELSE isIncrement end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('isIncrement')) or (colPickMode==1 and !item.containsKey('isIncrement'))">
                            when a.id=#{item.id} then #{item.isIncrement}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('isIncrementIncrement')) or (colPickMode==1 and !item.containsKey('isIncrementIncrement'))">
                            when a.id=#{item.id} then ifnull(a.isIncrement,0) + #{item.isIncrementIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="isRequired=(case" suffix="ELSE isRequired end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('isRequired')) or (colPickMode==1 and !item.containsKey('isRequired'))">
                            when a.id=#{item.id} then #{item.isRequired}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('isRequiredIncrement')) or (colPickMode==1 and !item.containsKey('isRequiredIncrement'))">
                            when a.id=#{item.id} then ifnull(a.isRequired,0) + #{item.isRequiredIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="isInsert=(case" suffix="ELSE isInsert end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('isInsert')) or (colPickMode==1 and !item.containsKey('isInsert'))">
                            when a.id=#{item.id} then #{item.isInsert}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('isInsertIncrement')) or (colPickMode==1 and !item.containsKey('isInsertIncrement'))">
                            when a.id=#{item.id} then ifnull(a.isInsert,0) + #{item.isInsertIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="isEdit=(case" suffix="ELSE isEdit end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('isEdit')) or (colPickMode==1 and !item.containsKey('isEdit'))">
                            when a.id=#{item.id} then #{item.isEdit}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('isEditIncrement')) or (colPickMode==1 and !item.containsKey('isEditIncrement'))">
                            when a.id=#{item.id} then ifnull(a.isEdit,0) + #{item.isEditIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="isList=(case" suffix="ELSE isList end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('isList')) or (colPickMode==1 and !item.containsKey('isList'))">
                            when a.id=#{item.id} then #{item.isList}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('isListIncrement')) or (colPickMode==1 and !item.containsKey('isListIncrement'))">
                            when a.id=#{item.id} then ifnull(a.isList,0) + #{item.isListIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="isQuery=(case" suffix="ELSE isQuery end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('isQuery')) or (colPickMode==1 and !item.containsKey('isQuery'))">
                            when a.id=#{item.id} then #{item.isQuery}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('isQueryIncrement')) or (colPickMode==1 and !item.containsKey('isQueryIncrement'))">
                            when a.id=#{item.id} then ifnull(a.isQuery,0) + #{item.isQueryIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="isExport=(case" suffix="ELSE isExport end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('isExport')) or (colPickMode==1 and !item.containsKey('isExport'))">
                            when a.id=#{item.id} then #{item.isExport}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('isExportIncrement')) or (colPickMode==1 and !item.containsKey('isExportIncrement'))">
                            when a.id=#{item.id} then ifnull(a.isExport,0) + #{item.isExportIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="isSerialize=(case" suffix="ELSE isSerialize end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('isSerialize')) or (colPickMode==1 and !item.containsKey('isSerialize'))">
                            when a.id=#{item.id} then #{item.isSerialize}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('isSerializeIncrement')) or (colPickMode==1 and !item.containsKey('isSerializeIncrement'))">
                            when a.id=#{item.id} then ifnull(a.isSerialize,0) + #{item.isSerializeIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="htmlType=(case" suffix="ELSE htmlType end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('htmlType')) or (colPickMode==1 and !item.containsKey('htmlType'))">
                            when a.id=#{item.id} then #{item.htmlType}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('htmlTypeIncrement')) or (colPickMode==1 and !item.containsKey('htmlTypeIncrement'))">
                            when a.id=#{item.id} then ifnull(a.htmlType,0) + #{item.htmlTypeIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="queryType=(case" suffix="ELSE queryType end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('queryType')) or (colPickMode==1 and !item.containsKey('queryType'))">
                        when a.id=#{item.id} then #{item.queryType}
                    </if>
                </foreach>
            </trim>
            <trim prefix="defaultValue=(case" suffix="ELSE defaultValue end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('defaultValue')) or (colPickMode==1 and !item.containsKey('defaultValue'))">
                        when a.id=#{item.id} then #{item.defaultValue}
                    </if>
                </foreach>
            </trim>
            <trim prefix="sort=(case" suffix="ELSE sort end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('sort')) or (colPickMode==1 and !item.containsKey('sort'))">
                            when a.id=#{item.id} then #{item.sort}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('sortIncrement')) or (colPickMode==1 and !item.containsKey('sortIncrement'))">
                            when a.id=#{item.id} then ifnull(a.sort,0) + #{item.sortIncrement}
                        </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 prefix="updateUser=(case" suffix="ELSE updateUser end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('updateUser')) or (colPickMode==1 and !item.containsKey('updateUser'))">
                        when a.id=#{item.id} then #{item.updateUser}
                    </if>
                </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="createUser=(case" suffix="ELSE createUser end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('createUser')) or (colPickMode==1 and !item.containsKey('createUser'))">
                        when a.id=#{item.id} then #{item.createUser}
                    </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="GentableColumnEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_gentable_column as a
        where a.id=#{condition.id}
    </select>
    <!-- 根据主健删除 -->
    <delete id="deleteByKey" parameterType="paramDto">
        delete a.* from mortals_xhx_gentable_column as a where a.id=#{condition.id}
    </delete>
    <!-- 根据主健删除一批，针对单一主健有效 -->
    <delete id="deleteByKeys">
        delete from mortals_xhx_gentable_column where id in
        <foreach collection="array" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>
    <!-- 根据paramDto删除一批 -->
    <delete id="deleteByMap" parameterType="paramDto">
        delete a.* from mortals_xhx_gentable_column as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </delete>
    <!-- 获取列表 -->
    <select id="getList" parameterType="paramDto" resultMap="GentableColumnEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_gentable_column 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_gentable_column 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')">
            ${_conditionType_} a.id in
            <foreach collection="conditionParamRef.idList" 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('tableId')">
            <if test="conditionParamRef.tableId != null ">
                ${_conditionType_} a.tableId = #{${_conditionParam_}.tableId}
            </if>
            <if test="conditionParamRef.tableId == null">
                ${_conditionType_} a.tableId is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('tableIdList')">
            ${_conditionType_} a.tableId in
            <foreach collection="conditionParamRef.tableIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('tableIdStart') and conditionParamRef.tableIdStart != null">
            ${_conditionType_} a.tableId <![CDATA[ >= ]]> #{${_conditionParam_}.tableIdStart}
        </if>
        <if test="conditionParamRef.containsKey('tableIdEnd') and conditionParamRef.tableIdEnd != null">
            ${_conditionType_} a.tableId <![CDATA[ <= ]]> #{${_conditionParam_}.tableIdEnd}
        </if>


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

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

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

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

        <if test="conditionParamRef.containsKey('javaField')">
            <if test="conditionParamRef.javaField != null and conditionParamRef.javaField != ''">
                ${_conditionType_} a.javaField like #{${_conditionParam_}.javaField}
            </if>
            <if test="conditionParamRef.javaField == null">
                ${_conditionType_} a.javaField is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('javaFieldList')">
            ${_conditionType_} a.javaField in
            <foreach collection="conditionParamRef.javaFieldList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('isPrimaryKey')">
            <if test="conditionParamRef.isPrimaryKey != null ">
                ${_conditionType_} a.isPrimaryKey = #{${_conditionParam_}.isPrimaryKey}
            </if>
            <if test="conditionParamRef.isPrimaryKey == null">
                ${_conditionType_} a.isPrimaryKey is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('isPrimaryKeyList')">
            ${_conditionType_} a.isPrimaryKey in
            <foreach collection="conditionParamRef.isPrimaryKeyList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('isPrimaryKeyStart') and conditionParamRef.isPrimaryKeyStart != null">
            ${_conditionType_} a.isPrimaryKey <![CDATA[ >= ]]> #{${_conditionParam_}.isPrimaryKeyStart}
        </if>
        <if test="conditionParamRef.containsKey('isPrimaryKeyEnd') and conditionParamRef.isPrimaryKeyEnd != null">
            ${_conditionType_} a.isPrimaryKey <![CDATA[ <= ]]> #{${_conditionParam_}.isPrimaryKeyEnd}
        </if>

        <if test="conditionParamRef.containsKey('isIncrement')">
            <if test="conditionParamRef.isIncrement != null ">
                ${_conditionType_} a.isIncrement = #{${_conditionParam_}.isIncrement}
            </if>
            <if test="conditionParamRef.isIncrement == null">
                ${_conditionType_} a.isIncrement is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('isIncrementList')">
            ${_conditionType_} a.isIncrement in
            <foreach collection="conditionParamRef.isIncrementList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('isIncrementStart') and conditionParamRef.isIncrementStart != null">
            ${_conditionType_} a.isIncrement <![CDATA[ >= ]]> #{${_conditionParam_}.isIncrementStart}
        </if>
        <if test="conditionParamRef.containsKey('isIncrementEnd') and conditionParamRef.isIncrementEnd != null">
            ${_conditionType_} a.isIncrement <![CDATA[ <= ]]> #{${_conditionParam_}.isIncrementEnd}
        </if>

        <if test="conditionParamRef.containsKey('isRequired')">
            <if test="conditionParamRef.isRequired != null ">
                ${_conditionType_} a.isRequired = #{${_conditionParam_}.isRequired}
            </if>
            <if test="conditionParamRef.isRequired == null">
                ${_conditionType_} a.isRequired is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('isRequiredList')">
            ${_conditionType_} a.isRequired in
            <foreach collection="conditionParamRef.isRequiredList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('isRequiredStart') and conditionParamRef.isRequiredStart != null">
            ${_conditionType_} a.isRequired <![CDATA[ >= ]]> #{${_conditionParam_}.isRequiredStart}
        </if>
        <if test="conditionParamRef.containsKey('isRequiredEnd') and conditionParamRef.isRequiredEnd != null">
            ${_conditionType_} a.isRequired <![CDATA[ <= ]]> #{${_conditionParam_}.isRequiredEnd}
        </if>

        <if test="conditionParamRef.containsKey('isInsert')">
            <if test="conditionParamRef.isInsert != null ">
                ${_conditionType_} a.isInsert = #{${_conditionParam_}.isInsert}
            </if>
            <if test="conditionParamRef.isInsert == null">
                ${_conditionType_} a.isInsert is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('isInsertList')">
            ${_conditionType_} a.isInsert in
            <foreach collection="conditionParamRef.isInsertList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('isInsertStart') and conditionParamRef.isInsertStart != null">
            ${_conditionType_} a.isInsert <![CDATA[ >= ]]> #{${_conditionParam_}.isInsertStart}
        </if>
        <if test="conditionParamRef.containsKey('isInsertEnd') and conditionParamRef.isInsertEnd != null">
            ${_conditionType_} a.isInsert <![CDATA[ <= ]]> #{${_conditionParam_}.isInsertEnd}
        </if>

        <if test="conditionParamRef.containsKey('isEdit')">
            <if test="conditionParamRef.isEdit != null ">
                ${_conditionType_} a.isEdit = #{${_conditionParam_}.isEdit}
            </if>
            <if test="conditionParamRef.isEdit == null">
                ${_conditionType_} a.isEdit is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('isEditList')">
            ${_conditionType_} a.isEdit in
            <foreach collection="conditionParamRef.isEditList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('isEditStart') and conditionParamRef.isEditStart != null">
            ${_conditionType_} a.isEdit <![CDATA[ >= ]]> #{${_conditionParam_}.isEditStart}
        </if>
        <if test="conditionParamRef.containsKey('isEditEnd') and conditionParamRef.isEditEnd != null">
            ${_conditionType_} a.isEdit <![CDATA[ <= ]]> #{${_conditionParam_}.isEditEnd}
        </if>

        <if test="conditionParamRef.containsKey('isList')">
            <if test="conditionParamRef.isList != null ">
                ${_conditionType_} a.isList = #{${_conditionParam_}.isList}
            </if>
            <if test="conditionParamRef.isList == null">
                ${_conditionType_} a.isList is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('isListList')">
            ${_conditionType_} a.isList in
            <foreach collection="conditionParamRef.isListList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('isListStart') and conditionParamRef.isListStart != null">
            ${_conditionType_} a.isList <![CDATA[ >= ]]> #{${_conditionParam_}.isListStart}
        </if>
        <if test="conditionParamRef.containsKey('isListEnd') and conditionParamRef.isListEnd != null">
            ${_conditionType_} a.isList <![CDATA[ <= ]]> #{${_conditionParam_}.isListEnd}
        </if>

        <if test="conditionParamRef.containsKey('isQuery')">
            <if test="conditionParamRef.isQuery != null ">
                ${_conditionType_} a.isQuery = #{${_conditionParam_}.isQuery}
            </if>
            <if test="conditionParamRef.isQuery == null">
                ${_conditionType_} a.isQuery is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('isQueryList')">
            ${_conditionType_} a.isQuery in
            <foreach collection="conditionParamRef.isQueryList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('isQueryStart') and conditionParamRef.isQueryStart != null">
            ${_conditionType_} a.isQuery <![CDATA[ >= ]]> #{${_conditionParam_}.isQueryStart}
        </if>
        <if test="conditionParamRef.containsKey('isQueryEnd') and conditionParamRef.isQueryEnd != null">
            ${_conditionType_} a.isQuery <![CDATA[ <= ]]> #{${_conditionParam_}.isQueryEnd}
        </if>

        <if test="conditionParamRef.containsKey('isExport')">
            <if test="conditionParamRef.isExport != null ">
                ${_conditionType_} a.isExport = #{${_conditionParam_}.isExport}
            </if>
            <if test="conditionParamRef.isExport == null">
                ${_conditionType_} a.isExport is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('isExportList')">
            ${_conditionType_} a.isExport in
            <foreach collection="conditionParamRef.isExportList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('isExportStart') and conditionParamRef.isExportStart != null">
            ${_conditionType_} a.isExport <![CDATA[ >= ]]> #{${_conditionParam_}.isExportStart}
        </if>
        <if test="conditionParamRef.containsKey('isExportEnd') and conditionParamRef.isExportEnd != null">
            ${_conditionType_} a.isExport <![CDATA[ <= ]]> #{${_conditionParam_}.isExportEnd}
        </if>

        <if test="conditionParamRef.containsKey('isSerialize')">
            <if test="conditionParamRef.isSerialize != null ">
                ${_conditionType_} a.isSerialize = #{${_conditionParam_}.isSerialize}
            </if>
            <if test="conditionParamRef.isSerialize == null">
                ${_conditionType_} a.isSerialize is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('isSerializeList')">
            ${_conditionType_} a.isSerialize in
            <foreach collection="conditionParamRef.isSerializeList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('isSerializeStart') and conditionParamRef.isSerializeStart != null">
            ${_conditionType_} a.isSerialize <![CDATA[ >= ]]> #{${_conditionParam_}.isSerializeStart}
        </if>
        <if test="conditionParamRef.containsKey('isSerializeEnd') and conditionParamRef.isSerializeEnd != null">
            ${_conditionType_} a.isSerialize <![CDATA[ <= ]]> #{${_conditionParam_}.isSerializeEnd}
        </if>

        <if test="conditionParamRef.containsKey('htmlType')">
            <if test="conditionParamRef.htmlType != null ">
                ${_conditionType_} a.htmlType = #{${_conditionParam_}.htmlType}
            </if>
            <if test="conditionParamRef.htmlType == null">
                ${_conditionType_} a.htmlType is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('htmlTypeList')">
            ${_conditionType_} a.htmlType in
            <foreach collection="conditionParamRef.htmlTypeList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('htmlTypeStart') and conditionParamRef.htmlTypeStart != null">
            ${_conditionType_} a.htmlType <![CDATA[ >= ]]> #{${_conditionParam_}.htmlTypeStart}
        </if>
        <if test="conditionParamRef.containsKey('htmlTypeEnd') and conditionParamRef.htmlTypeEnd != null">
            ${_conditionType_} a.htmlType <![CDATA[ <= ]]> #{${_conditionParam_}.htmlTypeEnd}
        </if>


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

        <if test="conditionParamRef.containsKey('defaultValue')">
            <if test="conditionParamRef.defaultValue != null and conditionParamRef.defaultValue != ''">
                ${_conditionType_} a.defaultValue like #{${_conditionParam_}.defaultValue}
            </if>
            <if test="conditionParamRef.defaultValue == null">
                ${_conditionType_} a.defaultValue is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('defaultValueList')">
            ${_conditionType_} a.defaultValue in
            <foreach collection="conditionParamRef.defaultValueList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('sort')">
            <if test="conditionParamRef.sort != null ">
                ${_conditionType_} a.sort = #{${_conditionParam_}.sort}
            </if>
            <if test="conditionParamRef.sort == null">
                ${_conditionType_} a.sort is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('sortList')">
            ${_conditionType_} a.sort in
            <foreach collection="conditionParamRef.sortList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('sortStart') and conditionParamRef.sortStart != null">
            ${_conditionType_} a.sort <![CDATA[ >= ]]> #{${_conditionParam_}.sortStart}
        </if>
        <if test="conditionParamRef.containsKey('sortEnd') and conditionParamRef.sortEnd != null">
            ${_conditionType_} a.sort <![CDATA[ <= ]]> #{${_conditionParam_}.sortEnd}
        </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>

        <if test="conditionParamRef.containsKey('updateUser')">
            <if test="conditionParamRef.updateUser != null and conditionParamRef.updateUser != ''">
                ${_conditionType_} a.updateUser like #{${_conditionParam_}.updateUser}
            </if>
            <if test="conditionParamRef.updateUser == null">
                ${_conditionType_} a.updateUser is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('updateUserList')">
            ${_conditionType_} a.updateUser in
            <foreach collection="conditionParamRef.updateUserList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </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('createUser')">
            <if test="conditionParamRef.createUser != null and conditionParamRef.createUser != ''">
                ${_conditionType_} a.createUser like #{${_conditionParam_}.createUser}
            </if>
            <if test="conditionParamRef.createUser == null">
                ${_conditionType_} a.createUser is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('createUserList')">
            ${_conditionType_} a.createUser in
            <foreach collection="conditionParamRef.createUserList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </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('tableId')">
                    a.tableId
                    <if test='orderCol.tableId != null and "DESC".equalsIgnoreCase(orderCol.tableId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('columnName')">
                    a.columnName
                    <if test='orderCol.columnName != null and "DESC".equalsIgnoreCase(orderCol.columnName)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('columnComment')">
                    a.columnComment
                    <if test='orderCol.columnComment != null and "DESC".equalsIgnoreCase(orderCol.columnComment)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('columnType')">
                    a.columnType
                    <if test='orderCol.columnType != null and "DESC".equalsIgnoreCase(orderCol.columnType)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('javaType')">
                    a.javaType
                    <if test='orderCol.javaType != null and "DESC".equalsIgnoreCase(orderCol.javaType)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('javaField')">
                    a.javaField
                    <if test='orderCol.javaField != null and "DESC".equalsIgnoreCase(orderCol.javaField)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('isPrimaryKey')">
                    a.isPrimaryKey
                    <if test='orderCol.isPrimaryKey != null and "DESC".equalsIgnoreCase(orderCol.isPrimaryKey)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('isIncrement')">
                    a.isIncrement
                    <if test='orderCol.isIncrement != null and "DESC".equalsIgnoreCase(orderCol.isIncrement)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('isRequired')">
                    a.isRequired
                    <if test='orderCol.isRequired != null and "DESC".equalsIgnoreCase(orderCol.isRequired)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('isInsert')">
                    a.isInsert
                    <if test='orderCol.isInsert != null and "DESC".equalsIgnoreCase(orderCol.isInsert)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('isEdit')">
                    a.isEdit
                    <if test='orderCol.isEdit != null and "DESC".equalsIgnoreCase(orderCol.isEdit)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('isList')">
                    a.isList
                    <if test='orderCol.isList != null and "DESC".equalsIgnoreCase(orderCol.isList)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('isQuery')">
                    a.isQuery
                    <if test='orderCol.isQuery != null and "DESC".equalsIgnoreCase(orderCol.isQuery)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('isExport')">
                    a.isExport
                    <if test='orderCol.isExport != null and "DESC".equalsIgnoreCase(orderCol.isExport)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('isSerialize')">
                    a.isSerialize
                    <if test='orderCol.isSerialize != null and "DESC".equalsIgnoreCase(orderCol.isSerialize)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('htmlType')">
                    a.htmlType
                    <if test='orderCol.htmlType != null and "DESC".equalsIgnoreCase(orderCol.htmlType)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('queryType')">
                    a.queryType
                    <if test='orderCol.queryType != null and "DESC".equalsIgnoreCase(orderCol.queryType)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('defaultValue')">
                    a.defaultValue
                    <if test='orderCol.defaultValue != null and "DESC".equalsIgnoreCase(orderCol.defaultValue)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('sort')">
                    a.sort
                    <if test='orderCol.sort != null and "DESC".equalsIgnoreCase(orderCol.sort)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('updateTime')">
                    a.updateTime
                    <if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('updateUser')">
                    a.updateUser
                    <if test='orderCol.updateUser != null and "DESC".equalsIgnoreCase(orderCol.updateUser)'>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('createUser')">
                    a.createUser
                    <if test='orderCol.createUser != null and "DESC".equalsIgnoreCase(orderCol.createUser)'>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>