<?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.CaseAssistApplyMapper">
|
<!-- 结果集 -->
|
<resultMap id="dataResult" type="cn.huge.module.cases.domain.po.CaseAssistApply">
|
<result property="id" column="id"/>
|
<result property="caseId" column="case_id"/>
|
<result property="applyUnitId" column="apply_unit_id"/>
|
<result property="applyUnitName" column="apply_unit_name"/>
|
<result property="applyUserId" column="apply_user_id"/>
|
<result property="applyUserName" column="apply_user_name"/>
|
<result property="applyAssistUnitId" column="apply_assist_unit_id"/>
|
<result property="applyAssistUnitName" column="apply_assist_unit_name"/>
|
<result property="applyContent" column="apply_content"/>
|
<result property="applyTime" column="apply_time"/>
|
<result property="applyStatus" column="apply_status"/>
|
<result property="auditUnitId" column="audit_unit_id"/>
|
<result property="auditUnitName" column="audit_unit_name"/>
|
<result property="auditUserId" column="audit_user_id"/>
|
<result property="auditUserName" column="audit_user_name"/>
|
<result property="auditTime" column="audit_time"/>
|
<result property="auditResult" column="audit_result"/>
|
<result property="auditResultName" column="audit_result_name"/>
|
<result property="auditContent" column="audit_content"/>
|
<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_assist_apply</sql>
|
<!-- 字段 -->
|
<sql id="column-part">
|
id,
|
case_id,
|
apply_unit_id,
|
apply_unit_name,
|
apply_user_id,
|
apply_user_name,
|
apply_assist_unit_id,
|
apply_assist_unit_name,
|
apply_content,
|
apply_time,
|
apply_status,
|
audit_unit_id,
|
audit_unit_name,
|
audit_user_id,
|
audit_user_name,
|
audit_time,
|
audit_result,
|
audit_result_name,
|
audit_content,
|
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.applyUnitId != null">apply_unit_id = #{entity.applyUnitId},</if>
|
<if test="entity.applyUnitName != null">apply_unit_name = #{entity.applyUnitName},</if>
|
<if test="entity.applyUserId != null">apply_user_id = #{entity.applyUserId},</if>
|
<if test="entity.applyUserName != null">apply_user_name = #{entity.applyUserName},</if>
|
<if test="entity.applyAssistUnitId != null">apply_assist_unit_id = #{entity.applyAssistUnitId},</if>
|
<if test="entity.applyAssistUnitName != null">apply_assist_unit_name = #{entity.applyAssistUnitName},</if>
|
<if test="entity.applyContent != null">apply_content = #{entity.applyContent},</if>
|
<if test="entity.applyTime != null">apply_time = #{entity.applyTime},</if>
|
<if test="entity.applyStatus != null">apply_status = #{entity.applyStatus},</if>
|
<if test="entity.auditUnitId != null">audit_unit_id = #{entity.auditUnitId},</if>
|
<if test="entity.auditUnitName != null">audit_unit_name = #{entity.auditUnitName},</if>
|
<if test="entity.auditUserId != null">audit_user_id = #{entity.auditUserId},</if>
|
<if test="entity.auditUserName != null">audit_user_name = #{entity.auditUserName},</if>
|
<if test="entity.auditTime != null">audit_time = #{entity.auditTime},</if>
|
<if test="entity.auditResult != null">audit_result = #{entity.auditResult},</if>
|
<if test="entity.auditResultName != null">audit_result_name = #{entity.auditResultName},</if>
|
<if test="entity.auditContent != null">audit_content = #{entity.auditContent},</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.applyUnitId != null and terms.applyUnitId !=''">
|
and apply_unit_id = #{terms.applyUnitId}
|
</if>
|
<if test="terms.applyUnitName != null and terms.applyUnitName !=''">
|
and apply_unit_name = #{terms.applyUnitName}
|
</if>
|
<if test="terms.applyUserId != null and terms.applyUserId !=''">
|
and apply_user_id = #{terms.applyUserId}
|
</if>
|
<if test="terms.applyUserName != null and terms.applyUserName !=''">
|
and apply_user_name = #{terms.applyUserName}
|
</if>
|
<if test="terms.applyAssistUnitId != null and terms.applyAssistUnitId !=''">
|
and apply_assist_unit_id = #{terms.applyAssistUnitId}
|
</if>
|
<if test="terms.applyAssistUnitName != null and terms.applyAssistUnitName !=''">
|
and apply_assist_unit_name = #{terms.applyAssistUnitName}
|
</if>
|
<if test="terms.applyContent != null and terms.applyContent !=''">
|
and apply_content = #{terms.applyContent}
|
</if>
|
<if test="terms.applyTime != null and terms.applyTime !=''">
|
and apply_time = #{terms.applyTime}
|
</if>
|
<if test="terms.applyStatus != null and terms.applyStatus !=''">
|
and apply_status = #{terms.applyStatus}
|
</if>
|
<if test="terms.auditUnitId != null and terms.auditUnitId !=''">
|
and audit_unit_id = #{terms.auditUnitId}
|
</if>
|
<if test="terms.auditUnitName != null and terms.auditUnitName !=''">
|
and audit_unit_name = #{terms.auditUnitName}
|
</if>
|
<if test="terms.auditUserId != null and terms.auditUserId !=''">
|
and audit_user_id = #{terms.auditUserId}
|
</if>
|
<if test="terms.auditUserName != null and terms.auditUserName !=''">
|
and audit_user_name = #{terms.auditUserName}
|
</if>
|
<if test="terms.auditTime != null and terms.auditTime !=''">
|
and audit_time = #{terms.auditTime}
|
</if>
|
<if test="terms.auditResult != null and terms.auditResult !=''">
|
and audit_result = #{terms.auditResult}
|
</if>
|
<if test="terms.auditResultName != null and terms.auditResultName !=''">
|
and audit_result_name = #{terms.auditResultName}
|
</if>
|
<if test="terms.auditContent != null and terms.auditContent !=''">
|
and audit_content = #{terms.auditContent}
|
</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="updateCaseAssistApply">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<where>
|
id = #{entity.id}
|
</where>
|
</update>
|
<!-- 条件更新对象 -->
|
<update id="updateCaseAssistApplyTerms">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<include refid="where-part"/>
|
</update>
|
<!-- 根据编号物理删除 -->
|
<delete id="deleteCaseAssistApply">
|
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="countAssistReview" resultType="java.lang.Long">
|
select
|
COUNT(1)
|
from
|
<include refid="table-name" />
|
where
|
delete_status = 0
|
and apply_status = 0
|
and audit_unit_id = #{auditUnitId}
|
</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="auditTime" column="auditTime"/>
|
<result property="auditResult" column="auditResult"/>
|
<result property="isRisk" column="isRisk"/>
|
</resultMap>
|
|
<!-- 首页-待审核统计 -->
|
<select id="countMyTaskAssistReview" resultType="java.lang.Long">
|
select
|
COUNT(t1.id)
|
from
|
dyh_case_assist_apply 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
|
and t1.apply_status = #{terms.applyStatus}
|
and t1.audit_unit_id = #{terms.auditUnitId}
|
<if test="terms.timeStart != null and terms.timeStart !='' and terms.timeEnd != null and terms.timeEnd !=''">
|
and (DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
|
and DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.timeEnd})
|
</if>
|
<if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
|
and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
|
and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
|
</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="pageMyTaskAssistReview" resultMap="MyTaskApplyReviewResult">
|
SELECT t1.id as ownerId, t1.case_id as CaseId, t1.audit_time as auditTime, t1.audit_result_name as auditResult, t3.is_risk as isRisk,
|
t1.apply_time as turnaroundTime, t1.apply_unit_name as organizingUnit, t1.apply_assist_unit_name as cooperatingUnit,
|
t1.apply_content as reason,t2.case_level as caseGrade, t2.canal_name as caseSource, 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
|
FROM
|
dyh_case_assist_apply 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
|
and t1.apply_status = #{terms.applyStatus}
|
and t1.audit_unit_id = #{terms.auditUnitId}
|
<if test="terms.timeStart != null and terms.timeStart !='' and terms.timeEnd != null and terms.timeEnd !=''">
|
and (DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
|
and DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.timeEnd})
|
</if>
|
<if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
|
and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
|
and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
|
</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(t1.create_time), t1.create_time desc
|
</if>
|
limit #{page.offset}, #{page.size}
|
</select>
|
</mapper>
|