智能仲裁后端服务

CaseApplicationMapper.xml 73KB

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