<?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.matter.dao.ibatis.MatterDatumDaoImpl">

    <!-- 字段和属性映射 -->
    <resultMap type="MatterDatumEntity" id="MatterDatumEntity-Map">
        <id  property="id" column="id" />
        <result property="matterId" column="matterId" />
        <result property="materialName" column="materialName" />
        <result property="isMust" column="isMust" />
        <result property="materialType" column="materialType" />
        <result property="materialProperty" column="materialProperty" />
        <result property="electronicgs" column="electronicgs" />
        <result property="materialSource" column="materialSource" />
        <result property="paperNum" column="paperNum" />
        <result property="paperGg" column="paperGg" />
        <result property="jianmMs" column="jianmMs" />
        <result property="sealWay" column="sealWay" />
        <result property="isjianm" column="isjianm" />
        <result property="isLack" column="isLack" />
        <result property="ybUrl" column="ybUrl" />
        <result property="materialSourceSm" column="materialSourceSm" />
        <result property="remarkSub" column="remarkSub" />
        <result property="clauseContent" column="clauseContent" />
        <result property="summary" column="summary" />
        <result property="remark" column="remark" />
        <result property="source" column="source" />
        <result property="createTime" column="createTime" />
        <result property="createUserId" column="createUserId" />
        <result property="updateTime" column="updateTime" />
        <result property="matterName" column="matterName" />
        <collection property="matterDatumFileList" column="id" ofType="MatterDatumFileEntity" javaType="ArrayList" select="getMatterDatumFileByDatumId"></collection>
    </resultMap>
    <resultMap type="MatterDatumFileEntity" id="MatterDatumFileEntity-Map">
        <result property="id" column="id" />
        <result property="datumId" column="datumId" />
        <result property="fileName" column="fileName" />
        <result property="fileUrl" column="fileUrl" />
        <result property="filetype" column="filetype" />
        <result property="source" column="source" />
        <result property="createTime" column="createTime" />
        <result property="createUserId" column="createUserId" />
        <result property="updateTime" column="updateTime" />
        <result property="materialName" column="materialName" />
    </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('matterId') or colPickMode == 1 and data.containsKey('matterId')))">
                a.matterId as matterId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('materialName') or colPickMode == 1 and data.containsKey('materialName')))">
                a.materialName as materialName,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('isMust') or colPickMode == 1 and data.containsKey('isMust')))">
                a.isMust as isMust,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('materialType') or colPickMode == 1 and data.containsKey('materialType')))">
                a.materialType as materialType,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('materialProperty') or colPickMode == 1 and data.containsKey('materialProperty')))">
                a.materialProperty as materialProperty,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('electronicgs') or colPickMode == 1 and data.containsKey('electronicgs')))">
                a.electronicgs as electronicgs,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('materialSource') or colPickMode == 1 and data.containsKey('materialSource')))">
                a.materialSource as materialSource,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('paperNum') or colPickMode == 1 and data.containsKey('paperNum')))">
                a.paperNum as paperNum,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('paperGg') or colPickMode == 1 and data.containsKey('paperGg')))">
                a.paperGg as paperGg,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('jianmMs') or colPickMode == 1 and data.containsKey('jianmMs')))">
                a.jianmMs as jianmMs,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('sealWay') or colPickMode == 1 and data.containsKey('sealWay')))">
                a.sealWay as sealWay,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('isjianm') or colPickMode == 1 and data.containsKey('isjianm')))">
                a.isjianm as isjianm,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('isLack') or colPickMode == 1 and data.containsKey('isLack')))">
                a.isLack as isLack,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('ybUrl') or colPickMode == 1 and data.containsKey('ybUrl')))">
                a.ybUrl as ybUrl,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('materialSourceSm') or colPickMode == 1 and data.containsKey('materialSourceSm')))">
                a.materialSourceSm as materialSourceSm,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('remarkSub') or colPickMode == 1 and data.containsKey('remarkSub')))">
                a.remarkSub as remarkSub,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('clauseContent') or colPickMode == 1 and data.containsKey('clauseContent')))">
                a.clauseContent as clauseContent,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('summary') or colPickMode == 1 and data.containsKey('summary')))">
                a.summary as summary,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('remark') or colPickMode == 1 and data.containsKey('remark')))">
                a.remark as remark,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('source') or colPickMode == 1 and data.containsKey('source')))">
                a.source as source,
            </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('createUserId') or colPickMode == 1 and data.containsKey('createUserId')))">
                a.createUserId as createUserId,
            </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('matterName') or colPickMode == 1 and data.containsKey('matterName')))">
                a.matterName as matterName,
            </if>
        </trim>
    </sql>
    <!-- 子表所有列 -->
    <sql id="_columns_sub">
        <trim suffixOverrides="," suffix="">
            b.id as id,b.datumId as datumId,b.fileName as fileName,b.fileUrl as fileUrl,b.filetype as filetype,b.source as source,b.createTime as createTime,b.createUserId as createUserId,b.updateTime as updateTime,b.materialName as materialName,
        </trim>
    </sql>
    <!-- 新增 区分主键自增加还是业务插入 -->
    <insert id="insert" parameterType="MatterDatumEntity"  useGeneratedKeys="true" keyProperty="id">
        insert into mortals_sys_matter_datum
        (matterId,materialName,isMust,materialType,materialProperty,electronicgs,materialSource,paperNum,paperGg,jianmMs,sealWay,isjianm,isLack,ybUrl,materialSourceSm,remarkSub,clauseContent,summary,remark,source,createTime,createUserId,updateTime,matterName)
        VALUES
        (#{matterId},#{materialName},#{isMust},#{materialType},#{materialProperty},#{electronicgs},#{materialSource},#{paperNum},#{paperGg},#{jianmMs},#{sealWay},#{isjianm},#{isLack},#{ybUrl},#{materialSourceSm},#{remarkSub},#{clauseContent},#{summary},#{remark},#{source},#{createTime},#{createUserId},#{updateTime},#{matterName})
    </insert>

    <!-- 批量新增 -->
    <insert id="insertBatch" parameterType="paramDto">
        insert into mortals_sys_matter_datum
        (matterId,materialName,isMust,materialType,materialProperty,electronicgs,materialSource,paperNum,paperGg,jianmMs,sealWay,isjianm,isLack,ybUrl,materialSourceSm,remarkSub,clauseContent,summary,remark,source,createTime,createUserId,updateTime,matterName)
        VALUES
        <foreach collection="data.dataList" item="item" index="index" separator="," >
            (#{item.matterId},#{item.materialName},#{item.isMust},#{item.materialType},#{item.materialProperty},#{item.electronicgs},#{item.materialSource},#{item.paperNum},#{item.paperGg},#{item.jianmMs},#{item.sealWay},#{item.isjianm},#{item.isLack},#{item.ybUrl},#{item.materialSourceSm},#{item.remarkSub},#{item.clauseContent},#{item.summary},#{item.remark},#{item.source},#{item.createTime},#{item.createUserId},#{item.updateTime},#{item.matterName})
        </foreach>
    </insert>


    <!-- 根据ParamDto更新 -->
    <update id="update" parameterType="paramDto">
        update mortals_sys_matter_datum as a
        set
        <trim suffixOverrides="," suffix="">
            <if test="(colPickMode==0 and data.containsKey('matterId')) or (colPickMode==1 and !data.containsKey('matterId'))">
                a.matterId=#{data.matterId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('matterIdIncrement')) or (colPickMode==1 and !data.containsKey('matterIdIncrement'))">
                a.matterId=ifnull(a.matterId,0) + #{data.matterIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('materialName')) or (colPickMode==1 and !data.containsKey('materialName'))">
                a.materialName=#{data.materialName},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isMust')) or (colPickMode==1 and !data.containsKey('isMust'))">
                a.isMust=#{data.isMust},
            </if>
            <if test="(colPickMode==0 and data.containsKey('materialType')) or (colPickMode==1 and !data.containsKey('materialType'))">
                a.materialType=#{data.materialType},
            </if>
            <if test="(colPickMode==0 and data.containsKey('materialProperty')) or (colPickMode==1 and !data.containsKey('materialProperty'))">
                a.materialProperty=#{data.materialProperty},
            </if>
            <if test="(colPickMode==0 and data.containsKey('electronicgs')) or (colPickMode==1 and !data.containsKey('electronicgs'))">
                a.electronicgs=#{data.electronicgs},
            </if>
            <if test="(colPickMode==0 and data.containsKey('materialSource')) or (colPickMode==1 and !data.containsKey('materialSource'))">
                a.materialSource=#{data.materialSource},
            </if>
            <if test="(colPickMode==0 and data.containsKey('paperNum')) or (colPickMode==1 and !data.containsKey('paperNum'))">
                a.paperNum=#{data.paperNum},
            </if>
            <if test="(colPickMode==0 and data.containsKey('paperNumIncrement')) or (colPickMode==1 and !data.containsKey('paperNumIncrement'))">
                a.paperNum=ifnull(a.paperNum,0) + #{data.paperNumIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('paperGg')) or (colPickMode==1 and !data.containsKey('paperGg'))">
                a.paperGg=#{data.paperGg},
            </if>
            <if test="(colPickMode==0 and data.containsKey('jianmMs')) or (colPickMode==1 and !data.containsKey('jianmMs'))">
                a.jianmMs=#{data.jianmMs},
            </if>
            <if test="(colPickMode==0 and data.containsKey('sealWay')) or (colPickMode==1 and !data.containsKey('sealWay'))">
                a.sealWay=#{data.sealWay},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isjianm')) or (colPickMode==1 and !data.containsKey('isjianm'))">
                a.isjianm=#{data.isjianm},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isLack')) or (colPickMode==1 and !data.containsKey('isLack'))">
                a.isLack=#{data.isLack},
            </if>
            <if test="(colPickMode==0 and data.containsKey('ybUrl')) or (colPickMode==1 and !data.containsKey('ybUrl'))">
                a.ybUrl=#{data.ybUrl},
            </if>
            <if test="(colPickMode==0 and data.containsKey('materialSourceSm')) or (colPickMode==1 and !data.containsKey('materialSourceSm'))">
                a.materialSourceSm=#{data.materialSourceSm},
            </if>
            <if test="(colPickMode==0 and data.containsKey('remarkSub')) or (colPickMode==1 and !data.containsKey('remarkSub'))">
                a.remarkSub=#{data.remarkSub},
            </if>
            <if test="(colPickMode==0 and data.containsKey('clauseContent')) or (colPickMode==1 and !data.containsKey('clauseContent'))">
                a.clauseContent=#{data.clauseContent},
            </if>
            <if test="(colPickMode==0 and data.containsKey('summary')) or (colPickMode==1 and !data.containsKey('summary'))">
                a.summary=#{data.summary},
            </if>
            <if test="(colPickMode==0 and data.containsKey('remark')) or (colPickMode==1 and !data.containsKey('remark'))">
                a.remark=#{data.remark},
            </if>
            <if test="(colPickMode==0 and data.containsKey('source')) or (colPickMode==1 and !data.containsKey('source'))">
                a.source=#{data.source},
            </if>
            <if test="(colPickMode==0 and data.containsKey('sourceIncrement')) or (colPickMode==1 and !data.containsKey('sourceIncrement'))">
                a.source=ifnull(a.source,0) + #{data.sourceIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
                a.createTime=#{data.createTime},
            </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('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
                a.updateTime=#{data.updateTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('matterName')) or (colPickMode==1 and !data.containsKey('matterName'))">
                a.matterName=#{data.matterName},
            </if>
        </trim>
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </update>
    <!-- 批量更新 -->
    <update id="updateBatch" parameterType="paramDto">
        update mortals_sys_matter_datum as a
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="matterId=(case" suffix="ELSE matterId end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('matterId')) or (colPickMode==1 and !item.containsKey('matterId'))">
                            when a.id=#{item.id} then #{item.matterId}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('matterIdIncrement')) or (colPickMode==1 and !item.containsKey('matterIdIncrement'))">
                            when a.id=#{item.id} then ifnull(a.matterId,0) + #{item.matterIdIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="materialName=(case" suffix="ELSE materialName end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('materialName')) or (colPickMode==1 and !item.containsKey('materialName'))">
                        when a.id=#{item.id} then #{item.materialName}
                    </if>
                </foreach>
            </trim>
            <trim prefix="isMust=(case" suffix="ELSE isMust end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('isMust')) or (colPickMode==1 and !item.containsKey('isMust'))">
                        when a.id=#{item.id} then #{item.isMust}
                    </if>
                </foreach>
            </trim>
            <trim prefix="materialType=(case" suffix="ELSE materialType end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('materialType')) or (colPickMode==1 and !item.containsKey('materialType'))">
                        when a.id=#{item.id} then #{item.materialType}
                    </if>
                </foreach>
            </trim>
            <trim prefix="materialProperty=(case" suffix="ELSE materialProperty end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('materialProperty')) or (colPickMode==1 and !item.containsKey('materialProperty'))">
                        when a.id=#{item.id} then #{item.materialProperty}
                    </if>
                </foreach>
            </trim>
            <trim prefix="electronicgs=(case" suffix="ELSE electronicgs end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('electronicgs')) or (colPickMode==1 and !item.containsKey('electronicgs'))">
                        when a.id=#{item.id} then #{item.electronicgs}
                    </if>
                </foreach>
            </trim>
            <trim prefix="materialSource=(case" suffix="ELSE materialSource end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('materialSource')) or (colPickMode==1 and !item.containsKey('materialSource'))">
                        when a.id=#{item.id} then #{item.materialSource}
                    </if>
                </foreach>
            </trim>
            <trim prefix="paperNum=(case" suffix="ELSE paperNum end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('paperNum')) or (colPickMode==1 and !item.containsKey('paperNum'))">
                            when a.id=#{item.id} then #{item.paperNum}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('paperNumIncrement')) or (colPickMode==1 and !item.containsKey('paperNumIncrement'))">
                            when a.id=#{item.id} then ifnull(a.paperNum,0) + #{item.paperNumIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="paperGg=(case" suffix="ELSE paperGg end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('paperGg')) or (colPickMode==1 and !item.containsKey('paperGg'))">
                        when a.id=#{item.id} then #{item.paperGg}
                    </if>
                </foreach>
            </trim>
            <trim prefix="jianmMs=(case" suffix="ELSE jianmMs end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('jianmMs')) or (colPickMode==1 and !item.containsKey('jianmMs'))">
                        when a.id=#{item.id} then #{item.jianmMs}
                    </if>
                </foreach>
            </trim>
            <trim prefix="sealWay=(case" suffix="ELSE sealWay end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('sealWay')) or (colPickMode==1 and !item.containsKey('sealWay'))">
                        when a.id=#{item.id} then #{item.sealWay}
                    </if>
                </foreach>
            </trim>
            <trim prefix="isjianm=(case" suffix="ELSE isjianm end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('isjianm')) or (colPickMode==1 and !item.containsKey('isjianm'))">
                        when a.id=#{item.id} then #{item.isjianm}
                    </if>
                </foreach>
            </trim>
            <trim prefix="isLack=(case" suffix="ELSE isLack end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('isLack')) or (colPickMode==1 and !item.containsKey('isLack'))">
                        when a.id=#{item.id} then #{item.isLack}
                    </if>
                </foreach>
            </trim>
            <trim prefix="ybUrl=(case" suffix="ELSE ybUrl end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('ybUrl')) or (colPickMode==1 and !item.containsKey('ybUrl'))">
                        when a.id=#{item.id} then #{item.ybUrl}
                    </if>
                </foreach>
            </trim>
            <trim prefix="materialSourceSm=(case" suffix="ELSE materialSourceSm end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('materialSourceSm')) or (colPickMode==1 and !item.containsKey('materialSourceSm'))">
                        when a.id=#{item.id} then #{item.materialSourceSm}
                    </if>
                </foreach>
            </trim>
            <trim prefix="remarkSub=(case" suffix="ELSE remarkSub end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('remarkSub')) or (colPickMode==1 and !item.containsKey('remarkSub'))">
                        when a.id=#{item.id} then #{item.remarkSub}
                    </if>
                </foreach>
            </trim>
            <trim prefix="clauseContent=(case" suffix="ELSE clauseContent end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('clauseContent')) or (colPickMode==1 and !item.containsKey('clauseContent'))">
                        when a.id=#{item.id} then #{item.clauseContent}
                    </if>
                </foreach>
            </trim>
            <trim prefix="summary=(case" suffix="ELSE summary end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('summary')) or (colPickMode==1 and !item.containsKey('summary'))">
                        when a.id=#{item.id} then #{item.summary}
                    </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="source=(case" suffix="ELSE source end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('source')) or (colPickMode==1 and !item.containsKey('source'))">
                            when a.id=#{item.id} then #{item.source}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('sourceIncrement')) or (colPickMode==1 and !item.containsKey('sourceIncrement'))">
                            when a.id=#{item.id} then ifnull(a.source,0) + #{item.sourceIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="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="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="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="matterName=(case" suffix="ELSE matterName end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('matterName')) or (colPickMode==1 and !item.containsKey('matterName'))">
                        when a.id=#{item.id} then #{item.matterName}
                    </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="MatterDatumEntity-Map">
        select <include refid="_columns"/>
        from mortals_sys_matter_datum as a
        where a.id=#{condition.id}
    </select>
    <!-- 根据主健删除 -->
    <delete id="deleteByKey" parameterType="paramDto">
        delete a.* from mortals_sys_matter_datum as a where a.id=#{condition.id}
    </delete>
    <!-- 根据主健删除一批，针对单一主健有效 -->
    <delete id="deleteByKeys">
        delete from mortals_sys_matter_datum 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_sys_matter_datum as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </delete>
    <!-- 获取列表 -->
    <select id="getList" parameterType="paramDto" resultMap="MatterDatumEntity-Map">
        select <include refid="_columns"/>
        from mortals_sys_matter_datum as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
        <include refid="_orderCols_"/>
    </select>
    <!-- 获取子列表 -->
    <select id="getMatterDatumFileByDatumId" parameterType="java.lang.Long" resultMap="MatterDatumFileEntity-Map">
        select <include refid="_columns_sub"/>
        from mortals_sys_matter_datum_file as b
        <trim suffixOverrides="where" suffix="">
            where b.datumId = #{id}
        </trim>
    </select>



    <!-- 获取 -->
    <select id="getListCount" parameterType="paramDto" resultType="int">
        select count(1)
        from mortals_sys_matter_datum 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('matterId')">
            <if test="conditionParamRef.matterId != null ">
                ${_conditionType_} a.matterId = #{${_conditionParam_}.matterId}
            </if>
            <if test="conditionParamRef.matterId == null">
                ${_conditionType_} a.matterId is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('matterIdList')">
            ${_conditionType_} a.matterId in
            <foreach collection="conditionParamRef.matterIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('matterIdStart') and conditionParamRef.matterIdStart != null">
            ${_conditionType_} a.matterId <![CDATA[ >= ]]> #{${_conditionParam_}.matterIdStart}
        </if>
        <if test="conditionParamRef.containsKey('matterIdEnd') and conditionParamRef.matterIdEnd != null">
            ${_conditionType_} a.matterId <![CDATA[ <= ]]> #{${_conditionParam_}.matterIdEnd}
        </if>


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

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

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

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

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

        <if test="conditionParamRef.containsKey('materialSource')">
            <if test="conditionParamRef.materialSource != null and conditionParamRef.materialSource != ''">
                ${_conditionType_} a.materialSource like #{${_conditionParam_}.materialSource}
            </if>
            <if test="conditionParamRef.materialSource == null">
                ${_conditionType_} a.materialSource is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('materialSourceList')">
            ${_conditionType_} a.materialSource in
            <foreach collection="conditionParamRef.materialSourceList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('paperNum')">
            <if test="conditionParamRef.paperNum != null ">
                ${_conditionType_} a.paperNum = #{${_conditionParam_}.paperNum}
            </if>
            <if test="conditionParamRef.paperNum == null">
                ${_conditionType_} a.paperNum is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('paperNumList')">
            ${_conditionType_} a.paperNum in
            <foreach collection="conditionParamRef.paperNumList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('paperNumStart') and conditionParamRef.paperNumStart != null">
            ${_conditionType_} a.paperNum <![CDATA[ >= ]]> #{${_conditionParam_}.paperNumStart}
        </if>
        <if test="conditionParamRef.containsKey('paperNumEnd') and conditionParamRef.paperNumEnd != null">
            ${_conditionType_} a.paperNum <![CDATA[ <= ]]> #{${_conditionParam_}.paperNumEnd}
        </if>


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

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

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

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

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

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

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

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

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

        <if test="conditionParamRef.containsKey('summary')">
            <if test="conditionParamRef.summary != null and conditionParamRef.summary != ''">
                ${_conditionType_} a.summary like #{${_conditionParam_}.summary}
            </if>
            <if test="conditionParamRef.summary == null">
                ${_conditionType_} a.summary is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('summaryList')">
            ${_conditionType_} a.summary in
            <foreach collection="conditionParamRef.summaryList" 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')">
            ${_conditionType_} a.remark in
            <foreach collection="conditionParamRef.remarkList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('source')">
            <if test="conditionParamRef.source != null ">
                ${_conditionType_} a.source = #{${_conditionParam_}.source}
            </if>
            <if test="conditionParamRef.source == null">
                ${_conditionType_} a.source is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('sourceList')">
            ${_conditionType_} a.source in
            <foreach collection="conditionParamRef.sourceList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('sourceStart') and conditionParamRef.sourceStart != null">
            ${_conditionType_} a.source <![CDATA[ >= ]]> #{${_conditionParam_}.sourceStart}
        </if>
        <if test="conditionParamRef.containsKey('sourceEnd') and conditionParamRef.sourceEnd != null">
            ${_conditionType_} a.source <![CDATA[ <= ]]> #{${_conditionParam_}.sourceEnd}
        </if>


        <if test="conditionParamRef.containsKey('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('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')">
            ${_conditionType_} a.createUserId in
            <foreach collection="conditionParamRef.createUserIdList" 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('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('matterName')">
            <if test="conditionParamRef.matterName != null and conditionParamRef.matterName != ''">
                ${_conditionType_} a.matterName like #{${_conditionParam_}.matterName}
            </if>
            <if test="conditionParamRef.matterName == null">
                ${_conditionType_} a.matterName is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('matterNameList')">
            ${_conditionType_} a.matterName in
            <foreach collection="conditionParamRef.matterNameList" 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('matterId')">
                    a.matterId
                    <if test='orderCol.matterId != null and "DESC".equalsIgnoreCase(orderCol.matterId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('materialName')">
                    a.materialName
                    <if test='orderCol.materialName != null and "DESC".equalsIgnoreCase(orderCol.materialName)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('isMust')">
                    a.isMust
                    <if test='orderCol.isMust != null and "DESC".equalsIgnoreCase(orderCol.isMust)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('materialType')">
                    a.materialType
                    <if test='orderCol.materialType != null and "DESC".equalsIgnoreCase(orderCol.materialType)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('materialProperty')">
                    a.materialProperty
                    <if test='orderCol.materialProperty != null and "DESC".equalsIgnoreCase(orderCol.materialProperty)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('electronicgs')">
                    a.electronicgs
                    <if test='orderCol.electronicgs != null and "DESC".equalsIgnoreCase(orderCol.electronicgs)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('materialSource')">
                    a.materialSource
                    <if test='orderCol.materialSource != null and "DESC".equalsIgnoreCase(orderCol.materialSource)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('paperNum')">
                    a.paperNum
                    <if test='orderCol.paperNum != null and "DESC".equalsIgnoreCase(orderCol.paperNum)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('paperGg')">
                    a.paperGg
                    <if test='orderCol.paperGg != null and "DESC".equalsIgnoreCase(orderCol.paperGg)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('jianmMs')">
                    a.jianmMs
                    <if test='orderCol.jianmMs != null and "DESC".equalsIgnoreCase(orderCol.jianmMs)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('sealWay')">
                    a.sealWay
                    <if test='orderCol.sealWay != null and "DESC".equalsIgnoreCase(orderCol.sealWay)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('isjianm')">
                    a.isjianm
                    <if test='orderCol.isjianm != null and "DESC".equalsIgnoreCase(orderCol.isjianm)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('isLack')">
                    a.isLack
                    <if test='orderCol.isLack != null and "DESC".equalsIgnoreCase(orderCol.isLack)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('ybUrl')">
                    a.ybUrl
                    <if test='orderCol.ybUrl != null and "DESC".equalsIgnoreCase(orderCol.ybUrl)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('materialSourceSm')">
                    a.materialSourceSm
                    <if test='orderCol.materialSourceSm != null and "DESC".equalsIgnoreCase(orderCol.materialSourceSm)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('remarkSub')">
                    a.remarkSub
                    <if test='orderCol.remarkSub != null and "DESC".equalsIgnoreCase(orderCol.remarkSub)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('clauseContent')">
                    a.clauseContent
                    <if test='orderCol.clauseContent != null and "DESC".equalsIgnoreCase(orderCol.clauseContent)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('summary')">
                    a.summary
                    <if test='orderCol.summary != null and "DESC".equalsIgnoreCase(orderCol.summary)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('remark')">
                    a.remark
                    <if test='orderCol.remark != null and "DESC".equalsIgnoreCase(orderCol.remark)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('source')">
                    a.source
                    <if test='orderCol.source != null and "DESC".equalsIgnoreCase(orderCol.source)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('createTime')">
                    a.createTime
                    <if test='orderCol.createTime != null and "DESC".equalsIgnoreCase(orderCol.createTime)'>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('updateTime')">
                    a.updateTime
                    <if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('matterName')">
                    a.matterName
                    <if test='orderCol.matterName != null and "DESC".equalsIgnoreCase(orderCol.matterName)'>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>