<?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-11-18 16:19:37
|
* @version 1.0.0
|
-->
|
<mapper namespace="cn.huge.module.thirdByRmtj.dao.mapper.ThRmtjApplyMapper">
|
<!-- 结果集 -->
|
<resultMap id="dataResult" type="cn.huge.module.thirdByRmtj.domain.po.ThRmtjApply">
|
<result property="id" column="id"/>
|
<result property="caseId" column="case_id"/>
|
<result property="applyIndex" column="apply_index"/>
|
<result property="process" column="process"/>
|
<result property="auditNode" column="audit_node"/>
|
<result property="applyUserId" column="apply_user_id"/>
|
<result property="applyUserName" column="apply_user_name"/>
|
<result property="applyUnitId" column="apply_unit_id"/>
|
<result property="applyUnitName" column="apply_unit_name"/>
|
<result property="applyTime" column="apply_time"/>
|
<result property="firstAuditUnit" column="first_audit_unit"/>
|
<result property="firstAuditUnitName" column="first_audit_unit_name"/>
|
<result property="firstAuditUser" column="first_audit_user"/>
|
<result property="firstAuditUserName" column="first_audit_user_name"/>
|
<result property="firstAuditResult" column="first_audit_result"/>
|
<result property="firstAuditTime" column="first_audit_time"/>
|
<result property="endAuditUnit" column="end_audit_unit"/>
|
<result property="endAuditUnitName" column="end_audit_unit_name"/>
|
<result property="endAuditUser" column="end_audit_user"/>
|
<result property="endAuditUserName" column="end_audit_user_name"/>
|
<result property="endAuditResult" column="end_audit_result"/>
|
<result property="endAuditTime" column="end_audit_time"/>
|
<result property="rmtjStatus" column="rmtj_status"/>
|
<result property="rmtjCaseId" column="rmtj_case_id"/>
|
<result property="rmtjFalseInfo" column="rmtj_false_info"/>
|
<result property="rmtjTime" column="rmtj_time"/>
|
<result property="custId" column="cust_id"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
</resultMap>
|
<!-- 表 -->
|
<sql id='table-name'>dyh_th_rmtj_apply</sql>
|
<!-- 字段 -->
|
<sql id="column-part">
|
id,
|
case_id,
|
apply_index,
|
process,
|
audit_node,
|
apply_user_id,
|
apply_user_name,
|
apply_unit_id,
|
apply_unit_name,
|
apply_time,
|
first_audit_unit,
|
first_audit_unit_name,
|
first_audit_user,
|
first_audit_user_name,
|
first_audit_result,
|
first_audit_time,
|
end_audit_unit,
|
end_audit_unit_name,
|
end_audit_user,
|
end_audit_user_name,
|
end_audit_result,
|
end_audit_time,
|
rmtj_status,
|
rmtj_case_id,
|
rmtj_false_info,
|
rmtj_time,
|
cust_id,
|
create_time,
|
update_time
|
</sql>
|
<!-- 更新实体字段 -->
|
<sql id="set-part">
|
<if test="entity.caseId != null">case_id = #{entity.caseId},</if>
|
<if test="entity.applyIndex != null">apply_index = #{entity.applyIndex},</if>
|
<if test="entity.process != null">process = #{entity.process},</if>
|
<if test="entity.auditNode != null">audit_node = #{entity.auditNode},</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.applyUnitId != null">apply_unit_id = #{entity.applyUnitId},</if>
|
<if test="entity.applyUnitName != null">apply_unit_name = #{entity.applyUnitName},</if>
|
<if test="entity.applyTime != null">apply_time = #{entity.applyTime},</if>
|
<if test="entity.firstAuditUnit != null">first_audit_unit = #{entity.firstAuditUnit},</if>
|
<if test="entity.firstAuditUnitName != null">first_audit_unit_name = #{entity.firstAuditUnitName},</if>
|
<if test="entity.firstAuditUser != null">first_audit_user = #{entity.firstAuditUser},</if>
|
<if test="entity.firstAuditUserName != null">first_audit_user_name = #{entity.firstAuditUserName},</if>
|
<if test="entity.firstAuditResult != null">first_audit_result = #{entity.firstAuditResult},</if>
|
<if test="entity.firstAuditTime != null">first_audit_time = #{entity.firstAuditTime},</if>
|
<if test="entity.endAuditUnit != null">end_audit_unit = #{entity.endAuditUnit},</if>
|
<if test="entity.endAuditUnitName != null">end_audit_unit_name = #{entity.endAuditUnitName},</if>
|
<if test="entity.endAuditUser != null">end_audit_user = #{entity.endAuditUser},</if>
|
<if test="entity.endAuditUserName != null">end_audit_user_name = #{entity.endAuditUserName},</if>
|
<if test="entity.endAuditResult != null">end_audit_result = #{entity.endAuditResult},</if>
|
<if test="entity.endAuditTime != null">end_audit_time = #{entity.endAuditTime},</if>
|
<if test="entity.rmtjStatus != null">rmtj_status = #{entity.rmtjStatus},</if>
|
<if test="entity.rmtjCaseId != null">rmtj_case_id = #{entity.rmtjCaseId},</if>
|
<if test="entity.rmtjFalseInfo != null">rmtj_false_info = #{entity.rmtjFalseInfo},</if>
|
<if test="entity.rmtjTime != null">rmtj_time = #{entity.rmtjTime},</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.applyIndex != null and terms.applyIndex !=''">
|
and apply_index = #{terms.applyIndex}
|
</if>
|
<if test="terms.process != null and terms.process !=''">
|
and process = #{terms.process}
|
</if>
|
<if test="terms.auditNode != null and terms.auditNode !=''">
|
and audit_node = #{terms.auditNode}
|
</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.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.applyTime != null and terms.applyTime !=''">
|
and apply_time = #{terms.applyTime}
|
</if>
|
<if test="terms.firstAuditUnit != null and terms.firstAuditUnit !=''">
|
and first_audit_unit = #{terms.firstAuditUnit}
|
</if>
|
<if test="terms.firstAuditUnitName != null and terms.firstAuditUnitName !=''">
|
and first_audit_unit_name = #{terms.firstAuditUnitName}
|
</if>
|
<if test="terms.firstAuditUser != null and terms.firstAuditUser !=''">
|
and first_audit_user = #{terms.firstAuditUser}
|
</if>
|
<if test="terms.firstAuditUserName != null and terms.firstAuditUserName !=''">
|
and first_audit_user_name = #{terms.firstAuditUserName}
|
</if>
|
<if test="terms.firstAuditResult != null and terms.firstAuditResult !=''">
|
and first_audit_result = #{terms.firstAuditResult}
|
</if>
|
<if test="terms.firstAuditTime != null and terms.firstAuditTime !=''">
|
and first_audit_time = #{terms.firstAuditTime}
|
</if>
|
<if test="terms.endAuditUnit != null and terms.endAuditUnit !=''">
|
and end_audit_unit = #{terms.endAuditUnit}
|
</if>
|
<if test="terms.endAuditUnitName != null and terms.endAuditUnitName !=''">
|
and end_audit_unit_name = #{terms.endAuditUnitName}
|
</if>
|
<if test="terms.endAuditUser != null and terms.endAuditUser !=''">
|
and end_audit_user = #{terms.endAuditUser}
|
</if>
|
<if test="terms.endAuditUserName != null and terms.endAuditUserName !=''">
|
and end_audit_user_name = #{terms.endAuditUserName}
|
</if>
|
<if test="terms.endAuditResult != null and terms.endAuditResult !=''">
|
and end_audit_result = #{terms.endAuditResult}
|
</if>
|
<if test="terms.endAuditTime != null and terms.endAuditTime !=''">
|
and end_audit_time = #{terms.endAuditTime}
|
</if>
|
<if test="terms.rmtjStatus != null and terms.rmtjStatus !=''">
|
and rmtj_status = #{terms.rmtjStatus}
|
</if>
|
<if test="terms.rmtjCaseId != null and terms.rmtjCaseId !=''">
|
and rmtj_case_id = #{terms.rmtjCaseId}
|
</if>
|
<if test="terms.rmtjFalseInfo != null and terms.rmtjFalseInfo !=''">
|
and rmtj_false_info = #{terms.rmtjFalseInfo}
|
</if>
|
<if test="terms.rmtjTime != null and terms.rmtjTime !=''">
|
and rmtj_time = #{terms.rmtjTime}
|
</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="updateThRmtjApply">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<where>
|
id = #{entity.id}
|
</where>
|
</update>
|
<!-- 条件更新对象 -->
|
<update id="updateThRmtjApplyTerms">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<include refid="where-part"/>
|
</update>
|
<!-- 根据编号物理删除 -->
|
<delete id="deleteThRmtjApply">
|
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>
|
|
|
<!-- web端-转入人民调解系统-申请列表-条件 -->
|
<sql id="pageApply-where-part">
|
<if test="terms != null">
|
<if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
|
and (DATE_FORMAT(t2.close_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.closeStart}
|
and DATE_FORMAT(t2.close_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.closeEnd})
|
</if>
|
<if test="terms.applyStart != null and terms.applyStart !='' and terms.applyEnd != null and terms.applyEnd !=''">
|
and (DATE_FORMAT(t3.apply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.applyStart}
|
and DATE_FORMAT(t3.apply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.applyEnd})
|
</if>
|
<if test="terms.rmtjStart != null and terms.rmtjStart !='' and terms.rmtjEnd != null and terms.rmtjEnd !=''">
|
and (DATE_FORMAT(t3.rmtj_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.rmtjStart}
|
and DATE_FORMAT(t3.rmtj_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.rrmtjEnd})
|
</if>
|
<if test="terms.firstAuditResult != null and terms.firstAuditResult !=''">
|
and t3.first_audit_result = #{terms.firstAuditResult}
|
</if>
|
<if test="terms.endAuditResult != null and terms.endAuditResult !=''">
|
and t3.end_audit_result = #{terms.endAuditResult}
|
</if>
|
<if test="terms.rmtjCaseId != null and terms.rmtjCaseId !=''">
|
and t3.rmtj_case_id = #{terms.rmtjCaseId}
|
</if>
|
<if test="terms.rmtjStatus != null and terms.rmtjStatus !=''">
|
and t3.rmtj_status = #{terms.rmtjStatus}
|
</if>
|
<if test="terms.plaintiffs != null and terms.plaintiffs !=''">
|
and concat_ws('', ifnull(t1.plaintiffs, ''), ifnull(t1.pagents, '')) like concat('%', #{terms.plaintiffs}, '%')
|
</if>
|
<if test="terms.defendants != null and terms.defendants !=''">
|
and concat_ws('', ifnull(t1.defendants, ''), ifnull(t1.dagents, '')) like concat('%', #{terms.defendants}, '%')
|
</if>
|
<if test="terms.caseRef != null and terms.caseRef !=''">
|
and t1.case_ref like concat('%', #{terms.caseRef}, '%')
|
</if>
|
<if test="terms.inputWay != null and terms.inputWay !=''">
|
and t1.input_way = #{terms.inputWay}
|
</if>
|
<if test="terms.mediatorId != null and terms.mediatorId !=''">
|
and t2.mediator_id = #{terms.mediatorId}
|
</if>
|
<if test="terms.mediateUnitId != null and terms.mediateUnitId !=''">
|
and t2.mediate_unit_id = #{terms.mediateUnitId}
|
</if>
|
<if test="terms.applyType == 1">
|
and t3.id is null
|
</if>
|
<if test="terms.applyType == 2">
|
and t3.id is not null
|
</if>
|
</if>
|
</sql>
|
<!-- web端-转入人民调解系统-申请列表-查询总数 -->
|
<select id="countPageApply" resultType="java.lang.Long">
|
SELECT
|
count(distinct t1.id)
|
FROM dyh_case_info t1
|
LEFT JOIN dyh_case_info_unfold t2 ON t2.id = t1.id
|
LEFT JOIN dyh_th_rmtj_apply t3 ON t3.case_id = t1.id
|
WHERE t1.delete_Status = 0
|
and t1.info_process = #{terms.infoProcess}
|
<include refid="pageApply-where-part"/>
|
</select>
|
<!-- web端-转入人民调解系统-申请列表-按条件分页查询 -->
|
<select id="pageApply" resultType="cn.huge.module.thirdByRmtj.domain.dto.RmtjApplyPageDTO">
|
SELECT
|
t1.id as caseId, t1.id as taskId, t3.id AS applyId, t1.case_ref as caseRef, t2.close_time as closeTime,
|
t2.medi_result as mediResult, t2.medi_result_name as mediResultName, t2.mediate_unit_name as mediateUnitName,
|
t2.mediator, t1.canal_name as caseSource, t1.case_level as caseLevel,
|
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,
|
t3.apply_time as applyTime, t3.first_audit_result as firstAuditResult,
|
(CASE WHEN t3.first_audit_result = 0 THEN '待审核' WHEN t3.first_audit_result = 1 THEN '同意' WHEN t3.first_audit_result = 2 THEN '未通过' END) AS firstAuditResultName,
|
t3.end_audit_result as endAuditResult,
|
(CASE WHEN t3.end_audit_result = 0 THEN '待审核' WHEN t3.end_audit_result = 1 THEN '同意' WHEN t3.end_audit_result = 2 THEN '未通过' END) AS endAuditResultName,
|
t3.rmtj_status as rmtjStatus,
|
(case WHEN t3.rmtj_status = 1 THEN '未转入' WHEN t3.rmtj_status = 2 THEN '转入中' WHEN t3.rmtj_status = 3 THEN '已转入' WHEN t3.rmtj_status = 4 THEN '转入失败' end) as rmtjStatusName,
|
t3.rmtj_time as rmtjTime, t3.rmtj_case_id as rmtjCaseId
|
FROM dyh_case_info t1
|
LEFT JOIN dyh_case_info_unfold t2 ON t2.id = t1.id
|
LEFT JOIN dyh_th_rmtj_apply t3 ON t3.case_id = t1.id
|
WHERE t1.delete_Status = 0
|
and t1.info_process = #{terms.infoProcess}
|
<include refid="pageApply-where-part"/>
|
group by t1.id
|
<if test="page.sort != null">
|
<foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
|
${s.property} ${s.direction}
|
</foreach>
|
</if>
|
<if test="page.sort == null">
|
order by t1.create_time desc
|
</if>
|
limit #{page.offset}, #{page.size}
|
</select>
|
|
<!-- web端-转入人民调解系统-申请列表统计-条件 -->
|
<sql id="countApply-where-part">
|
<if test="terms != null">
|
<if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
|
and (DATE_FORMAT(t2.close_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.closeStart}
|
and DATE_FORMAT(t2.close_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.closeEnd})
|
</if>
|
<if test="terms.applyStart != null and terms.applyStart !='' and terms.applyEnd != null and terms.applyEnd !=''">
|
and (DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.applyStart}
|
and DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.applyEnd})
|
</if>
|
<if test="terms.rmtjStart != null and terms.rmtjStart !='' and terms.rmtjEnd != null and terms.rmtjEnd !=''">
|
and (DATE_FORMAT(t1.rmtj_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.rmtjStart}
|
and DATE_FORMAT(t1.rmtj_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.rrmtjEnd})
|
</if>
|
<if test="terms.firstAuditResult != null and terms.firstAuditResult !=''">
|
and t1.first_audit_result = #{terms.firstAuditResult}
|
</if>
|
<if test="terms.endAuditResult != null and terms.endAuditResult !=''">
|
and t1.end_audit_result = #{terms.endAuditResult}
|
</if>
|
<if test="terms.rmtjCaseId != null and terms.rmtjCaseId !=''">
|
and t1.rmtj_case_id = #{terms.rmtjCaseId}
|
</if>
|
<if test="terms.rmtjStatus != null and terms.rmtjStatus !=''">
|
and t1.rmtj_status = #{terms.rmtjStatus}
|
</if>
|
<if test="terms.plaintiffs != null and terms.plaintiffs !=''">
|
and concat_ws('', ifnull(t3.plaintiffs, ''), ifnull(t3.pagents, '')) like concat('%', #{terms.plaintiffs}, '%')
|
</if>
|
<if test="terms.defendants != null and terms.defendants !=''">
|
and concat_ws('', ifnull(t3.defendants, ''), ifnull(t3.dagents, '')) like concat('%', #{terms.defendants}, '%')
|
</if>
|
<if test="terms.caseRef != null and terms.caseRef !=''">
|
and t3.case_ref like concat('%', #{terms.caseRef}"%"
|
</if>
|
<if test="terms.inputWay != null and terms.inputWay !=''">
|
and t3.input_way = #{terms.inputWay}
|
</if>
|
<if test="terms.mediatorId != null and terms.mediatorId !=''">
|
and t2.mediator_id = #{terms.mediatorId}
|
</if>
|
<if test="terms.mediateUnitId != null and terms.mediateUnitId !=''">
|
and t2.mediate_unit_id = #{terms.mediateUnitId}
|
</if>
|
</if>
|
</sql>
|
<!-- web端-转入人民调解系统-申请列表统计 -->
|
<select id="countApply" resultType="map">
|
SELECT
|
count(DISTINCT t1.case_id) as applyCount,
|
count(DISTINCT case WHEN t1.rmtj_status = 3 THEN t1.case_id end) as inToCount,
|
count(DISTINCT case WHEN t1.rmtj_status = 2 THEN t1.case_id end) as ingToCount,
|
count(DISTINCT case WHEN t1.rmtj_status in(1, 4) THEN t1.case_id end) as notToCount
|
FROM dyh_th_rmtj_apply t1
|
LEFT JOIN dyh_case_info_unfold t2 ON t2.id = t1.case_id
|
LEFT JOIN dyh_case_info t3 ON t3.id = t1.case_id
|
WHERE t3.delete_Status = 0
|
<include refid="countApply-where-part"/>
|
</select>
|
|
<!-- web端-转入人民调解系统-初审列表-条件 -->
|
<sql id="pageFirstAudit-where-part">
|
<if test="terms != null">
|
<if test="terms.firstAuditStart != null and terms.firstAuditStart !='' and terms.firstAuditEnd != null and terms.firstAuditEnd !=''">
|
and (DATE_FORMAT(t1.first_audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.firstAuditStart}
|
and DATE_FORMAT(t1.first_audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.firstAuditEnd})
|
</if>
|
<if test="terms.applyStart != null and terms.applyStart !='' and terms.applyEnd != null and terms.applyEnd !=''">
|
and (DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.applyStart}
|
and DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.applyEnd})
|
</if>
|
<if test="terms.rmtjStart != null and terms.rmtjStart !='' and terms.rmtjEnd != null and terms.rmtjEnd !=''">
|
and (DATE_FORMAT(t1.rmtj_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.rmtjStart}
|
and DATE_FORMAT(t1.rmtj_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.rrmtjEnd})
|
</if>
|
<if test="terms.firstAuditResult != null and terms.firstAuditResult !=''">
|
and t1.first_audit_result = #{terms.firstAuditResult}
|
</if>
|
<if test="terms.endAuditResult != null and terms.endAuditResult !=''">
|
and t1.end_audit_result = #{terms.endAuditResult}
|
</if>
|
<if test="terms.rmtjCaseId != null and terms.rmtjCaseId !=''">
|
and t1.rmtj_case_id = #{terms.rmtjCaseId}
|
</if>
|
<if test="terms.rmtjStatus != null and terms.rmtjStatus !=''">
|
and t1.rmtj_status = #{terms.rmtjStatus}
|
</if>
|
<if test="terms.plaintiffs != null and terms.plaintiffs !=''">
|
and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) like concat('%', #{terms.plaintiffs}, '%')
|
</if>
|
<if test="terms.defendants != null and terms.defendants !=''">
|
and concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.defendants}, '%')
|
</if>
|
<if test="terms.caseRef != null and terms.caseRef !=''">
|
and t2.case_ref like concat('%', #{terms.caseRef}, '%')
|
</if>
|
<if test="terms.inputWay != null and terms.inputWay !=''">
|
and t2.input_way = #{terms.inputWay}
|
</if>
|
<if test="terms.firstAuditUnit != null and terms.firstAuditUnit !=''">
|
and t1.first_audit_unit = #{terms.firstAuditUnit}
|
</if>
|
<if test="terms.mediateUnitId != null and terms.mediateUnitId !=''">
|
and t3.mediate_unit_id = #{terms.mediateUnitId}
|
</if>
|
<if test="terms.mediateUnitIds != null and terms.mediateUnitIds.size > 0">
|
and t3.mediate_unit_id in
|
<foreach collection="terms.mediateUnitIds" item="mediateUnitId" index="index" open="(" separator="," close=")">
|
#{mediateUnitId}
|
</foreach>
|
</if>
|
<if test="terms.auditType == 1">
|
and t1.first_audit_result = 0
|
and t1.process = 1
|
</if>
|
<if test="terms.auditType == 2">
|
and t1.first_audit_result != 0
|
and t1.process != 1
|
</if>
|
</if>
|
</sql>
|
<!-- web端-转入人民调解系统-初审列表-查询总数 -->
|
<select id="countPageFirstAudit" resultType="java.lang.Long">
|
SELECT
|
count(t1.id)
|
FROM dyh_th_rmtj_apply t1
|
LEFT JOIN dyh_case_info t2 ON t2.id = t1.case_id
|
LEFT JOIN dyh_case_info_unfold t3 ON t3.id = t1.case_id
|
WHERE t2.delete_Status = 0
|
<include refid="pageFirstAudit-where-part"/>
|
</select>
|
<!-- web端-转入人民调解系统-初审列表-按条件分页查询 -->
|
<select id="pageFirstAudit" resultType="cn.huge.module.thirdByRmtj.domain.dto.RmtjAuditPageDTO">
|
SELECT
|
t2.id as caseId, t2.id as taskId, t1.id AS applyId, t1.apply_time as applyTime, t2.case_ref as caseRef,
|
t3.medi_result as mediResult, t3.medi_result_name as mediResultName, t3.mediate_unit_name as mediateUnitName,
|
t3.mediator, t2.canal_name as caseSource, t2.case_level as caseLevel,
|
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,
|
t1.first_audit_time as firstAuditTime, t1.first_audit_result as firstAuditResult,
|
(CASE WHEN t1.first_audit_result = 0 THEN '待审核' WHEN t1.first_audit_result = 1 THEN '同意' WHEN t1.first_audit_result = 2 THEN '未通过' END) AS firstAuditResultName,
|
t1.end_audit_time as endAuditTime, t1.end_audit_result as endAuditResult,
|
(CASE WHEN t1.end_audit_result = 0 THEN '待审核' WHEN t1.end_audit_result = 1 THEN '同意' WHEN t1.end_audit_result = 2 THEN '未通过' END) AS endAuditResultName,
|
t1.rmtj_status as rmtjStatus,
|
(case WHEN t1.rmtj_status = 1 THEN '未转入' WHEN t1.rmtj_status = 2 THEN '转入中' WHEN t1.rmtj_status = 3 THEN '已转入' WHEN t1.rmtj_status = 4 THEN '转入失败' end) as rmtjStatusName,
|
t1.rmtj_time as rmtjTime, t1.rmtj_case_id as rmtjCaseId
|
FROM dyh_th_rmtj_apply t1
|
LEFT JOIN dyh_case_info t2 ON t2.id = t1.case_id
|
LEFT JOIN dyh_case_info_unfold t3 ON t3.id = t1.case_id
|
WHERE t2.delete_Status = 0
|
<include refid="pageFirstAudit-where-part"/>
|
<if test="page.sort != null">
|
<foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
|
${s.property} ${s.direction}
|
</foreach>
|
</if>
|
<if test="page.sort == null">
|
order by t1.create_time desc
|
</if>
|
limit #{page.offset}, #{page.size}
|
</select>
|
|
|
|
<!-- web端-转入人民调解系统-终审列表-条件 -->
|
<sql id="pageEndAudit-where-part">
|
<if test="terms != null">
|
<if test="terms.firstAuditStart != null and terms.firstAuditStart !='' and terms.firstAuditEnd != null and terms.firstAuditEnd !=''">
|
and (DATE_FORMAT(t1.first_audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.firstAuditStart}
|
and DATE_FORMAT(t1.first_audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.firstAuditEnd})
|
</if>
|
<if test="terms.applyStart != null and terms.applyStart !='' and terms.applyEnd != null and terms.applyEnd !=''">
|
and (DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.applyStart}
|
and DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.applyEnd})
|
</if>
|
<if test="terms.rmtjStart != null and terms.rmtjStart !='' and terms.rmtjEnd != null and terms.rmtjEnd !=''">
|
and (DATE_FORMAT(t1.rmtj_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.rmtjStart}
|
and DATE_FORMAT(t1.rmtj_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.rrmtjEnd})
|
</if>
|
<if test="terms.firstAuditResult != null and terms.firstAuditResult !=''">
|
and t1.first_audit_result = #{terms.firstAuditResult}
|
</if>
|
<if test="terms.endAuditResult != null and terms.endAuditResult !=''">
|
and t1.end_audit_result = #{terms.endAuditResult}
|
</if>
|
<if test="terms.rmtjCaseId != null and terms.rmtjCaseId !=''">
|
and t1.rmtj_case_id = #{terms.rmtjCaseId}
|
</if>
|
<if test="terms.rmtjStatus != null and terms.rmtjStatus !=''">
|
and t1.rmtj_status = #{terms.rmtjStatus}
|
</if>
|
<if test="terms.plaintiffs != null and terms.plaintiffs !=''">
|
and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) like concat('%', #{terms.plaintiffs}, '%')
|
</if>
|
<if test="terms.defendants != null and terms.defendants !=''">
|
and concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.defendants}, '%')
|
</if>
|
<if test="terms.caseRef != null and terms.caseRef !=''">
|
and t2.case_ref like concat('%', #{terms.caseRef}, '%')
|
</if>
|
<if test="terms.inputWay != null and terms.inputWay !=''">
|
and t2.input_way = #{terms.inputWay}
|
</if>
|
<if test="terms.endAuditUnit != null and terms.endAuditUnit !=''">
|
and t1.end_audit_unit = #{terms.endAuditUnit}
|
</if>
|
<if test="terms.mediateUnitId != null and terms.mediateUnitId !=''">
|
and t3.mediate_unit_id = #{terms.mediateUnitId}
|
</if>
|
<if test="terms.mediateUnitIds != null and terms.mediateUnitIds.size > 0">
|
and t3.mediate_unit_id in
|
<foreach collection="terms.mediateUnitIds" item="mediateUnitId" index="index" open="(" separator="," close=")">
|
#{mediateUnitId}
|
</foreach>
|
</if>
|
<if test="terms.auditType == 1">
|
and t1.end_audit_result = 0
|
and t1.process = 2
|
</if>
|
<if test="terms.auditType == 2">
|
and t1.end_audit_result != 0
|
and t1.process in (3, 4, 9)
|
</if>
|
</if>
|
</sql>
|
<!-- web端-转入人民调解系统-终审列表-查询总数 -->
|
<select id="countPageEndAudit" resultType="java.lang.Long">
|
SELECT
|
count(t1.id)
|
FROM dyh_th_rmtj_apply t1
|
LEFT JOIN dyh_case_info t2 ON t2.id = t1.case_id
|
LEFT JOIN dyh_case_info_unfold t3 ON t3.id = t1.case_id
|
WHERE t2.delete_Status = 0
|
<include refid="pageEndAudit-where-part"/>
|
</select>
|
<!-- web端-转入人民调解系统-终审列表-按条件分页查询 -->
|
<select id="pageEndAudit" resultType="cn.huge.module.thirdByRmtj.domain.dto.RmtjAuditPageDTO">
|
SELECT
|
t2.id as caseId, t2.id as taskId, t1.id AS applyId, t2.case_ref as caseRef,
|
t3.medi_result as mediResult, t3.medi_result_name as mediResultName, t3.mediate_unit_name as mediateUnitName,
|
t3.mediator, t2.canal_name as caseSource, t2.case_level as caseLevel,
|
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,
|
t1.first_audit_time as applyTime, t1.first_audit_result as firstAuditResult,
|
(CASE WHEN t1.first_audit_result = 0 THEN '待审核' WHEN t1.first_audit_result = 1 THEN '同意' WHEN t1.first_audit_result = 2 THEN '未通过' END) AS firstAuditResultName,
|
t1.end_audit_time as endAuditTime, t1.end_audit_result as endAuditResult,
|
(CASE WHEN t1.end_audit_result = 0 THEN '待审核' WHEN t1.end_audit_result = 1 THEN '同意' WHEN t1.end_audit_result = 2 THEN '未通过' END) AS endAuditResultName,
|
t1.rmtj_status as rmtjStatus,
|
(case WHEN t1.rmtj_status = 1 THEN '未转入' WHEN t1.rmtj_status = 2 THEN '转入中' WHEN t1.rmtj_status = 3 THEN '已转入市人民调解系统' WHEN t1.rmtj_status = 4 THEN '转入失败' end) as rmtjStatusName,
|
t1.rmtj_time as rmtjTime, t1.rmtj_case_id as rmtjCaseId
|
FROM dyh_th_rmtj_apply t1
|
LEFT JOIN dyh_case_info t2 ON t2.id = t1.case_id
|
LEFT JOIN dyh_case_info_unfold t3 ON t3.id = t1.case_id
|
WHERE t2.delete_Status = 0
|
<include refid="pageEndAudit-where-part"/>
|
<if test="page.sort != null">
|
<foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
|
${s.property} ${s.direction}
|
</foreach>
|
</if>
|
<if test="page.sort == null">
|
order by t1.create_time desc
|
</if>
|
limit #{page.offset}, #{page.size}
|
</select>
|
|
<!-- 查询某一单位的所有管辖单位id,包括自己 -->
|
<select id="listAllUnitId" resultType="java.lang.String">
|
SELECT id
|
FROM dyh_ct_unit
|
START WITH id = #{parentId}
|
CONNECT BY PRIOR id = parent_id
|
</select>
|
|
</mapper>
|