| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- <?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">
- <mapper namespace="com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseApplicationMapper">
- <resultMap id="BaseResultMap" type="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication">
- <!--
- WARNING - @mbg.generated
- -->
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="batch_number" jdbcType="INTEGER" property="batchNumber" />
- <result column="template_id" jdbcType="BIGINT" property="templateId" />
- <result column="case_num" jdbcType="VARCHAR" property="caseNum" />
- <result column="case_subject_amount" jdbcType="DECIMAL" property="caseSubjectAmount" />
- <result column="mediation_method" jdbcType="CHAR" property="mediationMethod" />
- <result column="case_status_name" jdbcType="VARCHAR" property="caseStatusName" />
- <result column="case_flow_id" jdbcType="BIGINT" property="caseFlowId" />
- <result column="hear_date" jdbcType="TIMESTAMP" property="hearDate" />
- <result column="fee_payable" jdbcType="DECIMAL" property="feePayable" />
- <result column="mediator_id" jdbcType="BIGINT" property="mediatorId" />
- <result column="mediator_name" jdbcType="VARCHAR" property="mediatorName" />
- <result column="pay_type" jdbcType="CHAR" property="payType" />
- <result column="is_absence" jdbcType="INTEGER" property="isAbsence" />
- <result column="lock_status" jdbcType="INTEGER" property="lockStatus" />
- <result column="room_id" jdbcType="VARCHAR" property="roomId" />
- <result column="appli_iswrit_hear" jdbcType="INTEGER" property="appliIswritHear" />
- <result column="respon_isWrit_hear" jdbcType="INTEGER" property="responIswritHear" />
- <result column="create_by" jdbcType="VARCHAR" property="createBy" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
- <result column="version" jdbcType="INTEGER" property="version" />
- <result column="arbitrat_claims" jdbcType="LONGVARCHAR" property="arbitratClaims" />
- <result column="facts" jdbcType="LONGVARCHAR" property="facts" />
- <result column="mediation_url" jdbcType="LONGVARCHAR" property="mediationUrl" />
- <result column="mediation_agreement" jdbcType="LONGVARCHAR" property="mediationAgreement" />
- <result column="is_reconci" jdbcType="INTEGER" property="isReconci" />
- </resultMap>
- <sql id="SELECT_LIST_QUERY">
- FROM
- ms_case_application c
- JOIN ms_case_affiliate a ON c.id = a.case_appli_id
- LEFT JOIN ms_sys_user u ON u.user_id = a.user_id
- LEFT JOIN ms_sys_user u1 ON u1.user_id = c.mediator_id
- LEFT JOIN ms_sys_user_role ur ON u.user_id = ur.user_id or u1.user_id = ur.user_id
- LEFT JOIN ms_sys_role r ON r.role_id = ur.role_id or r.role_id = ur.role_id
- LEFT JOIN ms_sys_dept d ON d.dept_id = a.applicant_dept_id
- <where>
- <!-- 调解员角色和申请人,被申,代理人-->
- <if test = 'req.mediatorId != null and req.userId!=null'>
- AND (c.mediator_id = #{req.mediatorId} or a.user_id=#{req.userId})
- </if>
- <!-- admin,财务,顾问,部门长查看所有案件,申请人,被申,代理人根据userId查-->
- <if test = 'req.mediatorId == null and req.userId != null'>
- AND (a.user_id=#{req.userId} )
- </if>
- <!-- 根据角色查询-->
- <if test='roleIds != null and roleIds.size() > 0 '>
- and r.role_id in
- <foreach item='roleId' index='index' collection='roleIds' open='(' separator=',' close=')'>
- #{roleId}
- </foreach>
- </if>
- <!-- 角色相关的状态-->
- <if test='caseFlowIds != null and caseFlowIds.size() > 0 '>
- and c.case_flow_id in
- <foreach item='flowId' index='index' collection='caseFlowIds' open='(' separator=',' close=')'>
- #{flowId}
- </foreach>
- </if>
- <!-- 案件状态id条件-->
- <if test = 'req.caseFlowId != null'>
- AND c.case_flow_id = #{req.caseFlowId}
- </if>
- <if test = 'req.caseId != null'>
- AND c.id = #{req.caseId}
- </if>
- <!-- 案件编号-->
- <if test = 'req.caseNum != null and req.caseNum != "" '>
- AND c.case_num = #{req.caseNum}
- </if>
- <!-- 时间-->
- <if test = 'req.startTime != null and req.startTime != "" '>
- and c.create_time >= #{req.startTime}
- </if>
- <if test = 'req.endTime != null and req.endTime != "" '>
- and c.create_time <= #{req.endTime}
- </if>
- </where>
-
- </sql>
- <select id="listMediator" resultMap="BaseResultMap">
- select mediator_id ,id ,case_status_name,case_flow_id from ms_case_application <where>
- <if test = 'userIds!=null and userIds.size()>0'>
- and mediator_id in
- <foreach item='item' index='index' collection='userIds' open='(' separator=',' close=')'>
- #{item}
- </foreach>
- </if>
- <!-- <if test = 'recordCaeIdList!=null and recordCaeIdList.size()>0'> and id not in
- <foreach item='id' index='index' collection='recordCaeIdList' open='(' separator=',' close=')'>
- #{id}
- </foreach>
- </if> -->
- </where>
- </select>
-
-
-
- <select id="todoCount" resultType="com.ruoyi.wisdomarbitrate.domain.vo.mscase.CaseToDoCount">
- SELECT c.case_flow_id caseFlowId,count(DISTINCT c.id) caseCount
- <include refid="SELECT_LIST_QUERY"/>
- group by c.case_flow_id
- </select>
- <select id="list" resultType="com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO">
- select t.* from(
- SELECT
- c.id,c.mediator_id mediatorId,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,0 AS pendingStatus,
- c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,
- u1.nick_name mediatorName,c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime,
- c.mediation_method mediationMethod,
- CASE c.mediation_method when 1 then '线上调解' when 2 then '线下调解' ELSE '' END mediationMethodName
- <include refid="SELECT_LIST_QUERY"/>
- GROUP BY
- c.id
- union
- SELECT
- c.id,c.mediator_id mediatorId,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,1 AS pendingStatus,
- c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,
- u1.nick_name mediatorName,c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime,
- c.mediation_method mediationMethod,
- CASE c.mediation_method when 1 then '线上调解' when 2 then '线下调解' ELSE '' END mediationMethodName
- FROM
- ms_case_log_record r
- join ms_case_application c on r.case_appli_id=c.id
- JOIN ms_case_affiliate a ON c.id = a.case_appli_id
- LEFT JOIN ms_sys_user u ON u.user_id = a.user_id
- LEFT JOIN ms_sys_user u1 ON u1.user_id = c.mediator_id
- LEFT JOIN ms_sys_dept d ON d.dept_id = a.applicant_dept_id
- <where>
- r.create_by=#{req.userName} and c.id not in ( SELECT c.id
- <include refid="SELECT_LIST_QUERY"/>
- )
-
- <!-- 案件状态id条件-->
- <if test = 'req.caseFlowId != null'>
- AND c.case_flow_id = #{req.caseFlowId}
- </if>
- <if test = 'req.caseId != null'>
- AND c.id = #{req.caseId}
- </if>
- <!-- 案件编号-->
- <if test = 'req.caseNum != null and req.caseNum != "" '>
- AND c.case_num = #{req.caseNum}
- </if>
- <!-- 时间-->
- <if test = 'req.startTime != null and req.startTime != "" '>
- and c.create_time >= #{req.startTime}
- </if>
- <if test = 'req.endTime != null and req.endTime != "" '>
- and c.create_time <= #{req.endTime}
- </if>
-
- </where>
- GROUP BY
- c.id
- ) t ORDER BY t.createTime desc,t.caseNum desc
-
- </select>
- <select id="countCasePerson" resultType="java.lang.Long">
- select c.id from ms_case_application c where c.mediator_id
- in
- <foreach collection="userIds" item="userId" open="(" separator="," close=")">
- #{userId}
- </foreach>
- union ALL
- select a.id from ms_case_affiliate a where a.user_id
- in
- <foreach collection="userIds" item="userId" open="(" separator="," close=")">
- #{userId}
- </foreach>
- union all
- SELECT id from ms_dept_identify where user_id
- in
- <foreach collection="userIds" item="userId" open="(" separator="," close=")">
- #{userId}
- </foreach>
- </select>
- <select id="selectCaseByDeptId" resultType="java.lang.Long">
- select a.id from ms_case_affiliate a where a.applicant_dept_id=#{deptId}
- union all
- SELECT id from ms_dept_identify where dept_id=#{deptId}
- </select>
- </mapper>
|