<?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-09-21 13:06:20
|
* @version 1.0.0
|
-->
|
<mapper namespace="cn.huge.module.cases.dao.mapper.CaseDismissMapper">
|
<!-- 结果集 -->
|
<resultMap id="dataResult" type="cn.huge.module.cases.domain.po.CaseDismiss">
|
<result property="id" column="id"/>
|
<result property="caseId" column="case_id"/>
|
<result property="caseTaskId" column="case_task_id"/>
|
<result property="caseTaskTime" column="case_task_time"/>
|
<result property="disContent" column="dis_content"/>
|
<result property="disUnitId" column="dis_unit_id"/>
|
<result property="disUnitName" column="dis_unit_name"/>
|
<result property="disUserId" column="dis_user_id"/>
|
<result property="disUserName" column="dis_user_name"/>
|
<result property="disTime" column="dis_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_dismiss</sql>
|
<!-- 字段 -->
|
<sql id="column-part">
|
id,
|
case_id,
|
case_task_id,
|
case_task_time,
|
dis_content,
|
dis_unit_id,
|
dis_unit_name,
|
dis_user_id,
|
dis_user_name,
|
dis_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.caseTaskId != null">case_task_id = #{entity.caseTaskId},</if>
|
<if test="entity.caseTaskTime != null">case_task_time = #{entity.caseTaskTime},</if>
|
<if test="entity.disContent != null">dis_content = #{entity.disContent},</if>
|
<if test="entity.disUnitId != null">dis_unit_id = #{entity.disUnitId},</if>
|
<if test="entity.disUnitName != null">dis_unit_name = #{entity.disUnitName},</if>
|
<if test="entity.disUserId != null">dis_user_id = #{entity.disUserId},</if>
|
<if test="entity.disUserName != null">dis_user_name = #{entity.disUserName},</if>
|
<if test="entity.disTime != null">dis_time = #{entity.disTime},</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.caseTaskId != null and terms.caseTaskId !=''">
|
and case_task_id = #{terms.caseTaskId}
|
</if>
|
<if test="terms.caseTaskTime != null and terms.caseTaskTime !=''">
|
and case_task_time = #{terms.caseTaskTime}
|
</if>
|
<if test="terms.disContent != null and terms.disContent !=''">
|
and dis_content = #{terms.disContent}
|
</if>
|
<if test="terms.disUnitId != null and terms.disUnitId !=''">
|
and dis_unit_id = #{terms.disUnitId}
|
</if>
|
<if test="terms.disUnitName != null and terms.disUnitName !=''">
|
and dis_unit_name = #{terms.disUnitName}
|
</if>
|
<if test="terms.disUserId != null and terms.disUserId !=''">
|
and dis_user_id = #{terms.disUserId}
|
</if>
|
<if test="terms.disUserName != null and terms.disUserName !=''">
|
and dis_user_name = #{terms.disUserName}
|
</if>
|
<if test="terms.disTime != null and terms.disTime !=''">
|
and dis_time = #{terms.disTime}
|
</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="updateCaseDismiss">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<where>
|
id = #{entity.id}
|
</where>
|
</update>
|
<!-- 条件更新对象 -->
|
<update id="updateCaseDismissTerms">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<include refid="where-part"/>
|
</update>
|
<!-- 根据编号物理删除 -->
|
<delete id="deleteCaseDismiss">
|
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>
|
|
|
<!-- 工作台-不予受理条件查询-条件 -->
|
<sql id="myTaskBysl-where-part">
|
<if test="terms != null">
|
<if test="terms.disUnitId != null and terms.disUnitId !=''">
|
and t1.dis_unit_id = #{terms.disUnitId}
|
</if>
|
<if test="terms.disTimeStart != null and terms.disTimeStart !='' and terms.disTimeEnd != null and terms.disTimeEnd !=''">
|
and (DATE_FORMAT(t1.dis_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.disTimeStart}
|
and DATE_FORMAT(t1.dis_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.disTimeEnd})
|
</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}, '%')
|
</if>
|
</if>
|
</sql>
|
<!-- 首页-不予受理条件统计 -->
|
<select id="countMyTaskBysl" resultType="java.lang.Long">
|
select
|
COUNT(t1.id)
|
from
|
dyh_case_dismiss 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 t2.delete_status = 0
|
<include refid="myTaskBysl-where-part"/>
|
</select>
|
<!-- 首页-不予受理分页查询 -->
|
<select id="pageMyTaskBysl" resultType="cn.huge.module.cases.domain.dto.FrontPageListSLDTO">
|
SELECT t1.case_task_id as ownerId, t1.case_id as caseId, t3.is_risk as isRisk,
|
t1.case_task_time as turnaroundTime, t1.dis_time as taskHandleTime,
|
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,
|
(select count(1) from dyh_case_supervise where case_id = t1.case_id) as superviseCount
|
FROM
|
dyh_case_dismiss 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 t2.delete_status = 0
|
<include refid="myTaskBysl-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(t1.create_time), t1.create_time desc
|
</if>
|
limit #{page.offset}, #{page.size}
|
</select>
|
|
</mapper>
|