<?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-09 19:58:25
|
* @version 1.0.0
|
-->
|
<mapper namespace="cn.huge.module.cases.dao.mapper.CaseInfoUnfoldMapper">
|
<!-- 结果集 -->
|
<resultMap id="dataResult" type="cn.huge.module.cases.domain.po.CaseInfoUnfold">
|
<result property="id" column="id"/>
|
<result property="acceptTime" column="accept_time"/>
|
<result property="belongUnitId" column="belong_unit_id"/>
|
<result property="belongUnitName" column="belong_unit_name"/>
|
<result property="mediateUnitId" column="mediate_unit_id"/>
|
<result property="mediateUnitName" column="mediate_unit_name"/>
|
<result property="mediateDeptId" column="mediate_dept_id"/>
|
<result property="mediateDeptName" column="mediate_dept_name"/>
|
<result property="mediatorId" column="mediator_id"/>
|
<result property="mediator" column="mediator"/>
|
<result property="mediatorMobile" column="mediator_mobile"/>
|
<result property="assistUnitId" column="assist_unit_id"/>
|
<result property="assistUnitName" column="assist_unit_name"/>
|
<result property="mediStartTime" column="medi_start_time"/>
|
<result property="mediEndTime" column="medi_end_time"/>
|
<result property="mediResult" column="medi_result"/>
|
<result property="mediResultName" column="medi_result_name"/>
|
<result property="agreeType" column="agree_type"/>
|
<result property="agreeTypeName" column="agree_type_name"/>
|
<result property="agreeContent" column="agree_content"/>
|
<result property="windupContent" column="windup_content"/>
|
<result property="mediFalse" column="medi_false"/>
|
<result property="mediFalseName" column="medi_false_name"/>
|
<result property="civilStatus" column="civil_status"/>
|
<result property="courtId" column="court_id"/>
|
<result property="courtName" column="court_name"/>
|
<result property="closeTime" column="close_time"/>
|
<result property="judicApply" column="judic_apply"/>
|
<result property="judicResult" column="judic_result"/>
|
<result property="judicResultName" column="judic_result_name"/>
|
<result property="fileStatus" column="file_status"/>
|
<result property="fileUserId" column="file_user_id"/>
|
<result property="fileUserName" column="file_user_name"/>
|
<result property="fileTime" column="file_time"/>
|
<result property="fileYear" column="file_year"/>
|
<result property="fileBookName" column="file_book_name"/>
|
<result property="fileBookNo" column="file_book_no"/>
|
<result property="fileNo" column="file_no"/>
|
<result property="fileLimitYear" column="file_limit_year"/>
|
<result property="fileAddr" column="file_addr"/>
|
<result property="fileContent" column="file_content"/>
|
<result property="fulfilSitu" column="fulfil_situ"/>
|
<result property="fulfilSituName" column="fulfil_situ_name"/>
|
<result property="visitUpStatus" column="visit_up_status"/>
|
<result property="visitUpContent" column="visit_up_content"/>
|
<result property="partyJoy" column="party_joy"/>
|
<result property="custId" column="cust_id"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="isRisk" column="is_risk"/>
|
<result property="gridHandle" column="grid_handle"/>
|
</resultMap>
|
<!-- 表 -->
|
<sql id='table-name'>dyh_case_info_unfold</sql>
|
<!-- 字段 -->
|
<sql id="column-part">
|
id,
|
accept_time,
|
belong_unit_id,
|
belong_unit_name,
|
mediate_unit_id,
|
mediate_unit_name,
|
mediate_dept_id,
|
mediate_dept_name,
|
mediator_id,
|
mediator,
|
mediator_mobile,
|
assist_unit_id,
|
assist_unit_name,
|
medi_start_time,
|
medi_end_time,
|
medi_result,
|
medi_result_name,
|
agree_type,
|
agree_type_name,
|
agree_content,
|
windup_content,
|
medi_false,
|
medi_false_name,
|
civil_status,
|
court_id,
|
court_name,
|
close_time,
|
judic_apply,
|
judic_result,
|
judic_result_name,
|
file_status,
|
file_user_id,
|
file_user_name,
|
file_time,
|
file_year,
|
file_book_name,
|
file_book_no,
|
file_no,
|
file_limit_year,
|
file_addr,
|
file_content,
|
fulfil_situ,
|
fulfil_situ_name,
|
visit_up_status,
|
visit_up_content,
|
party_joy,
|
cust_id,
|
create_time,
|
update_time,
|
is_risk,
|
grid_handle
|
</sql>
|
<!-- 更新实体字段 -->
|
<sql id="set-part">
|
<if test="entity.acceptTime != null">accept_time = #{entity.acceptTime},</if>
|
<if test="entity.belongUnitId != null">belong_unit_id = #{entity.belongUnitId},</if>
|
<if test="entity.belongUnitName != null">belong_unit_name = #{entity.belongUnitName},</if>
|
<if test="entity.mediateUnitId != null">mediate_unit_id = #{entity.mediateUnitId},</if>
|
<if test="entity.mediateUnitName != null">mediate_unit_name = #{entity.mediateUnitName},</if>
|
<if test="entity.mediateDeptId != null">mediate_dept_id = #{entity.mediateDeptId},</if>
|
<if test="entity.mediateDeptName != null">mediate_dept_name = #{entity.mediateDeptName},</if>
|
<if test="entity.mediatorId != null">mediator_id = #{entity.mediatorId},</if>
|
<if test="entity.mediator != null">mediator = #{entity.mediator},</if>
|
<if test="entity.mediatorMobile != null">mediator_mobile = #{entity.mediatorMobile},</if>
|
<if test="entity.assistUnitId != null">assist_unit_id = #{entity.assistUnitId},</if>
|
<if test="entity.assistUnitName != null">assist_unit_name = #{entity.assistUnitName},</if>
|
<if test="entity.mediStartTime != null">medi_start_time = #{entity.mediStartTime},</if>
|
<if test="entity.mediEndTime != null">medi_end_time = #{entity.mediEndTime},</if>
|
<if test="entity.mediResult != null">medi_result = #{entity.mediResult},</if>
|
<if test="entity.mediResultName != null">medi_result_name = #{entity.mediResultName},</if>
|
<if test="entity.agreeType != null">agree_type = #{entity.agreeType},</if>
|
<if test="entity.agreeTypeName != null">agree_type_name = #{entity.agreeTypeName},</if>
|
<if test="entity.agreeContent != null">agree_content = #{entity.agreeContent},</if>
|
<if test="entity.windupContent != null">windup_content = #{entity.windupContent},</if>
|
<if test="entity.mediFalse != null">medi_false = #{entity.mediFalse},</if>
|
<if test="entity.mediFalseName != null">medi_false_name = #{entity.mediFalseName},</if>
|
<if test="entity.civilStatus != null">civil_status = #{entity.civilStatus},</if>
|
<if test="entity.courtId != null">court_id = #{entity.courtId},</if>
|
<if test="entity.courtName != null">court_name = #{entity.courtName},</if>
|
<if test="entity.closeTime != null">close_time = #{entity.closeTime},</if>
|
<if test="entity.judicApply != null">judic_apply = #{entity.judicApply},</if>
|
<if test="entity.judicResult != null">judic_result = #{entity.judicResult},</if>
|
<if test="entity.judicResultName != null">judic_result_name = #{entity.judicResultName},</if>
|
<if test="entity.fileStatus != null">file_status = #{entity.fileStatus},</if>
|
<if test="entity.fileUserId != null">file_user_id = #{entity.fileUserId},</if>
|
<if test="entity.fileUserName != null">file_user_name = #{entity.fileUserName},</if>
|
<if test="entity.fileTime != null">file_time = #{entity.fileTime},</if>
|
<if test="entity.fileYear != null">file_year = #{entity.fileYear},</if>
|
<if test="entity.fileBookName != null">file_book_name = #{entity.fileBookName},</if>
|
<if test="entity.fileBookNo != null">file_book_no = #{entity.fileBookNo},</if>
|
<if test="entity.fileNo != null">file_no = #{entity.fileNo},</if>
|
<if test="entity.fileLimitYear != null">file_limit_year = #{entity.fileLimitYear},</if>
|
<if test="entity.fileAddr != null">file_addr = #{entity.fileAddr},</if>
|
<if test="entity.fileContent != null">file_content = #{entity.fileContent},</if>
|
<if test="entity.fulfilSitu != null">fulfil_situ = #{entity.fulfilSitu},</if>
|
<if test="entity.fulfilSituName != null">fulfil_situ_name = #{entity.fulfilSituName},</if>
|
<if test="entity.visitUpStatus != null">visit_up_status = #{entity.visitUpStatus},</if>
|
<if test="entity.visitUpContent != null">visit_up_content = #{entity.visitUpContent},</if>
|
<if test="entity.partyJoy != null">party_joy = #{entity.partyJoy},</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>
|
<if test="entity.isRisk != null">is_risk = #{entity.isRisk},</if>
|
<if test="entity.gridHandle != null">grid_handle = #{entity.gridHandle}</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.acceptTime != null and terms.acceptTime !=''">
|
and accept_time = #{terms.acceptTime}
|
</if>
|
<if test="terms.belongUnitId != null and terms.belongUnitId !=''">
|
and belong_unit_id = #{terms.belongUnitId}
|
</if>
|
<if test="terms.belongUnitName != null and terms.belongUnitName !=''">
|
and belong_unit_name = #{terms.belongUnitName}
|
</if>
|
<if test="terms.mediateUnitId != null and terms.mediateUnitId !=''">
|
and mediate_unit_id = #{terms.mediateUnitId}
|
</if>
|
<if test="terms.mediateUnitName != null and terms.mediateUnitName !=''">
|
and mediate_unit_name = #{terms.mediateUnitName}
|
</if>
|
<if test="terms.mediateDeptId != null and terms.mediateDeptId !=''">
|
and mediate_dept_id = #{terms.mediateDeptId}
|
</if>
|
<if test="terms.mediateDeptName != null and terms.mediateDeptName !=''">
|
and mediate_dept_name = #{terms.mediateDeptName}
|
</if>
|
<if test="terms.mediatorId != null and terms.mediatorId !=''">
|
and mediator_id = #{terms.mediatorId}
|
</if>
|
<if test="terms.mediator != null and terms.mediator !=''">
|
and mediator = #{terms.mediator}
|
</if>
|
<if test="terms.mediatorMobile != null and terms.mediatorMobile !=''">
|
and mediator_mobile = #{terms.mediatorMobile}
|
</if>
|
<if test="terms.assistUnitId != null and terms.assistUnitId !=''">
|
and assist_unit_id = #{terms.assistUnitId}
|
</if>
|
<if test="terms.assistUnitName != null and terms.assistUnitName !=''">
|
and assist_unit_name = #{terms.assistUnitName}
|
</if>
|
<if test="terms.mediStartTime != null and terms.mediStartTime !=''">
|
and medi_start_time = #{terms.mediStartTime}
|
</if>
|
<if test="terms.mediEndTime != null and terms.mediEndTime !=''">
|
and medi_end_time = #{terms.mediEndTime}
|
</if>
|
<if test="terms.mediResult != null and terms.mediResult !=''">
|
and medi_result = #{terms.mediResult}
|
</if>
|
<if test="terms.mediResultName != null and terms.mediResultName !=''">
|
and medi_result_name = #{terms.mediResultName}
|
</if>
|
<if test="terms.agreeType != null and terms.agreeType !=''">
|
and agree_type = #{terms.agreeType}
|
</if>
|
<if test="terms.agreeTypeName != null and terms.agreeTypeName !=''">
|
and agree_type_name = #{terms.agreeTypeName}
|
</if>
|
<if test="terms.agreeContent != null and terms.agreeContent !=''">
|
and agree_content = #{terms.agreeContent}
|
</if>
|
<if test="terms.windupContent != null and terms.windupContent !=''">
|
and windup_content = #{terms.windupContent}
|
</if>
|
<if test="terms.mediFalse != null and terms.mediFalse !=''">
|
and medi_false = #{terms.mediFalse}
|
</if>
|
<if test="terms.mediFalseName != null and terms.mediFalseName !=''">
|
and medi_false_name = #{terms.mediFalseName}
|
</if>
|
<if test="terms.civilStatus != null and terms.civilStatus !=''">
|
and civil_status = #{terms.civilStatus}
|
</if>
|
<if test="terms.courtId != null and terms.courtId !=''">
|
and court_id = #{terms.courtId}
|
</if>
|
<if test="terms.courtName != null and terms.courtName !=''">
|
and court_name = #{terms.courtName}
|
</if>
|
<if test="terms.closeTime != null and terms.closeTime !=''">
|
and close_time = #{terms.closeTime}
|
</if>
|
<if test="terms.judicApply != null and terms.judicApply !=''">
|
and judic_apply = #{terms.judicApply}
|
</if>
|
<if test="terms.judicResult != null and terms.judicResult !=''">
|
and judic_result = #{terms.judicResult}
|
</if>
|
<if test="terms.judicResultName != null and terms.judicResultName !=''">
|
and judic_result_name = #{terms.judicResultName}
|
</if>
|
<if test="terms.fileStatus != null and terms.fileStatus !=''">
|
and file_status = #{terms.fileStatus}
|
</if>
|
<if test="terms.fileUserId != null and terms.fileUserId !=''">
|
and file_user_id = #{terms.fileUserId}
|
</if>
|
<if test="terms.fileUserName != null and terms.fileUserName !=''">
|
and file_user_name = #{terms.fileUserName}
|
</if>
|
<if test="terms.fileTime != null and terms.fileTime !=''">
|
and file_time = #{terms.fileTime}
|
</if>
|
<if test="terms.fileYear != null and terms.fileYear !=''">
|
and file_year = #{terms.fileYear}
|
</if>
|
<if test="terms.fileBookName != null and terms.fileBookName !=''">
|
and file_book_name = #{terms.fileBookName}
|
</if>
|
<if test="terms.fileBookNo != null and terms.fileBookNo !=''">
|
and file_book_no = #{terms.fileBookNo}
|
</if>
|
<if test="terms.fileNo != null and terms.fileNo !=''">
|
and file_no = #{terms.fileNo}
|
</if>
|
<if test="terms.fileLimitYear != null and terms.fileLimitYear !=''">
|
and file_limit_year = #{terms.fileLimitYear}
|
</if>
|
<if test="terms.fileAddr != null and terms.fileAddr !=''">
|
and file_addr = #{terms.fileAddr}
|
</if>
|
<if test="terms.fileContent != null and terms.fileContent !=''">
|
and file_content = #{terms.fileContent}
|
</if>
|
<if test="terms.fulfilSitu != null and terms.fulfilSitu !=''">
|
and fulfil_situ = #{terms.fulfilSitu}
|
</if>
|
<if test="terms.fulfilSituName != null and terms.fulfilSituName !=''">
|
and fulfil_situ_name = #{terms.fulfilSituName}
|
</if>
|
<if test="terms.visitUpStatus != null and terms.visitUpStatus !=''">
|
and visit_up_status = #{terms.visitUpStatus}
|
</if>
|
<if test="terms.visitUpContent != null and terms.visitUpContent !=''">
|
and visit_up_content = #{terms.visitUpContent}
|
</if>
|
<if test="terms.partyJoy != null and terms.partyJoy !=''">
|
and party_joy = #{terms.partyJoy}
|
</if>
|
<if test="terms.custId != null and terms.custId !=''">
|
and cust_id = #{terms.custId}
|
</if>
|
<if test="terms.gridHandle != null and terms.gridHandle !=''">
|
and grid_handle = #{terms.gridHandle}
|
</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="updateCaseInfoUnfold">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<where>
|
id = #{entity.id}
|
</where>
|
</update>
|
<!-- 条件更新对象 -->
|
<update id="updateCaseInfoUnfoldTerms">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<include refid="where-part"/>
|
</update>
|
<!-- 根据编号物理删除 -->
|
<delete id="deleteCaseInfoUnfold">
|
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>
|
|
<!-- 更新对象 -->
|
<update id="deletePrincipal">
|
update
|
dyh_case_info_unfold
|
set
|
mediator_id = null,
|
mediator = null,
|
mediator_mobile = null
|
where
|
id = #{id}
|
</update>
|
|
<sql id="extremeCase-where-part">
|
<if test="terms != null">
|
<where>
|
t2.is_risk = 1
|
and t1.delete_status = 0
|
and t3.delete_status = 0
|
<if test="terms.unitIds != null and terms.unitIds !=''">
|
and t3.id in(${terms.unitIds})
|
</if>
|
<if test="terms.city != null and terms.city !=''">
|
and t3.city = #{terms.city}
|
</if>
|
<if test="terms.area != null and terms.area !=''">
|
and t3.area = #{terms.area}
|
</if>
|
<if test="terms.road != null and terms.road !=''">
|
and t3.road = #{terms.road}
|
</if>
|
<if test="terms.village != null and terms.village !=''">
|
and t3.village = #{terms.village}
|
</if>
|
<if test="terms.status != null and terms.status !=''">
|
and t1.status in(${terms.status})
|
</if>
|
<if test="terms.mediateUnitId != null and terms.mediateUnitId !=''">
|
and t2.meidate_unit_id = #{terms.mediateUnitId}
|
</if>
|
<if test="terms.assistUnitId != null and terms.assistUnitId !=''">
|
and t2.assist_unit_id = #{terms.assistUnitId}
|
</if>
|
<if test="terms.partyName != null and terms.partyName !=''">
|
and concat_ws('', ifnull(t1.plaintiffs, ''), ifnull(t1.pagents, ''), ifnull(t1.defendants, ''), ifnull(t1.dagents, '')) like concat('%', #{terms.partyName}, '%')
|
</if>
|
<if test="terms.createTimeStart != null and terms.createTimeStart !='' and terms.createTimeEnd != null and terms.createTimeEnd !=''">
|
and (t1.create_time <![CDATA[ >= ]]> #{terms.createTimeStart}
|
and t1.create_time <![CDATA[ <= ]]> #{terms.createTimeEnd})
|
</if>
|
</where>
|
</if>
|
</sql>
|
|
<!-- 首页-扬言极端事件列表-查询实体总数 -->
|
<select id="countExtremeCase" resultType="java.lang.Long">
|
select count(t1.id)
|
from dyh_case_info t1 left join dyh_case_info_unfold t2 on t1.id = t2.id
|
left join dyh_ct_unit t3 on t2.belong_unit_id = t3.id
|
<include refid="extremeCase-where-part"/>
|
</select>
|
<!-- 首页-扬言极端事件列表-查询实体分页结果集 -->
|
<select id="pageExtremeCase" resultType="cn.huge.module.cases.domain.dto.FrontPageListYYJDDTO">
|
select t1.id as caseId, (select id from dyh_case_task where case_id = t1.id order by create_time desc limit 1) as caseTaskId,
|
t1.canal_name as caseSource, t1.case_level as caseGrade,people_num as peopleNum,
|
concat_ws('', ifnull(t1.case_type_first_name, ''), '/' , ifnull(t1.case_type_name, '')) as caseType,
|
concat_ws('', ifnull(t1.plaintiffs, ''), ifnull(t1.pagents, '')) as plaintiffs,
|
concat_ws('', ifnull(t1.defendants, ''), ifnull(t1.dagents, '')) as defendants,
|
t1.status as status, t1.status_name as statusName, t2.mediate_unit_name as organizingUnit, t2.mediator,
|
(case when t1.status in(1,2,3,4,5) then '22_00025-3' when t1.status in(6,7) then t2.medi_result when t1.status = 8 then '22_00025-4'end)as mediResult,
|
(case when t1.status in(1,2,3,4,5) then '化解中' when t1.status in(6,7) then t2.medi_result_name when t1.status = 8 then '不予受理'end)as mediResultName,
|
t1.create_time as turnaroundTime, concat(t1.que_area_name, t1.que_road_name) as queAddress,
|
(select count(1) from dyh_case_supervise where case_id = t1.id) as superviseCount
|
from dyh_case_info t1 left join dyh_case_info_unfold t2 on t1.id = t2.id
|
left join dyh_ct_unit t3 on t2.belong_unit_id = t3.id
|
<include refid="extremeCase-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>
|