<?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-14 14:23:35
|
* @version 1.0.0
|
-->
|
<mapper namespace="cn.huge.module.cases.dao.mapper.CaseSuperviseMapper">
|
<!-- 结果集 -->
|
<resultMap id="dataResult" type="cn.huge.module.cases.domain.po.CaseSupervise">
|
<result property="id" column="id"/>
|
<result property="caseId" column="case_id"/>
|
<result property="supContent" column="sup_content"/>
|
<result property="supUnitId" column="sup_unit_id"/>
|
<result property="supUnitName" column="sup_unit_name"/>
|
<result property="supUserId" column="sup_user_id"/>
|
<result property="supUserName" column="sup_user_name"/>
|
<result property="supTime" column="sup_time"/>
|
<result property="quiltUnitId" column="quilt_unit_id"/>
|
<result property="quiltUnitName" column="quilt_unit_name"/>
|
<result property="supStatus" column="sup_status"/>
|
<result property="replyTerm" column="reply_term"/>
|
<result property="replyContent" column="reply_content"/>
|
<result property="replyUserId" column="reply_user_id"/>
|
<result property="replyUserName" column="reply_user_name"/>
|
<result property="replyTime" column="reply_time"/>
|
<result property="usetimeHour" column="usetime_hour"/>
|
<result property="overtimeStatus" column="overtime_status"/>
|
<result property="overtimeHour" column="overtime_hour"/>
|
<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_supervise</sql>
|
<!-- 字段 -->
|
<sql id="column-part">
|
id,
|
case_id,
|
sup_content,
|
sup_unit_id,
|
sup_unit_name,
|
sup_user_id,
|
sup_user_name,
|
sup_time,
|
quilt_unit_id,
|
quilt_unit_name,
|
sup_status,
|
reply_term,
|
reply_content,
|
reply_user_id,
|
reply_user_name,
|
reply_time,
|
usetime_hour,
|
overtime_status,
|
overtime_hour,
|
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.supContent != null">sup_content = #{entity.supContent},</if>
|
<if test="entity.supUnitId != null">sup_unit_id = #{entity.supUnitId},</if>
|
<if test="entity.supUnitName != null">sup_unit_name = #{entity.supUnitName},</if>
|
<if test="entity.supUserId != null">sup_user_id = #{entity.supUserId},</if>
|
<if test="entity.supUserName != null">sup_user_name = #{entity.supUserName},</if>
|
<if test="entity.supTime != null">sup_time = #{entity.supTime},</if>
|
<if test="entity.quiltUnitId != null">quilt_unit_id = #{entity.quiltUnitId},</if>
|
<if test="entity.quiltUnitName != null">quilt_unit_name = #{entity.quiltUnitName},</if>
|
<if test="entity.supStatus != null">sup_status = #{entity.supStatus},</if>
|
<if test="entity.replyTerm != null">reply_term = #{entity.replyTerm},</if>
|
<if test="entity.replyContent != null">reply_content = #{entity.replyContent},</if>
|
<if test="entity.replyUserId != null">reply_user_id = #{entity.replyUserId},</if>
|
<if test="entity.replyUserName != null">reply_user_name = #{entity.replyUserName},</if>
|
<if test="entity.replyTime != null">reply_time = #{entity.replyTime},</if>
|
<if test="entity.usetimeHour != null">usetime_hour = #{entity.usetimeHour},</if>
|
<if test="entity.overtimeStatus != null">overtime_status = #{entity.overtimeStatus},</if>
|
<if test="entity.overtimeHour != null">overtime_hour = #{entity.overtimeHour},</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.supContent != null and terms.supContent !=''">
|
and sup_content = #{terms.supContent}
|
</if>
|
<if test="terms.supUnitId != null and terms.supUnitId !=''">
|
and sup_unit_id = #{terms.supUnitId}
|
</if>
|
<if test="terms.supUnitName != null and terms.supUnitName !=''">
|
and sup_unit_name = #{terms.supUnitName}
|
</if>
|
<if test="terms.supUserId != null and terms.supUserId !=''">
|
and sup_user_id = #{terms.supUserId}
|
</if>
|
<if test="terms.supUserName != null and terms.supUserName !=''">
|
and sup_user_name = #{terms.supUserName}
|
</if>
|
<if test="terms.supTime != null and terms.supTime !=''">
|
and sup_time = #{terms.supTime}
|
</if>
|
<if test="terms.quiltUnitId != null and terms.quiltUnitId !=''">
|
and quilt_unit_id = #{terms.quiltUnitId}
|
</if>
|
<if test="terms.quiltUnitName != null and terms.quiltUnitName !=''">
|
and quilt_unit_name = #{terms.quiltUnitName}
|
</if>
|
<if test="terms.supStatus != null and terms.supStatus !=''">
|
and sup_status = #{terms.supStatus}
|
</if>
|
<if test="terms.replyTerm != null and terms.replyTerm !=''">
|
and reply_term = #{terms.replyTerm}
|
</if>
|
<if test="terms.replyContent != null and terms.replyContent !=''">
|
and reply_content = #{terms.replyContent}
|
</if>
|
<if test="terms.replyUserId != null and terms.replyUserId !=''">
|
and reply_user_id = #{terms.replyUserId}
|
</if>
|
<if test="terms.replyUserName != null and terms.replyUserName !=''">
|
and reply_user_name = #{terms.replyUserName}
|
</if>
|
<if test="terms.replyTime != null and terms.replyTime !=''">
|
and reply_time = #{terms.replyTime}
|
</if>
|
<if test="terms.usetimeHour != null and terms.usetimeHour !=''">
|
and usetime_hour = #{terms.usetimeHour}
|
</if>
|
<if test="terms.overtimeStatus != null and terms.overtimeStatus !=''">
|
and overtime_status = #{terms.overtimeStatus}
|
</if>
|
<if test="terms.overtimeHour != null and terms.overtimeHour !=''">
|
and overtime_hour = #{terms.overtimeHour}
|
</if>
|
<if test="terms.deleteStatus = null and terms.deleteStatus =''">
|
and delete_status = 0
|
</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="updateCaseSupervise">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<where>
|
id = #{entity.id}
|
</where>
|
</update>
|
<!-- 条件更新对象 -->
|
<update id="updateCaseSuperviseTerms">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<include refid="where-part"/>
|
</update>
|
<!-- 根据编号物理删除 -->
|
<delete id="deleteCaseSupervise">
|
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>
|
|
<!-- 根据条件统计 -->
|
<select id="countCaseSupervise" resultType="java.lang.Long">
|
select
|
COUNT(1)
|
from
|
<include refid="table-name" />
|
where case_id = #{terms.caseId}
|
and delete_status = 0
|
<if test="terms.type == 1">
|
and sup_status = #{terms.supStatus}
|
and quilt_unit_id = #{terms.quiltUnitId}
|
</if>
|
<if test="terms.type == 2">
|
and sup_status = #{terms.supStatus}
|
</if>
|
</select>
|
|
<!-- 根据条件分页查询 -->
|
<select id="pageCaseSupervise" resultMap="dataResult">
|
SELECT
|
<include refid="column-part"/>
|
FROM
|
<include refid="table-name" />
|
where case_id = #{terms.caseId}
|
and delete_status = 0
|
<if test="terms.type == 1">
|
and sup_status = #{terms.supStatus}
|
and quilt_unit_id = #{terms.quiltUnitId}
|
</if>
|
<if test="terms.type == 2">
|
and sup_status = #{terms.supStatus}
|
</if>
|
<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(sup_time), sup_time desc
|
</if>
|
limit #{page.offset}, #{page.size}
|
</select>
|
|
<!-- 首页-待办理结果集 -->
|
<resultMap id="MyTaskApplyReviewResult" type="cn.huge.module.cases.domain.dto.FrontPageListDTO">
|
<result property="ownerId" column="ownerId"/>
|
<result property="caseId" column="caseId"/>
|
<result property="turnaroundTime" column="turnaroundTime"/>
|
<result property="timeLimit" column="timeLimit"/>
|
<result property="caseGrade" column="caseGrade"/>
|
<result property="caseSource" column="caseSource"/>
|
<result property="caseType" column="caseType"/>
|
<result property="plaintiffs" column="plaintiffs"/>
|
<result property="defendants" column="defendants"/>
|
<result property="processingDays" column="processingDays"/>
|
<result property="mediResult" column="mediResult"/>
|
<result property="organizingUnit" column="organizingUnit"/>
|
<result property="cooperatingUnit" column="cooperatingUnit"/>
|
<result property="manager" column="manager"/>
|
<result property="mediResult" column="mediResult"/>
|
<result property="backUnit" column="backUnit"/>
|
<result property="reason" column="reason"/>
|
<result property="opinion" column="opinion"/>
|
<result property="process" column="process"/>
|
<result property="content" column="content"/>
|
<result property="applyStatus" column="applyStatus"/>
|
<result property="replyTime" column="replyTime"/>
|
<result property="isRisk" column="isRisk"/>
|
<result property="status" column="status"/>
|
<result property="statusName" column="statusName"/>
|
</resultMap>
|
|
<!-- 首页督办条件统计 -->
|
<select id="countMyTaskDb" resultType="java.lang.Long">
|
select
|
COUNT(1)
|
from
|
dyh_case_supervise t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
|
where
|
t1.delete_status = 0
|
<if test="terms.type != 3">
|
and t1.quilt_unit_id = #{terms.quiltUnitId}
|
and t1.sup_status = #{terms.supStatus}
|
<if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
|
and (DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
|
and DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
|
</if>
|
</if>
|
<if test="terms.type == 3">
|
and t1.sup_unit_id = #{terms.supUnitId}
|
<if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
|
and (DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
|
and DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
|
</if>
|
</if>
|
<if test="terms.timeStart != null and terms.timeStart !='' and terms.timeEnd != null and terms.timeEnd !=''">
|
and (DATE_FORMAT(t1.create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
|
and DATE_FORMAT(t1.create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.timeEnd})
|
</if>
|
<if test="terms.partyName != null and terms.partyName !=''">
|
and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
|
</if>
|
<if test="terms.caseType != null and terms.caseType !=''">
|
and t2.case_type = #{terms.caseType}
|
</if>
|
<if test="terms.plaintiffs != null and terms.plaintiffs !=''">
|
and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
|
</if>
|
<if test="terms.defendants != null and terms.defendants !=''">
|
and t2.defendants like concat('%', #{terms.defendants}, '%')
|
</if>
|
<if test="terms.canal != null and terms.canal !=''">
|
and t2.canal = #{terms.canal}
|
</if>
|
<if test="terms.caseStatus != null and terms.caseStatus !=''">
|
and t2.status = #{terms.caseStatus}
|
</if>
|
<if test="terms.caseLevel != null and terms.caseLevel !=''">
|
and t2.case_level = #{terms.caseLevel}
|
</if>
|
<if test="terms.mediResult != null and terms.mediResult !=''">
|
and t3.medi_result = #{terms.mediResult}
|
</if>
|
</select>
|
|
<!-- 首页督办分页查询 -->
|
<select id="pageMyTaskDb" resultMap="MyTaskApplyReviewResult">
|
SELECT t1.id as ownerId, t1.case_id as caseId, t1.reply_content as content, t1.sup_status as applyStatus, t1.reply_time as replyTime,
|
t1.sup_time as turnaroundTime, DATEADD(hour, t1.reply_term, t1.sup_time) as timeLimit, t1.sup_unit_name as organizingUnit,
|
t1.sup_content as opinion, t2.case_level as caseGrade, t2.canal_name as caseSource, t3.is_risk as isRisk,
|
t2.status as status, t2.status_name as statusName,
|
concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType, concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
|
concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,(select id from dyh_case_task where case_id = t2.id order by create_time desc limit 1) as caseTaskId
|
FROM
|
dyh_case_supervise t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
|
where
|
t1.delete_status = 0
|
<if test="terms.type != 3">
|
and t1.quilt_unit_id = #{terms.quiltUnitId}
|
and t1.sup_status = #{terms.supStatus}
|
<if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
|
and (DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
|
and DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
|
</if>
|
</if>
|
<if test="terms.type == 3">
|
and t1.sup_unit_id = #{terms.supUnitId}
|
<if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
|
and (DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
|
and DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
|
</if>
|
</if>
|
<if test="terms.timeStart != null and terms.timeStart !='' and terms.timeEnd != null and terms.timeEnd !=''">
|
and (DATE_FORMAT(t1.create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
|
and DATE_FORMAT(t1.create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.timeEnd})
|
</if>
|
<if test="terms.partyName != null and terms.partyName !=''">
|
and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
|
</if>
|
<if test="terms.caseType != null and terms.caseType !=''">
|
and t2.case_type = #{terms.caseType}
|
</if>
|
<if test="terms.plaintiffs != null and terms.plaintiffs !=''">
|
and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
|
</if>
|
<if test="terms.defendants != null and terms.defendants !=''">
|
and t2.defendants like concat('%', #{terms.defendants}, '%')
|
</if>
|
<if test="terms.canal != null and terms.canal !=''">
|
and t2.canal = #{terms.canal}
|
</if>
|
<if test="terms.caseStatus != null and terms.caseStatus !=''">
|
and t2.status = #{terms.caseStatus}
|
</if>
|
<if test="terms.caseLevel != null and terms.caseLevel !=''">
|
and t2.case_level = #{terms.caseLevel}
|
</if>
|
<if test="terms.mediResult != null and terms.mediResult !=''">
|
and t3.medi_result = #{terms.mediResult}
|
</if>
|
<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(sup_time), sup_time desc
|
</if>
|
limit #{page.offset}, #{page.size}
|
</select>
|
|
<!-- 根据条件统计 -->
|
<select id="countCaseSuperviseList" resultType="java.lang.Long">
|
select
|
COUNT(1)
|
from
|
<include refid="table-name" />
|
where
|
delete_status = 0
|
and sup_status = #{supStatus}
|
and quilt_unit_id = #{quiltUnitId}
|
</select>
|
</mapper>
|