智能仲裁后端服务

CaseApplicationMapper.xml 69KB

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