<?xml version="1.0" encoding="UTF-8" ?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!--
|
* @title: 纠纷签收任务表
|
* @description: 自定义sql,请自行实现业务逻辑
|
* @company: hugeinfo
|
* @author: liyj
|
* @time:2024-10-21 08:46:40
|
* @version 1.0.0
|
-->
|
<mapper namespace="cn.huge.module.bycase.dao.mapper.CaseSignMapper">
|
<!-- 结果集 -->
|
<resultMap id="dataResult" type="cn.huge.module.bycase.domain.po.CaseSign">
|
<result property="id" column="id"/>
|
<result property="caseId" column="case_id"/>
|
<result property="serieStatus" column="serie_status"/>
|
<result property="dispId" column="disp_id"/>
|
<result property="dispObjType" column="disp_obj_type"/>
|
<result property="dispObjId" column="disp_obj_id"/>
|
<result property="dispObjName" column="disp_obj_name"/>
|
<result property="expireTime" column="expire_time"/>
|
<result property="handlerUnitId" column="handler_unit_id"/>
|
<result property="handlerUnitName" column="handler_unit_name"/>
|
<result property="handlerDeptId" column="handler_dept_id"/>
|
<result property="handlerDeptName" column="handler_dept_name"/>
|
<result property="handlerUserId" column="handler_user_id"/>
|
<result property="handlerUserName" column="handler_user_name"/>
|
<result property="handleResult" column="handle_result"/>
|
<result property="handleResultName" column="handle_result_name"/>
|
<result property="notsignReason" column="notsign_reason"/>
|
<result property="notsignReasonName" column="notsign_reason_name"/>
|
<result property="handleContent" column="handle_content"/>
|
<result property="status" column="status"/>
|
<result property="signTime" column="sign_time"/>
|
<result property="deleteStatus" column="delete_status"/>
|
<result property="custId" column="cust_id"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
</resultMap>
|
<!-- 表 -->
|
<sql id='table-name'>dyh_case_sign</sql>
|
<!-- 字段 -->
|
<sql id="column-part">
|
id,
|
case_id,
|
serie_status,
|
disp_id,
|
disp_obj_type,
|
disp_obj_id,
|
disp_obj_name,
|
expire_time,
|
handler_unit_id,
|
handler_unit_name,
|
handler_dept_id,
|
handler_dept_name,
|
handler_user_id,
|
handler_user_name,
|
handle_result,
|
handle_result_name,
|
notsign_reason,
|
notsign_reason_name,
|
handle_content,
|
status,
|
sign_time,
|
delete_status,
|
cust_id,
|
create_time,
|
update_time
|
</sql>
|
<!-- 更新实体字段 -->
|
<sql id="set-part">
|
<if test="entity.caseId != null">case_id = #{entity.caseId},</if>
|
<if test="entity.serieStatus != null">serie_status = #{entity.serieStatus},</if>
|
<if test="entity.dispId != null">disp_id = #{entity.dispId},</if>
|
<if test="entity.dispObjType != null">disp_obj_type = #{entity.dispObjType},</if>
|
<if test="entity.dispObjId != null">disp_obj_id = #{entity.dispObjId},</if>
|
<if test="entity.dispObjName != null">disp_obj_name = #{entity.dispObjName},</if>
|
<if test="entity.expireTime != null">expire_time = #{entity.expireTime},</if>
|
<if test="entity.handlerUnitId != null">handler_unit_id = #{entity.handlerUnitId},</if>
|
<if test="entity.handlerUnitName != null">handler_unit_name = #{entity.handlerUnitName},</if>
|
<if test="entity.handlerDeptId != null">handler_dept_id = #{entity.handlerDeptId},</if>
|
<if test="entity.handlerDeptName != null">handler_dept_name = #{entity.handlerDeptName},</if>
|
<if test="entity.handlerUserId != null">handler_user_id = #{entity.handlerUserId},</if>
|
<if test="entity.handlerUserName != null">handler_user_name = #{entity.handlerUserName},</if>
|
<if test="entity.handleResult != null">handle_result = #{entity.handleResult},</if>
|
<if test="entity.handleResultName != null">handle_result_name = #{entity.handleResultName},</if>
|
<if test="entity.notsignReason != null">notsign_reason = #{entity.notsignReason},</if>
|
<if test="entity.notsignReasonName != null">notsign_reason_name = #{entity.notsignReasonName},</if>
|
<if test="entity.handleContent != null">handle_content = #{entity.handleContent},</if>
|
<if test="entity.status != null">status = #{entity.status},</if>
|
<if test="entity.signTime != null">sign_time = #{entity.signTime},</if>
|
<if test="entity.deleteStatus != null">delete_status = #{entity.deleteStatus},</if>
|
<if test="entity.custId != null">cust_id = #{entity.custId},</if>
|
<if test="entity.createTime != null">create_time = #{entity.createTime},</if>
|
<if test="entity.updateTime != null">update_time = #{entity.updateTime}</if>
|
</sql>
|
<!-- 条件 -->
|
<sql id="where-part">
|
<if test="terms != null">
|
<where>
|
<if test="terms.id != null and terms.id !=''">
|
and id = #{terms.id}
|
</if>
|
<if test="terms.caseId != null and terms.caseId !=''">
|
and case_id = #{terms.caseId}
|
</if>
|
<if test="terms.serieStatus != null and terms.serieStatus !=''">
|
and serie_status = #{terms.serieStatus}
|
</if>
|
<if test="terms.dispId != null and terms.dispId !=''">
|
and disp_id = #{terms.dispId}
|
</if>
|
<if test="terms.dispObjType != null and terms.dispObjType !=''">
|
and disp_obj_type = #{terms.dispObjType}
|
</if>
|
<if test="terms.dispObjId != null and terms.dispObjId !=''">
|
and disp_obj_id = #{terms.dispObjId}
|
</if>
|
<if test="terms.dispObjName != null and terms.dispObjName !=''">
|
and disp_obj_name = #{terms.dispObjName}
|
</if>
|
<if test="terms.expireTime != null and terms.expireTime !=''">
|
and expire_time = #{terms.expireTime}
|
</if>
|
<if test="terms.handlerUnitId != null and terms.handlerUnitId !=''">
|
and handler_unit_id = #{terms.handlerUnitId}
|
</if>
|
<if test="terms.handlerUnitName != null and terms.handlerUnitName !=''">
|
and handler_unit_name = #{terms.handlerUnitName}
|
</if>
|
<if test="terms.handlerDeptId != null and terms.handlerDeptId !=''">
|
and handler_dept_id = #{terms.handlerDeptId}
|
</if>
|
<if test="terms.handlerDeptName != null and terms.handlerDeptName !=''">
|
and handler_dept_name = #{terms.handlerDeptName}
|
</if>
|
<if test="terms.handlerUserId != null and terms.handlerUserId !=''">
|
and handler_user_id = #{terms.handlerUserId}
|
</if>
|
<if test="terms.handlerUserName != null and terms.handlerUserName !=''">
|
and handler_user_name = #{terms.handlerUserName}
|
</if>
|
<if test="terms.handleResult != null and terms.handleResult !=''">
|
and handle_result = #{terms.handleResult}
|
</if>
|
<if test="terms.handleResultName != null and terms.handleResultName !=''">
|
and handle_result_name = #{terms.handleResultName}
|
</if>
|
<if test="terms.notsignReason != null and terms.notsignReason !=''">
|
and notsign_reason = #{terms.notsignReason}
|
</if>
|
<if test="terms.notsignReasonName != null and terms.notsignReasonName !=''">
|
and notsign_reason_name = #{terms.notsignReasonName}
|
</if>
|
<if test="terms.handleContent != null and terms.handleContent !=''">
|
and handle_content = #{terms.handleContent}
|
</if>
|
<if test="terms.status != null and terms.status !=''">
|
and status = #{terms.status}
|
</if>
|
<if test="terms.signTime != null and terms.signTime !=''">
|
and sign_time = #{terms.signTime}
|
</if>
|
<if test="terms.deleteStatus = null and terms.deleteStatus =''">
|
and delete_status = '1'
|
</if>
|
<if test="terms.deleteStatus != null and terms.deleteStatus !=''">
|
and delete_status = #{terms.deleteStatus}
|
</if>
|
<if test="terms.custId != null and terms.custId !=''">
|
and cust_id = #{terms.custId}
|
</if>
|
<if test="terms.createTime != null and terms.createTime !=''">
|
and DATE_FORMAT(create_time,'%Y-%m-%d') = #{terms.createTime}
|
</if>
|
<if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''">
|
and (DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.createStart}
|
and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.createEnd})
|
</if>
|
<if test="terms.updateTime != null and terms.updateTime !=''">
|
and DATE_FORMAT(update_time,'%Y-%m-%d') = #{terms.updateTime}
|
</if>
|
<if test="terms.updateStart != null and terms.updateStart !='' and terms.updateEnd != null and terms.updateEnd !=''">
|
and (DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.updateStart}
|
and DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.updateEnd})
|
</if>
|
</where>
|
</if>
|
</sql>
|
<!-- 更新对象 -->
|
<update id="updateCaseSign">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<where>
|
id = #{entity.id}
|
</where>
|
</update>
|
<!-- 条件更新对象 -->
|
<update id="updateCaseSignTerms">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<include refid="where-part"/>
|
</update>
|
<!-- 根据编号物理删除 -->
|
<delete id="deleteCaseSign">
|
delete from
|
<include refid="table-name" />
|
where id = #{id}
|
</delete>
|
<!-- 根据条件查询 -->
|
<select id="listTerms" resultMap="dataResult">
|
select
|
<include refid="column-part"/>
|
from
|
<include refid="table-name" />
|
<include refid="where-part"/>
|
</select>
|
<!-- 根据条件统计 -->
|
<select id="countTerms" resultType="java.lang.Long">
|
select
|
COUNT(1)
|
from
|
<include refid="table-name" />
|
<include refid="where-part"/>
|
</select>
|
<!-- 根据条件分页查询 -->
|
<select id="pageTerms" resultMap="dataResult">
|
SELECT
|
<include refid="column-part"/>
|
FROM
|
<include refid="table-name" />
|
<include refid="where-part"/>
|
<if test="page.sort != null">
|
<foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
|
isnull(${s.property}), ${s.property} ${s.direction}
|
</foreach>
|
</if>
|
<if test="page.sort == null">
|
order by isnull(create_time), create_time desc
|
</if>
|
limit #{page.offset}, #{page.size}
|
</select>
|
|
</mapper>
|