智能仲裁后端服务

CaseApplicationMapper.xml 68KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper">
  6. <resultMap type="com.ruoyi.wisdomarbitrate.domain.CaseApplication" id="CaseApplicationResult">
  7. <id property="id" column="id"/>
  8. <result property="caseNum" column="case_num"/>
  9. <result property="caseName" column="case_name"/>
  10. <result property="caseSubjectAmount" column="case_subject_amount"/>
  11. <result property="registerDate" column="register_date"/>
  12. <result property="arbitratMethod" column="arbitrat_method"/>
  13. <result property="caseStatus" column="case_status"/>
  14. <result property="hearDate" column="hear_date"/>
  15. <result property="arbitratClaims" column="arbitrat_claims"/>
  16. <result property="loanStartDate" column="loan_start_date"/>
  17. <result property="loanEndDate" column="loan_end_date"/>
  18. <result property="claimPrinciOwed" column="claim_princi_owed"/>
  19. <result property="claimInterestOwed" column="claim_interest_owed"/>
  20. <result property="claimLiquidDamag" column="claim_liquid_damag"/>
  21. <result property="feePayable" column="fee_payable"/>
  22. <result property="beginVideoDate" column="begin_video_date"/>
  23. <result property="onlineVideoPerson" column="online_video_person"/>
  24. <result property="contractNumber" column="contract_number"/>
  25. <result property="caseStatusName" column="caseStatusName"/>
  26. <result property="createBy" column="create_by"/>
  27. <result property="createTime" column="create_time"/>
  28. <result property="updateBy" column="update_by"/>
  29. <result property="updateTime" column="update_time"/>
  30. <result property="arbitratMethodName" column="arbitratMethodName"/>
  31. <result property="applicantIsWrittenHear" column="appli_iswrit_hear"/>
  32. <result property="respondentIsWrittenHear" column="respon_isWrit_hear"/>
  33. <result property="isAbsence" column="is_absence"/>
  34. <result property="responCrossOpin" column="respon_cross_opin"/>
  35. <result property="applicaCrossOpin" column="applica_cross_opin"/>
  36. <result property="responDefenOpini" column="respon_defen_opini"/>
  37. <result property="arbitratorId" column="arbitrator_id"/>
  38. <result property="arbitratorName" column="arbitrator_name"/>
  39. <result property="paymentStatus" column="payment_status"/>
  40. <result property="paymentStatusName" column="paymentStatusName"/>
  41. <result property="filearbitraUrl" column="filearbitra_url"/>
  42. <result property="requestRule" column="request_rule"/>
  43. <result property="properPreser" column="proper_preser"/>
  44. <result property="adjudicaCounter" column="adjudica_counter"/>
  45. <result property="lockStatus" column="lock_status"/>
  46. <result property="facts" column="facts"/>
  47. <result property="batchNumber" column="batch_number"/>
  48. <result property="mediationAgreement" column="mediation_agreement"/>
  49. <result property="identityType" column="identity_type"/>
  50. <result property="name" column="name"/>
  51. </resultMap>
  52. <select id="selectCaseApplicationList" parameterType="com.ruoyi.wisdomarbitrate.domain.CaseApplication" resultMap="CaseApplicationResult">
  53. select DISTINCT(t1.id),t1.caseLogId,t1.case_num,t1.case_subject_amount,t1.register_date,t1.arbitrat_method,
  54. t1.arbitratMethodName,t1.case_status,t1.caseStatusName,t1.hear_date,t1.arbitrat_claims,
  55. t1.loan_start_date,t1.loan_end_date,t1.claim_princi_owed,t1.claim_interest_owed,t1.claim_liquid_damag,t1.fee_payable,
  56. t1.begin_video_date,t1.online_video_person,t1.contract_number,t1.create_by,t1.create_time,t1.appli_iswrit_hear,t1.respon_isWrit_hear,t1.update_by,t1.update_time,
  57. t1.arbitrator_name,t1.name,t1.application_organ_id,t1.applicantName,t1.arbitrator_id,t1.identity_num,t1.identity_type,
  58. t1.filearbitra_url,t1.lock_status,t1.version,t1.updateSubmitStatus,t1.batch_number,t1.pendingStatus
  59. from(
  60. <trim suffixOverrides="union">
  61. <!--被申请人,仲裁员,部门长,财务,代理人案件-->
  62. <if test="isOtherRole!=null and isOtherRole==1">
  63. select c.id ,'' AS caseLogId,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method ,
  64. CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
  65. ELSE '无审理方式'
  66. END arbitratMethodName,
  67. c.case_status ,
  68. CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
  69. when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
  70. when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
  71. when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
  72. when 12 then '待部门长审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'
  73. when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'
  74. when 18 then '待仲裁员审核仲裁文书'
  75. when 31 then '待修改开庭时间'
  76. ELSE '无案件状态'
  77. END caseStatusName,
  78. c.hear_date ,c.arbitrat_claims ,
  79. c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag
  80. ,c.fee_payable ,c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by
  81. ,c.create_time,c.appli_iswrit_hear,c.respon_isWrit_hear,
  82. c.update_by ,c.update_time , c.arbitrator_name,ca.name,ca.application_organ_id,ca.application_organ_name
  83. as applicantName,
  84. c.arbitrator_id,ca.identity_num ,ca.identity_type,c.filearbitra_url,c.lock_status,c.version,null as
  85. updateSubmitStatus,c.batch_number,0 as pendingStatus
  86. from case_application c
  87. JOIN case_affiliate ca ON ca.case_appli_id = c.id
  88. <where>
  89. <!--根据角色和状态过滤-->
  90. <!--被申请人-->
  91. <if test="idCard != null and idCard != ''">
  92. or (ca.identity_num=#{idCard} AND ca.identity_type=2
  93. and (c.case_status=4 or c.case_status=17)
  94. )
  95. </if>
  96. <!--仲裁员-->
  97. <if test="userId != null and userId != ''">
  98. or ( ca.identity_type=1 and
  99. c.case_status in (7,13,17,18)
  100. and
  101. instr (c.arbitrator_id,#{userId})>0)
  102. </if>
  103. <!--部门长-->
  104. <if test="deptHeadStatus != null and deptHeadStatus.size() > 0">
  105. or (ca.identity_type=1)
  106. </if>
  107. <!--财务-->
  108. <if test="financeStatus != null and financeStatus != ''">
  109. or (ca.identity_type=1
  110. and c.case_status =#{financeStatus}
  111. )
  112. </if>
  113. <!--代理人-->
  114. <if test="agentDeptIds != null and agentDeptIds.size()>0">
  115. or (
  116. ca.application_organ_id in
  117. <foreach item="deptId" collection="agentDeptIds" open="(" separator="," close=")">#{deptId}
  118. </foreach>
  119. AND ca.identity_type=1
  120. and c.case_status in (0,9)
  121. )
  122. </if>
  123. </where>
  124. union
  125. </if>
  126. <if test="applicationOrganId != null and applicationOrganId != ''">
  127. <!--申请人案件-->
  128. select c.id ,'' AS caseLogId,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method ,
  129. CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
  130. ELSE '无审理方式'
  131. END arbitratMethodName,
  132. c.case_status ,
  133. CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
  134. when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
  135. when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
  136. when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
  137. when 12 then '待部门长审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'
  138. when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'
  139. when 18 then '待仲裁员审核仲裁文书'
  140. when 31 then '待修改开庭时间'
  141. ELSE '无案件状态'
  142. END caseStatusName,
  143. c.hear_date ,c.arbitrat_claims ,
  144. c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag
  145. ,c.fee_payable ,
  146. c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time ,c.appli_iswrit_hear,c.respon_isWrit_hear,
  147. c.update_by ,c.update_time , c.arbitrator_name,ca.name,ca.application_organ_id,ca.application_organ_name
  148. as
  149. applicantName,
  150. c.arbitrator_id,ca.identity_num , ca.identity_type,c.filearbitra_url,c.lock_status,(select version from
  151. case_application_log where case_appli_id=c.id order by version desc limit 1) as version,(select
  152. update_submit_status from case_application_log where case_appli_id=c.id order by version desc limit 1)
  153. as updateSubmitStatus,c.batch_number,0 as pendingStatus
  154. from case_application c
  155. JOIN case_affiliate ca ON ca.case_appli_id =c.id AND ca.identity_type = 1
  156. <where>
  157. (c.case_status &lt;= 10 or c.case_status=31) AND
  158. ca.identity_type=1
  159. <if test="applicationOrganId != null and applicationOrganId != ''">
  160. AND ca.application_organ_id = #{applicationOrganId}
  161. </if>
  162. </where>
  163. union
  164. </if>
  165. <!--秘书案件-->
  166. <if test="deptIds != null and deptIds.size() > 0">
  167. <!--秘书主表案件-->
  168. SELECT
  169. c.id,
  170. '' AS caseLogId,
  171. c.case_num,
  172. c.case_subject_amount,
  173. c.register_date,
  174. c.arbitrat_method,
  175. CASE
  176. c.arbitrat_method
  177. WHEN 1 THEN
  178. '开庭审理'
  179. WHEN 2 THEN
  180. '书面审理' ELSE '无审理方式'
  181. END arbitratMethodName,
  182. c.case_status,
  183. CASE
  184. c.case_status
  185. when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
  186. when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
  187. when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
  188. when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
  189. when 12 then '待部门长审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'
  190. when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'
  191. when 18 then '待仲裁员审核仲裁文书'
  192. when 31 then '待修改开庭时间' ELSE '无案件状态'
  193. END caseStatusName,
  194. c.hear_date,
  195. c.arbitrat_claims,
  196. c.loan_start_date,
  197. c.loan_end_date,
  198. c.claim_princi_owed,
  199. c.claim_interest_owed,
  200. c.claim_liquid_damag,
  201. c.fee_payable,
  202. c.begin_video_date,
  203. c.online_video_person,
  204. c.contract_number,
  205. c.create_by,
  206. c.create_time,c.appli_iswrit_hear,c.respon_isWrit_hear,
  207. c.update_by,
  208. c.update_time,
  209. c.arbitrator_name,
  210. ca.name,
  211. ca.application_organ_id ,
  212. ca.application_organ_name AS applicantName,
  213. c.arbitrator_id,ca.identity_num ,ca.identity_type,
  214. c.filearbitra_url,
  215. c.lock_status,c.version,
  216. null as updateSubmitStatus,
  217. c.batch_number,0 as pendingStatus
  218. FROM
  219. case_application c
  220. JOIN case_affiliate ca ON ca.case_appli_id = c.id AND ca.identity_type = 1
  221. JOIN case_application_log l on l.case_appli_id=c.id and l.update_submit_status not in(1, 2) and
  222. l.version
  223. = (
  224. SELECT
  225. max( version ) version
  226. FROM
  227. case_application_log
  228. WHERE case_appli_id = c.id
  229. )
  230. WHERE
  231. ca.identity_type=1
  232. and c.case_status in (1,5,8,9,11,14,15,16,17,31)
  233. union
  234. <!--秘书审核案件-->
  235. SELECT
  236. l.case_appli_id id,
  237. l.id AS caseLogId,
  238. c.case_num,
  239. c.case_subject_amount,
  240. c.register_date,
  241. c.arbitrat_method,
  242. CASE
  243. c.arbitrat_method
  244. WHEN 1 THEN
  245. '开庭审理'
  246. WHEN 2 THEN
  247. '书面审理' ELSE '无审理方式'
  248. END arbitratMethodName,
  249. c.case_status,
  250. CASE
  251. c.case_status
  252. when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
  253. when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
  254. when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
  255. when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
  256. when 12 then '待部门长审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'
  257. when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'
  258. when 18 then '待仲裁员审核仲裁文书'
  259. when 31 then '待修改开庭时间' ELSE '无案件状态'
  260. END caseStatusName,
  261. c.hear_date,
  262. c.arbitrat_claims,
  263. c.loan_start_date,
  264. c.loan_end_date,
  265. c.claim_princi_owed,
  266. c.claim_interest_owed,
  267. c.claim_liquid_damag,
  268. c.fee_payable,
  269. c.begin_video_date,
  270. c.online_video_person,
  271. c.contract_number,
  272. c.create_by,
  273. c.create_time,c.appli_iswrit_hear,c.respon_isWrit_hear,
  274. c.update_by,
  275. c.update_time,
  276. c.arbitrator_name,
  277. ca.name,
  278. ca.application_organ_id ,
  279. ca.application_organ_name AS applicantName,
  280. c.arbitrator_id,ca.identity_num ,ca.identity_type,
  281. c.filearbitra_url,c.lock_status,l.version,l.update_submit_status as updateSubmitStatus,c.batch_number,0 as pendingStatus
  282. FROM
  283. case_application c
  284. JOIN case_application_log l ON c.id = l.case_appli_id
  285. JOIN case_affiliate_log ca ON ca.case_appli_log_id = l.id
  286. AND ca.identity_type = 1
  287. WHERE
  288. l.update_submit_status IN ( 1, 2 ) and ca.identity_type=1
  289. <!-- 查询该案件的最新记录 -->
  290. AND l.version = (
  291. SELECT
  292. max( version ) version
  293. FROM
  294. case_application_log
  295. WHERE
  296. c.id = case_appli_id)
  297. union
  298. </if>
  299. <!-- 已办案件 -->
  300. <if test="loginUserName != null and loginUserName != ''">
  301. SELECT
  302. c.id,
  303. '' AS caseLogId,
  304. c.case_num,
  305. c.case_subject_amount,
  306. c.register_date,
  307. c.arbitrat_method,
  308. CASE
  309. c.arbitrat_method
  310. WHEN 1 THEN
  311. '开庭审理'
  312. WHEN 2 THEN
  313. '书面审理' ELSE '无审理方式'
  314. END arbitratMethodName,
  315. c.case_status,
  316. CASE
  317. c.case_status
  318. when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
  319. when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
  320. when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
  321. when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
  322. when 12 then '待部门长审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'
  323. when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'
  324. when 18 then '待仲裁员审核仲裁文书'
  325. when 31 then '待修改开庭时间' ELSE '无案件状态'
  326. END caseStatusName,
  327. c.hear_date,
  328. c.arbitrat_claims,
  329. c.loan_start_date,
  330. c.loan_end_date,
  331. c.claim_princi_owed,
  332. c.claim_interest_owed,
  333. c.claim_liquid_damag,
  334. c.fee_payable,
  335. c.begin_video_date,
  336. c.online_video_person,
  337. c.contract_number,
  338. c.create_by,
  339. c.create_time,c.appli_iswrit_hear,c.respon_isWrit_hear,
  340. c.update_by,
  341. c.update_time,
  342. c.arbitrator_name,
  343. ca.name,
  344. ca.application_organ_id ,
  345. ca.application_organ_name AS applicantName,
  346. c.arbitrator_id,ca.identity_num ,ca.identity_type,
  347. c.filearbitra_url,
  348. c.lock_status,c.version,
  349. null as updateSubmitStatus,
  350. c.batch_number,1 as pendingStatus
  351. from case_log_record r
  352. join case_application c on r.case_appli_id=c.id and r.case_node!=c.case_status
  353. JOIN case_affiliate ca ON ca.case_appli_id = c.id AND ca.identity_type=1
  354. WHERE
  355. r.create_by=#{loginUserName} AND ca.identity_type=1
  356. and c.id not in(
  357. <trim suffixOverrides="union">
  358. <!--被申请人,仲裁员,部门长,财务,代理人案件-->
  359. <if test="isOtherRole!=null and isOtherRole==1">
  360. select c.id
  361. from case_application c
  362. JOIN case_affiliate ca ON ca.case_appli_id = c.id
  363. <where>
  364. <!--根据角色和状态过滤-->
  365. <!--被申请人-->
  366. <if test="idCard != null and idCard != ''">
  367. or (ca.identity_num=#{idCard} AND ca.identity_type=2
  368. and (c.case_status=4 or c.case_status=17)
  369. )
  370. </if>
  371. <!--仲裁员-->
  372. <if test="userId != null and userId != ''">
  373. or ( ca.identity_type=1 and
  374. c.case_status in (7,13,17,18)
  375. and
  376. instr (c.arbitrator_id,#{userId})>0)
  377. </if>
  378. <!--部门长-->
  379. <if test="deptHeadStatus != null and deptHeadStatus.size() > 0">
  380. or (ca.identity_type=1)
  381. </if>
  382. <!--财务-->
  383. <if test="financeStatus != null and financeStatus != ''">
  384. or (ca.identity_type=1
  385. and c.case_status =#{financeStatus}
  386. )
  387. </if>
  388. <!--代理人-->
  389. <if test="agentDeptIds != null and agentDeptIds.size()>0">
  390. or (
  391. ca.application_organ_id in
  392. <foreach item="deptId" collection="agentDeptIds" open="(" separator="," close=")">#{deptId}
  393. </foreach>
  394. AND ca.identity_type=1
  395. and c.case_status in (0,9)
  396. )
  397. </if>
  398. </where>
  399. union
  400. </if>
  401. <if test="applicationOrganId != null and applicationOrganId != ''">
  402. <!--申请人案件-->
  403. select c.id
  404. from case_application c
  405. JOIN case_affiliate ca ON ca.case_appli_id =c.id AND ca.identity_type = 1
  406. <where>
  407. (c.case_status &lt;= 10 or c.case_status=31) AND
  408. ca.identity_type=1
  409. <if test="applicationOrganId != null and applicationOrganId != ''">
  410. AND ca.application_organ_id = #{applicationOrganId}
  411. </if>
  412. </where>
  413. union
  414. </if>
  415. <!--秘书案件-->
  416. <if test="deptIds != null and deptIds.size() > 0">
  417. <!--秘书主表案件-->
  418. SELECT
  419. c.id
  420. FROM
  421. case_application c
  422. JOIN case_affiliate ca ON ca.case_appli_id = c.id AND ca.identity_type = 1
  423. JOIN case_application_log l on l.case_appli_id=c.id and l.update_submit_status not in(1, 2) and
  424. l.version
  425. = (
  426. SELECT
  427. max( version ) version
  428. FROM
  429. case_application_log
  430. WHERE case_appli_id = c.id
  431. )
  432. WHERE
  433. ca.identity_type=1
  434. and c.case_status in (1,5,8,9,11,14,15,16,17,31)
  435. union
  436. <!--秘书审核案件-->
  437. SELECT
  438. l.case_appli_id id
  439. FROM
  440. case_application c
  441. JOIN case_application_log l ON c.id = l.case_appli_id
  442. JOIN case_affiliate_log ca ON ca.case_appli_log_id = l.id
  443. AND ca.identity_type = 1
  444. WHERE
  445. l.update_submit_status IN ( 1, 2 ) and ca.identity_type=1
  446. <!-- 查询该案件的最新记录 -->
  447. AND l.version = (
  448. SELECT
  449. max( version ) version
  450. FROM
  451. case_application_log
  452. WHERE
  453. c.id = case_appli_id)
  454. </if>
  455. </trim>
  456. )
  457. </if>
  458. </trim>
  459. ) t1
  460. <where>
  461. <if test="caseStatus != null">
  462. AND t1.case_status = #{caseStatus}
  463. </if>
  464. <if test="lockStatus != null">
  465. AND t1.lock_status = #{lockStatus}
  466. </if>
  467. <if test="caseNum != null and caseNum != ''">
  468. AND t1.case_num = #{caseNum}
  469. </if>
  470. <if test="batchNumber != null">
  471. AND t1.batch_number = #{batchNumber}
  472. </if>
  473. <if test="nameId != null and nameId != ''">
  474. AND t1.application_organ_id=#{nameId} AND t1.identity_type=1
  475. </if>
  476. </where>
  477. order by t1.pendingStatus asc,t1.case_num desc
  478. </select>
  479. <select id="selectHandledCase" resultMap="CaseApplicationResult">
  480. select DISTINCT(c.id) id,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method ,
  481. CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
  482. ELSE '无审理方式'
  483. END arbitratMethodName,
  484. c.case_status ,
  485. CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
  486. when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
  487. when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
  488. when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
  489. when 12 then '待部门长审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'
  490. when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'
  491. when 18 then '待仲裁员审核仲裁文书'
  492. when 31 then '待修改开庭时间'
  493. ELSE '无案件状态'
  494. END caseStatusName,
  495. c.hear_date ,c.arbitrat_claims ,
  496. c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag
  497. ,c.fee_payable ,
  498. c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time ,c.lock_status,
  499. c.update_by ,c.update_time , c.arbitrator_name,ca.application_organ_id applicationOrganId
  500. ,ca.application_organ_name as applicantName,c.filearbitra_url,c.version
  501. from case_log_record r
  502. join case_application c on r.case_appli_id=c.id
  503. JOIN case_affiliate ca ON ca.case_appli_id = c.id AND ca.identity_type=1
  504. <where>
  505. <if test="lockStatus != null">
  506. AND c.lock_status = #{lockStatus}
  507. </if>
  508. <if test="caseNum != null and caseNum != ''">
  509. AND c.case_num = #{caseNum}
  510. </if>
  511. <if test="nameId != null and nameId != ''">
  512. AND ca.application_organ_id=#{nameId} AND ca.identity_type=1
  513. </if>
  514. <if test="loginUserName != null and loginUserName != ''">
  515. AND r.create_by=#{loginUserName} AND ca.identity_type=1
  516. </if>
  517. </where>
  518. order by c.create_time desc,c.case_num desc
  519. </select>
  520. <select id="selectTodoCountByRole" resultType="com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount">
  521. select sum( case when t1.case_status=0 then 1 else 0 end) caseApply,
  522. sum( case when t1.case_status=1 then 1 else 0 end) caseApplyCheck,
  523. sum( case when t1.case_status=2 then 1 else 0 end) caseApplyPay,
  524. sum( case when t1.case_status=3 then 1 else 0 end) caseApplyPayCheck,
  525. sum( case when t1.case_status=4 then 1 else 0 end) caseApplyEvidence,
  526. sum( case when t1.case_status=5 then 1 else 0 end) caseApplyGroupCheck,
  527. sum( case when t1.case_status=6 then 1 else 0 end) caseApplyGroupConfirm,
  528. sum( case when t1.case_status=7 then 1 else 0 end) caseApplyArbitrateWay,
  529. sum( case when t1.case_status=8 then 1 else 0 end) caseApplyGroupOnline,
  530. sum( case when t1.case_status=9 then 1 else 0 end) caseApplyGroupOffline,
  531. sum( case when t1.case_status=10 then 1 else 0 end) caseApplyAward,
  532. sum( case when t1.case_status=11 then 1 else 0 end) caseApplyAwardCheck,
  533. sum( case when t1.case_status=12 then 1 else 0 end) caseApplyAwardConfirm,
  534. sum( case when t1.case_status=13 then 1 else 0 end) caseApplyAwardSign,
  535. sum( case when t1.case_status=14 then 1 else 0 end) caseApplyAwardSeal,
  536. sum( case when t1.case_status=15 then 1 else 0 end) caseApplyAwardSend,
  537. sum( case when t1.case_status=16 then 1 else 0 end) caseApplyStored,
  538. sum( case when t1.case_status=17 then 1 else 0 end) caseApplyArchived,
  539. sum( case when t1.case_status=18 then 1 else 0 end) arbitratorApplyAwardConfirm,
  540. sum( case when t1.case_status=31 then 1 else 0 end) updateOnlineHearDate
  541. from(
  542. <trim suffixOverrides="union">
  543. <!--被申请人,仲裁员,部门长,财务,代理人案件-->
  544. <if test="isOtherRole!=null and isOtherRole==1">
  545. select DISTINCT(t.id),t.case_status,t.application_organ_id, t.arbitrator_id,t.identity_num ,
  546. t.identity_type from(
  547. select c.id ,
  548. c.case_status,ca.application_organ_id,
  549. c.arbitrator_id,ca.identity_num , ca.identity_type
  550. from case_application c
  551. JOIN case_affiliate ca ON ca.case_appli_id = c.id
  552. <where>
  553. <if test="caseStatus != null">
  554. AND c.case_status = #{caseStatus}
  555. </if>
  556. <if test="caseStatusList != null and caseStatusList.size() > 0">
  557. and c.case_status in
  558. <foreach item="caseStatus" collection="caseStatusList" open="(" separator="," close=")">
  559. #{caseStatus}
  560. </foreach>
  561. </if>
  562. </where>
  563. ) t
  564. <where>
  565. <!--被申请人-->
  566. <if test="idCard != null and idCard != ''">
  567. or (t.identity_num=#{idCard} AND t.identity_type=2 and (t.case_status=4 or t.case_status=17))
  568. </if>
  569. <!--仲裁员-->
  570. <if test="userId != null and userId != ''">
  571. or ( t.identity_type=1 and
  572. t.case_status in (7,13,17,18)
  573. and
  574. instr (t.arbitrator_id,#{userId})>0)
  575. </if>
  576. <!--申请人-->
  577. <if test="applicationOrganId != null and applicationOrganId != ''">
  578. or ( t.application_organ_id = #{applicationOrganId} AND t.identity_type=1
  579. and t.case_status in (0,2,17))
  580. </if>
  581. <!--部门长-->
  582. <if test="deptHeadStatus != null and deptHeadStatus.size() > 0">
  583. or (t.identity_type=1 and t.case_status in
  584. <foreach item="caseStatus" collection="deptHeadStatus" open="(" separator="," close=")">
  585. #{caseStatus}
  586. </foreach>)
  587. </if>
  588. <!--财务-->
  589. <if test="financeStatus != null and financeStatus != ''">
  590. or ( t.identity_type=1 and t.case_status =#{financeStatus})
  591. </if>
  592. <!--代理人-->
  593. <if test="agentDeptIds != null and agentDeptIds.size()>0">
  594. or (
  595. t.application_organ_id in
  596. <foreach item="deptId" collection="agentDeptIds" open="(" separator="," close=")">#{deptId}
  597. </foreach>
  598. AND t.identity_type=1
  599. and t.case_status in (0,9))
  600. </if>
  601. </where>
  602. union
  603. </if>
  604. <!--秘书案件-->
  605. <if test="deptIds != null and deptIds.size() > 0">
  606. select c.id ,
  607. c.case_status,ca.application_organ_id,
  608. c.arbitrator_id,ca.identity_num , ca.identity_type
  609. FROM
  610. case_application c
  611. JOIN case_affiliate ca ON ca.case_appli_id = c.id AND ca.identity_type = 1
  612. JOIN case_application_log l on l.case_appli_id=c.id and l.update_submit_status not in(1, 2) and
  613. l.version
  614. = (
  615. SELECT
  616. max( version ) version
  617. FROM
  618. case_application_log
  619. WHERE case_appli_id = c.id
  620. )
  621. WHERE
  622. ca.identity_type=1
  623. and c.case_status in (1,5,8,9,11,14,15,16,17,31)
  624. <!-- <if test="deptIds != null and deptIds.size() > 0">
  625. and ca.application_organ_id in
  626. <foreach item="item" collection="deptIds" open="(" separator="," close=")">
  627. #{item}
  628. </foreach>
  629. </if> -->
  630. <if test="caseStatus != null">
  631. AND c.case_status = #{caseStatus}
  632. </if>
  633. <if test="nameId != null and nameId != ''">
  634. AND ca.application_organ_id=#{nameId} AND ca.identity_type=1
  635. </if>
  636. union
  637. select c.id ,
  638. c.case_status,ca.application_organ_id,
  639. c.arbitrator_id,ca.identity_num , ca.identity_type
  640. FROM
  641. case_application c
  642. JOIN case_application_log l ON c.id = l.case_appli_id
  643. JOIN case_affiliate_log ca ON ca.case_appli_log_id = l.id
  644. AND ca.identity_type = 1
  645. WHERE
  646. l.update_submit_status IN ( 1, 2 ) and ca.identity_type=1
  647. AND l.version = (
  648. SELECT
  649. max( version ) version
  650. FROM
  651. case_application_log
  652. WHERE
  653. c.id = case_appli_id)
  654. </if>
  655. </trim>
  656. ) t1
  657. </select>
  658. <select id="selectAdminCaseApplicationList" parameterType="com.ruoyi.wisdomarbitrate.domain.CaseApplication" resultMap="CaseApplicationResult">
  659. select DISTINCT(c.id) id,0 as pendingStatus,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method ,
  660. CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
  661. ELSE '无审理方式'
  662. END arbitratMethodName,
  663. c.case_status ,
  664. CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
  665. when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
  666. when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
  667. when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
  668. when 12 then '待部门长审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'
  669. when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'
  670. when 18 then '待仲裁员审核仲裁文书'
  671. when 31 then '待修改开庭时间'
  672. ELSE '无案件状态'
  673. END caseStatusName,
  674. c.hear_date ,c.arbitrat_claims ,
  675. c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag
  676. ,c.fee_payable ,
  677. c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time ,c.appli_iswrit_hear,c.respon_isWrit_hear,c.lock_status,
  678. c.update_by ,c.update_time , c.arbitrator_name,ca.application_organ_id applicationOrganId
  679. ,ca.application_organ_name as applicantName,c.filearbitra_url,(select version from
  680. case_application_log where case_appli_id=c.id order by version desc limit 1) as version,(select
  681. update_submit_status from case_application_log where case_appli_id=c.id order by version desc limit 1)
  682. as updateSubmitStatus,c.batch_number
  683. from case_application c
  684. JOIN case_affiliate ca ON ca.case_appli_id = c.id AND ca.identity_type=1
  685. JOIN case_application_log l ON c.id = l.case_appli_id and c.version=l.version
  686. <where>
  687. <if test="caseStatus != null">
  688. AND c.case_status = #{caseStatus}
  689. </if>
  690. <if test="lockStatus != null">
  691. AND c.lock_status = #{lockStatus}
  692. </if>
  693. <if test="caseNum != null and caseNum != ''">
  694. AND c.case_num = #{caseNum}
  695. </if>
  696. <if test="batchNumber != null">
  697. AND c.batch_number = #{batchNumber}
  698. </if>
  699. <if test="nameId != null and nameId != ''">
  700. AND ca.application_organ_id=#{nameId} AND ca.identity_type=1
  701. </if>
  702. <if test="caseStatusList != null and caseStatusList.size() > 0">
  703. and c.case_status in
  704. <foreach item="caseStatus" collection="caseStatusList" open="(" separator="," close=")">
  705. #{caseStatus}
  706. </foreach>
  707. </if>
  708. </where>
  709. order by c.case_num desc
  710. </select>
  711. <select id="selectAdminCaseApplicationListBatch" parameterType="com.ruoyi.wisdomarbitrate.domain.CaseApplication" resultMap="CaseApplicationResult">
  712. SELECT DISTINCT c.batch_number ,c.arbitrat_method ,c.arbitrator_name ,
  713. c.arbitrator_id ,a.identity_type ,a.name ,a.application_organ_id as applicationOrganId,
  714. a.application_organ_name as applicantName,
  715. CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
  716. ELSE '无审理方式'
  717. END arbitratMethodName
  718. FROM case_application c left join case_affiliate a on c.id = a.case_appli_id
  719. WHERE c.lock_status = 0 and c.batch_number is not null
  720. and a.identity_type = 1
  721. <if test="batchNumber != null and batchNumber != ''">
  722. AND c.batch_number = #{batchNumber}
  723. </if>
  724. <if test="nameId != null and nameId != ''">
  725. AND a.application_organ_id=#{nameId}
  726. </if>
  727. order by c.batch_number desc
  728. </select>
  729. <select id="selectAdminCaseApplicationListBatch1" parameterType="com.ruoyi.wisdomarbitrate.domain.CaseApplication" resultMap="CaseApplicationResult">
  730. SELECT DISTINCT t1.batch_number ,t1.arbitrat_method ,t1.arbitrator_name ,
  731. t1.arbitrator_id ,t1.identity_type ,t1.name ,t1.applicationOrganId ,
  732. t1.applicantName,t1.arbitratMethodName
  733. FROM(
  734. <trim suffixOverrides="union">
  735. <!--被申请人,仲裁员,部门长,财务,代理人案件-->
  736. <if test="isOtherRole!=null and isOtherRole==1">
  737. SELECT c.batch_number ,c.arbitrat_method ,c.arbitrator_name ,
  738. c.arbitrator_id ,ca.identity_type ,ca.name ,ca.application_organ_id as applicationOrganId,
  739. ca.application_organ_name as applicantName, c.lock_status,
  740. CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
  741. ELSE '无审理方式'
  742. END arbitratMethodName
  743. FROM case_application c left join case_affiliate ca on c.id = ca.case_appli_id
  744. <where>
  745. <!--根据角色和状态过滤-->
  746. <!--被申请人-->
  747. <if test="idCard != null and idCard != ''">
  748. or (ca.identity_num=#{idCard} AND ca.identity_type=2
  749. and (c.case_status=4 or c.case_status=17)
  750. )
  751. </if>
  752. <!--仲裁员-->
  753. <if test="userId != null and userId != ''">
  754. or ( ca.identity_type=1 and
  755. c.case_status in (7,13,17,18)
  756. and
  757. instr (c.arbitrator_id,#{userId})>0 )
  758. </if>
  759. <!--部门长-->
  760. <if test="deptHeadStatus != null and deptHeadStatus.size() > 0">
  761. or (ca.identity_type=1)
  762. </if>
  763. <!--财务-->
  764. <if test="financeStatus != null and financeStatus != ''">
  765. or (ca.identity_type=1
  766. and c.case_status =#{financeStatus}
  767. )
  768. </if>
  769. <!--代理人-->
  770. <if test="agentDeptIds != null and agentDeptIds.size()>0">
  771. or (
  772. ca.application_organ_id in
  773. <foreach item="deptId" collection="agentDeptIds" open="(" separator="," close=")">#{deptId}
  774. </foreach>
  775. AND ca.identity_type=1
  776. and c.case_status in (0,9)
  777. )
  778. </if>
  779. </where>
  780. union
  781. </if>
  782. <!--申请人案件-->
  783. <if test="applicationOrganId != null and applicationOrganId != ''">
  784. SELECT c.batch_number ,c.arbitrat_method ,c.arbitrator_name ,
  785. c.arbitrator_id ,ca.identity_type ,ca.name ,ca.application_organ_id as applicationOrganId,
  786. ca.application_organ_name as applicantName, c.lock_status,
  787. CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
  788. ELSE '无审理方式'
  789. END arbitratMethodName
  790. FROM case_application c left join case_affiliate ca on c.id = ca.case_appli_id
  791. <where>
  792. (c.case_status &lt;= 10 or c.case_status=31) AND
  793. ca.identity_type=1
  794. <if test="applicationOrganId != null and applicationOrganId != ''">
  795. AND ca.application_organ_id = #{applicationOrganId}
  796. </if>
  797. </where>
  798. union
  799. </if>
  800. <!--秘书案件-->
  801. <if test="deptIds != null and deptIds.size() > 0">
  802. SELECT c.batch_number ,c.arbitrat_method ,c.arbitrator_name ,
  803. c.arbitrator_id ,ca.identity_type ,ca.name ,ca.application_organ_id as applicationOrganId,
  804. ca.application_organ_name as applicantName, c.lock_status,
  805. CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
  806. ELSE '无审理方式'
  807. END arbitratMethodName
  808. FROM case_application c left join case_affiliate ca on c.id = ca.case_appli_id
  809. WHERE ca.identity_type=1
  810. and c.case_status in (1,5,8,9,11,14,15,16,17,31)
  811. union
  812. </if>
  813. </trim>
  814. ) t1
  815. WHERE t1.lock_status = 0 and t1.batch_number is not null
  816. and t1.identity_type = 1
  817. <if test="batchNumber != null and batchNumber != ''">
  818. AND t1.batch_number = #{batchNumber}
  819. </if>
  820. <if test="nameId != null and nameId != ''">
  821. AND t1.application_organ_id=#{nameId}
  822. </if>
  823. order by t1.batch_number desc
  824. </select>
  825. <select id="selectAdminCaseToDoCount" resultType="com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount">
  826. SELECT
  827. sum( case when c.case_status=0 then 1 else 0 end) caseApply,
  828. sum( case when c.case_status=1 then 1 else 0 end) caseApplyCheck,
  829. sum( case when c.case_status=2 then 1 else 0 end) caseApplyPay,
  830. sum( case when c.case_status=3 then 1 else 0 end) caseApplyPayCheck,
  831. sum( case when c.case_status=4 then 1 else 0 end) caseApplyEvidence,
  832. sum( case when c.case_status=5 then 1 else 0 end) caseApplyGroupCheck,
  833. sum( case when c.case_status=6 then 1 else 0 end) caseApplyGroupConfirm,
  834. sum( case when c.case_status=7 then 1 else 0 end) caseApplyArbitrateWay,
  835. sum( case when c.case_status=8 then 1 else 0 end) caseApplyGroupOnline,
  836. sum( case when c.case_status=9 then 1 else 0 end) caseApplyGroupOffline,
  837. sum( case when c.case_status=10 then 1 else 0 end) caseApplyAward,
  838. sum( case when c.case_status=11 then 1 else 0 end) caseApplyAwardCheck,
  839. sum( case when c.case_status=12 then 1 else 0 end) caseApplyAwardConfirm,
  840. sum( case when c.case_status=13 then 1 else 0 end) caseApplyAwardSign,
  841. sum( case when c.case_status=14 then 1 else 0 end) caseApplyAwardSeal,
  842. sum( case when c.case_status=15 then 1 else 0 end) caseApplyAwardSend,
  843. sum( case when c.case_status=16 then 1 else 0 end) caseApplyStored,
  844. sum( case when c.case_status=17 then 1 else 0 end) caseApplyArchived,
  845. sum( case when c.case_status=18 then 1 else 0 end) arbitratorApplyAwardConfirm,
  846. sum( case when c.case_status=31 then 1 else 0 end) updateOnlineHearDate
  847. FROM
  848. case_application c
  849. JOIN case_affiliate ca ON ca.case_appli_id = c.id
  850. AND ca.identity_type = 1
  851. WHERE
  852. c.case_status IN (
  853. 0,
  854. 1,
  855. 2,
  856. 3,
  857. 4,
  858. 5,
  859. 6,
  860. 7,
  861. 8,
  862. 9,
  863. 10,
  864. 11,
  865. 12,
  866. 13,
  867. 14,
  868. 15,
  869. 16,
  870. 17,
  871. 18,
  872. 31
  873. )
  874. </select>
  875. <select id="selectCaseApplicationCount" parameterType="com.ruoyi.wisdomarbitrate.domain.CaseApplication" resultType="int">
  876. select count(1) from case_application c
  877. <where>
  878. <if test="caseNum != null and caseNum != ''">
  879. AND c.case_num = #{caseNum}
  880. </if>
  881. </where>
  882. </select>
  883. <insert id="insertCaseApplication" parameterType="com.ruoyi.wisdomarbitrate.domain.CaseApplication" useGeneratedKeys="true" keyProperty="id">
  884. insert into case_application(
  885. <if test="id != null">id ,</if>
  886. <if test="caseName != null and caseName != ''">case_name ,</if>
  887. <if test="caseNum != null and caseNum != ''">case_num,</if>
  888. <if test="caseSubjectAmount != null">case_subject_amount,</if>
  889. register_date,
  890. <if test="arbitratMethod != null and arbitratMethod != ''">arbitrat_method,</if>
  891. <if test="caseStatus != null ">case_status,</if>
  892. <if test="hearDate != null ">hear_date,</if>
  893. <if test="arbitratClaims != null and arbitratClaims != ''">arbitrat_claims,</if>
  894. <if test="requestRule != null and requestRule != ''">request_rule,</if>
  895. <if test="loanStartDate != null ">loan_start_date,</if>
  896. <if test="loanEndDate != null ">loan_end_date,</if>
  897. <if test="claimPrinciOwed != null ">claim_princi_owed,</if>
  898. <if test="claimInterestOwed != null ">claim_interest_owed,</if>
  899. <if test="claimLiquidDamag != null ">claim_liquid_damag,</if>
  900. <if test="feePayable != null ">fee_payable,</if>
  901. <if test="beginVideoDate != null ">begin_video_date,</if>
  902. <if test="onlineVideoPerson != null and onlineVideoPerson != ''">online_video_person,</if>
  903. <if test="contractNumber != null and contractNumber != ''">contract_number,</if>
  904. <if test="adjudicaCounter != null ">adjudica_counter,</if>
  905. <if test="properPreser != null ">proper_preser,</if>
  906. <if test="createBy != null and createBy != ''">create_by,</if>
  907. <if test="importFlag != null ">import_flag,</if>
  908. <if test="version != null ">version,</if>
  909. <if test="templateId != null ">template_id,</if>
  910. facts,
  911. mediation_agreement,
  912. batch_number,
  913. create_time
  914. )values(
  915. <if test="id != null">#{id} ,</if>
  916. <if test="caseName != null and caseName != ''">#{caseName},</if>
  917. <if test="caseNum != null and caseNum != ''">#{caseNum},</if>
  918. <if test="caseSubjectAmount != null">#{caseSubjectAmount},</if>
  919. sysdate(),
  920. <if test="arbitratMethod != null and arbitratMethod != ''">#{arbitratMethod},</if>
  921. <if test="caseStatus != null ">#{caseStatus},</if>
  922. <if test="hearDate != null ">#{hearDate},</if>
  923. <if test="arbitratClaims != null and arbitratClaims != ''">#{arbitratClaims},</if>
  924. <if test="requestRule != null and requestRule != ''">#{requestRule},</if>
  925. <if test="loanStartDate != null ">#{loanStartDate},</if>
  926. <if test="loanEndDate != null ">#{loanEndDate},</if>
  927. <if test="claimPrinciOwed != null ">#{claimPrinciOwed},</if>
  928. <if test="claimInterestOwed != null ">#{claimInterestOwed},</if>
  929. <if test="claimLiquidDamag != null ">#{claimLiquidDamag},</if>
  930. <if test="feePayable != null ">#{feePayable},</if>
  931. <if test="beginVideoDate != null ">#{beginVideoDate},</if>
  932. <if test="onlineVideoPerson != null and onlineVideoPerson != ''">#{onlineVideoPerson},</if>
  933. <if test="contractNumber != null and contractNumber != ''">#{contractNumber},</if>
  934. <if test="adjudicaCounter != null ">#{adjudicaCounter},</if>
  935. <if test="properPreser != null ">#{properPreser},</if>
  936. <if test="createBy != null and createBy != ''">#{createBy},</if>
  937. <if test="importFlag != null ">#{importFlag},</if>
  938. <if test="version != null ">#{version},</if>
  939. <if test="templateId != null ">#{templateId},</if>
  940. #{facts},
  941. #{mediationAgreement},
  942. #{batchNumber},
  943. sysdate()
  944. )
  945. </insert>
  946. <insert id="batchSave">
  947. insert into case_application(
  948. id,
  949. case_name ,
  950. case_num,
  951. case_subject_amount,
  952. register_date,
  953. arbitrat_method,
  954. case_status,
  955. hear_date,
  956. arbitrat_claims,
  957. request_rule,
  958. loan_start_date,
  959. loan_end_date,
  960. claim_princi_owed,
  961. claim_interest_owed,
  962. claim_liquid_damag,
  963. fee_payable,
  964. begin_video_date,
  965. online_video_person,
  966. contract_number,
  967. adjudica_counter,
  968. proper_preser,
  969. create_by,
  970. import_flag,
  971. version,
  972. template_id,
  973. facts,
  974. mediation_agreement,
  975. batch_number,
  976. create_time
  977. )values
  978. <foreach item="item" index="index" collection="list" separator=",">
  979. (
  980. #{item.id},
  981. #{item.caseName},
  982. #{item.caseNum},
  983. #{item.caseSubjectAmount},
  984. sysdate(),
  985. #{item.arbitratMethod},
  986. #{item.caseStatus},
  987. #{item.hearDate},
  988. #{item.arbitratClaims},
  989. #{item.requestRule},
  990. #{item.loanStartDate},
  991. #{item.loanEndDate},
  992. #{item.claimPrinciOwed},
  993. #{item.claimInterestOwed},
  994. #{item.claimLiquidDamag},
  995. #{item.feePayable},
  996. #{item.beginVideoDate},
  997. #{item.onlineVideoPerson},
  998. #{item.contractNumber},
  999. #{item.adjudicaCounter},
  1000. #{item.properPreser},
  1001. #{item.createBy},
  1002. #{item.importFlag},
  1003. #{item.version},
  1004. #{item.templateId},
  1005. #{item.facts},
  1006. #{item.mediationAgreement},
  1007. #{item.batchNumber},
  1008. sysdate()
  1009. )
  1010. </foreach>;
  1011. </insert>
  1012. <update id="updataCaseApplication" parameterType="com.ruoyi.wisdomarbitrate.domain.CaseApplication">
  1013. update case_application
  1014. <set>
  1015. <if test="caseSubjectAmount != null">case_subject_amount = #{caseSubjectAmount},</if>
  1016. <if test="registerDate != null">register_date = #{registerDate},</if>
  1017. <if test="arbitratMethod != null">arbitrat_method = #{arbitratMethod},</if>
  1018. <if test="hearDate != null ">hear_date = #{hearDate},</if>
  1019. <if test="arbitratClaims != null and arbitratClaims != ''">arbitrat_claims = #{arbitratClaims},</if>
  1020. <if test="requestRule != null and requestRule != ''">request_rule = #{requestRule},</if>
  1021. <if test="loanStartDate != null ">loan_start_date = #{loanStartDate},</if>
  1022. <if test="loanEndDate != null ">loan_end_date = #{loanEndDate},</if>
  1023. <if test="loanEndDate != null ">claim_princi_owed = #{claimPrinciOwed},</if>
  1024. <if test="claimInterestOwed != null ">claim_interest_owed = #{claimInterestOwed},</if>
  1025. <if test="claimLiquidDamag != null ">claim_liquid_damag = #{claimLiquidDamag},</if>
  1026. <if test="feePayable != null ">fee_payable = #{feePayable},</if>
  1027. <if test="beginVideoDate != null ">begin_video_date = #{beginVideoDate},</if>
  1028. <if test="onlineVideoPerson != null and onlineVideoPerson != ''">online_video_person =
  1029. #{onlineVideoPerson},
  1030. </if>
  1031. <if test="contractNumber != null and contractNumber != ''">contract_number = #{contractNumber},</if>
  1032. <if test="caseName != null and caseName != ''">case_name = #{caseName},</if>
  1033. <if test="caseDescribe != null and caseDescribe != ''">case_describe = #{caseDescribe},</if>
  1034. <if test="caseResult != null and caseResult != ''">case_result = #{caseResult},</if>
  1035. <if test="caseStatus != null">case_status = #{caseStatus},</if>
  1036. <if test="properPreser != null">proper_preser = #{properPreser},</if>
  1037. <if test="applicantIsWrittenHear != null">appli_iswrit_hear = #{applicantIsWrittenHear},</if>
  1038. <if test="respondentIsWrittenHear != null">respon_isWrit_hear = #{respondentIsWrittenHear},</if>
  1039. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  1040. <if test="caseNum != null and caseNum != ''">case_num = #{caseNum},</if>
  1041. <if test="version != null ">version = #{version},</if>
  1042. <if test="facts != null and facts != ''">facts = #{facts},</if>
  1043. <if test="mediationAgreement != null and mediationAgreement != ''">mediation_agreement =
  1044. #{mediationAgreement},
  1045. </if>
  1046. update_time = sysdate()
  1047. </set>
  1048. where id = #{id}
  1049. </update>
  1050. <update id="submitCaseApplication" parameterType="com.ruoyi.wisdomarbitrate.domain.CaseApplication">
  1051. update case_application
  1052. <set>
  1053. <if test="caseStatus != null">case_status = #{caseStatus},</if>
  1054. <if test="arbitratorId != null and arbitratorId != ''">arbitrator_id = #{arbitratorId},</if>
  1055. <if test="arbitratorName != null and arbitratorName != ''">arbitrator_name = #{arbitratorName},</if>
  1056. <if test="pendingAppointArbotrar != null ">pending_appoint_arbotrar = #{pendingAppointArbotrar},</if>
  1057. <if test="arbitratMethod != null ">arbitrat_method = #{arbitratMethod},</if>
  1058. <if test="caseName != null and caseName != ''">case_name = #{caseName},</if>
  1059. <if test="caseDescribe != null and caseDescribe != ''">case_describe = #{caseDescribe},</if>
  1060. <if test="caseResult != null and caseResult != ''">case_result = #{caseResult},</if>
  1061. <if test="isAgreePendTral != null">is_agree_pend_tral = #{isAgreePendTral},</if>
  1062. <if test="adjudicaCounter != null">adjudica_counter = #{adjudicaCounter},</if>
  1063. <if test="objectiJuris != null">objecti_juris = #{objectiJuris},</if>
  1064. <if test="isAbsence != null">is_absence = #{isAbsence},</if>
  1065. <if test="lockStatus != null">lock_status = #{lockStatus},</if>
  1066. <if test="appliIsAbsen != null">appli_is_absen = #{appliIsAbsen},</if>
  1067. <if test="responCrossOpin != null and responCrossOpin != ''">respon_cross_opin = #{responCrossOpin},</if>
  1068. <if test="applicaCrossOpin != null and applicaCrossOpin != ''">applica_cross_opin = #{applicaCrossOpin},
  1069. </if>
  1070. <if test="responDefenOpini != null and responDefenOpini != ''">respon_defen_opini = #{responDefenOpini},
  1071. </if>
  1072. <if test="objectionAddEviden != null">objection_add_eviden = #{objectionAddEviden},</if>
  1073. <if test="openCourtHear != null">open_court_hear = #{openCourtHear},</if>
  1074. <if test="respondentIsWrittenHear != null">respon_isWrit_hear = #{respondentIsWrittenHear},</if>
  1075. <if test="hearDate != null">hear_date = #{hearDate},</if>
  1076. <if test="filearbitraUrl != null and filearbitraUrl != ''">filearbitra_url = #{filearbitraUrl},</if>
  1077. <if test="adjudicaCounterReason != null and adjudicaCounterReason != ''">adjudica_counter_reason =
  1078. #{adjudicaCounterReason},
  1079. </if>
  1080. </set>
  1081. where id = #{id}
  1082. </update>
  1083. <update id="updatePayType">
  1084. update case_application set pay_type=#{payType} where id in
  1085. <foreach item="caseId" collection="caseIds" open="(" separator="," close=")">
  1086. #{caseId}
  1087. </foreach>
  1088. </update>
  1089. <update id="updateCaseLockStatus">
  1090. update case_application set lock_status=#{lockStatus} where id = #{id}
  1091. </update>
  1092. <update id="bindCaseId">
  1093. update case_application set room_id=#{roomId} where id = #{caseId}
  1094. <!-- update case_application set room_id= CONCAT(room_id,',',#{roomId}) where id =#{caseId} -->
  1095. </update>
  1096. <update id="updateVersionById">
  1097. update case_application set version = #{version} where id = #{id}
  1098. </update>
  1099. <delete id="deletecaseApplication" parameterType="com.ruoyi.wisdomarbitrate.domain.CaseApplication">
  1100. delete from case_application where id = #{id}
  1101. </delete>
  1102. <delete id="batchDeletecaseApplication">
  1103. delete from case_application
  1104. where id in
  1105. <foreach collection="ids" item="item" open="(" separator="," close=")">
  1106. #{item}
  1107. </foreach>;
  1108. delete from case_affiliate
  1109. where case_appli_id in
  1110. <foreach collection="ids" item="item" open="(" separator="," close=")">
  1111. #{item}
  1112. </foreach>;
  1113. delete from case_attach
  1114. where case_appli_id in
  1115. <foreach collection="ids" item="item" open="(" separator="," close=")">
  1116. #{item}
  1117. </foreach>;
  1118. delete from column_value
  1119. where case_id in
  1120. <foreach collection="ids" item="item" open="(" separator="," close=")">
  1121. #{item}
  1122. </foreach>;
  1123. </delete>
  1124. <select id="selectCaseApplication" parameterType="com.ruoyi.wisdomarbitrate.domain.CaseApplication" resultMap="CaseApplicationResult">
  1125. select c.id ,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method ,
  1126. CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
  1127. ELSE '无审理方式'
  1128. END arbitratMethodName,
  1129. c.case_name,
  1130. c.case_status ,
  1131. CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
  1132. when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
  1133. when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
  1134. when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
  1135. when 12 then '待部门长审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'
  1136. when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'
  1137. when 18 then '待仲裁员审核仲裁文书'
  1138. when 31 then '待修改开庭时间'
  1139. ELSE '无案件状态'
  1140. END caseStatusName,
  1141. c.hear_date ,c.arbitrat_claims ,
  1142. c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag
  1143. ,c.fee_payable ,
  1144. c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time
  1145. ,c.request_rule,c.adjudica_counter,c.proper_preser,
  1146. c.is_absence ,c.respon_cross_opin ,c.applica_cross_opin ,c.respon_defen_opini ,
  1147. c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name,ca.application_organ_id applicationOrganId
  1148. ,ca.application_organ_name as applicantName,
  1149. c.batch_number,
  1150. c.facts,
  1151. c.appli_iswrit_hear,c.respon_isWrit_hear,
  1152. c.mediation_agreement,c.template_id templateId
  1153. from case_application c
  1154. LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1
  1155. <where>
  1156. <if test="id != null ">
  1157. AND c.id = #{id}
  1158. </if>
  1159. </where>
  1160. order by c.create_time desc limit 1
  1161. </select>
  1162. <select id="listCaseApplicationByIds" resultMap="CaseApplicationResult">
  1163. select c.id ,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method ,c.case_name,
  1164. CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
  1165. ELSE '无审理方式'
  1166. END arbitratMethodName,
  1167. c.case_status ,
  1168. CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
  1169. when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
  1170. when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
  1171. when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
  1172. when 12 then '待部门长审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'
  1173. when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'
  1174. when 18 then '待仲裁员审核仲裁文书'
  1175. when 31 then '待修改开庭时间'
  1176. ELSE '无案件状态'
  1177. END caseStatusName,
  1178. c.hear_date ,c.arbitrat_claims ,
  1179. c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag
  1180. ,c.fee_payable ,
  1181. c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time
  1182. ,c.request_rule,c.adjudica_counter,c.proper_preser,
  1183. c.is_absence ,c.respon_cross_opin ,c.applica_cross_opin ,c.respon_defen_opini ,
  1184. c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name,ca.application_organ_id applicationOrganId
  1185. ,ca.application_organ_name as applicantName,
  1186. c.batch_number,
  1187. c.facts,
  1188. c.mediation_agreement,c.template_id templateId
  1189. from case_application c
  1190. LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1
  1191. <where>
  1192. <if test="ids != null and ids.size() > 0 ">
  1193. c.id in
  1194. <foreach item="id" collection="ids" open="(" separator="," close=")">
  1195. #{id}
  1196. </foreach>
  1197. </if>
  1198. </where>
  1199. </select>
  1200. <select id="selectCaseApplicationConfirm" parameterType="com.ruoyi.wisdomarbitrate.domain.CaseApplication" resultMap="CaseApplicationResult">
  1201. select c.id ,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method ,
  1202. CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
  1203. ELSE '无审理方式'
  1204. END arbitratMethodName,
  1205. c.case_status ,
  1206. CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
  1207. when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
  1208. when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
  1209. when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
  1210. when 12 then '待部门长审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'
  1211. when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'
  1212. when 18 then '待仲裁员审核仲裁文书'
  1213. when 31 then '待修改开庭时间'
  1214. ELSE '无案件状态'
  1215. END caseStatusName,
  1216. c.hear_date ,c.arbitrat_claims , c.batch_number,c.facts,c.mediation_agreement,c.template_id templateId,
  1217. c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable ,
  1218. c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time ,
  1219. c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name,
  1220. p.payment_status ,
  1221. CASE p.payment_status when 1 then '已支付' when 0 then '未支付'
  1222. ELSE '无支付状态'
  1223. END paymentStatusName,c.pay_type,
  1224. CASE c.pay_type when 0 then '线上支付' when 0 then '线下支付' else '' end payTypeName
  1225. from case_application c left join case_payment_record p on c.id = p.case_id
  1226. where c.id = #{id} and p.payment_status=1 limit 1
  1227. </select>
  1228. <select id="listCaseApplicationByBatchNumber" resultMap="CaseApplicationResult">
  1229. select c.id ,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method ,c.case_name,
  1230. CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
  1231. ELSE '无审理方式'
  1232. END arbitratMethodName,
  1233. c.case_status ,
  1234. CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
  1235. when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
  1236. when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
  1237. when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
  1238. when 12 then '待部门长审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'
  1239. when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'
  1240. when 18 then '待仲裁员审核仲裁文书'
  1241. when 31 then '待修改开庭时间'
  1242. ELSE '无案件状态'
  1243. END caseStatusName,
  1244. c.hear_date ,c.arbitrat_claims ,
  1245. c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag
  1246. ,c.fee_payable ,
  1247. c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time
  1248. ,c.request_rule,c.adjudica_counter,c.proper_preser,
  1249. c.is_absence ,c.respon_cross_opin ,c.applica_cross_opin ,c.respon_defen_opini ,
  1250. c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name,ca.application_organ_id applicationOrganId
  1251. ,ca.application_organ_name as applicantName,
  1252. c.batch_number,
  1253. c.facts,
  1254. c.mediation_agreement,c.template_id templateId
  1255. from case_application c
  1256. LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1
  1257. WHERE c.lock_status = 0
  1258. <if test="batchNumber != null and batchNumber != ''">
  1259. AND c.batch_number = #{batchNumber}
  1260. </if>
  1261. <if test="caseStatus != null">
  1262. AND c.case_status = #{caseStatus}
  1263. </if>
  1264. </select>
  1265. <select id="selectCaseNumLike" resultType="java.lang.Integer">
  1266. select max(substring(case_num, #{length}+1,12)) as maxCaseNum
  1267. from case_application where case_num like CONCAT(#{caseNum},'%') ;
  1268. </select>
  1269. <select id="selectArbitratorList" resultType="java.lang.String">
  1270. select a.arbitrator_id id from case_application a where a.id=#{id}
  1271. </select>
  1272. <select id="selectCasenum" resultType="java.lang.Integer">
  1273. SELECT count(1)
  1274. from case_application c
  1275. where c.arbitrator_id = #{userId}
  1276. and c.case_status in(8,9)
  1277. </select>
  1278. <select id="selectCaseIdByRoomId" resultType="java.lang.Long">
  1279. select id
  1280. from case_application where room_id=#{roomId} limit 1
  1281. </select>
  1282. <select id="selectMaxRoomId" resultType="java.lang.Long">
  1283. select max(room_id+1) as maxRoomId
  1284. from reserved_conference ;
  1285. </select>
  1286. <select id="selectBatchNumberLike" resultType="java.lang.Integer">
  1287. select max(batch_number) as maxBatchNumber
  1288. from case_application ;
  1289. </select>
  1290. </mapper>