智能仲裁后端服务

CaseApplicationMapper.xml 65KB

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