InsOrdersMapper.xml 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  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.ydtech.modules.order.dao.InsOrdersMapper">
  6. <resultMap id="BaseResultMap" type="com.ydtech.modules.order.entity.InsOrders">
  7. <id property="orderno" column="orderno" jdbcType="VARCHAR"/>
  8. <result property="quoteno" column="quoteno" jdbcType="VARCHAR"/>
  9. <result property="orderstatus" column="orderstatus" jdbcType="VARCHAR"/>
  10. <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
  11. <result property="insCompany" column="ins_company" jdbcType="VARCHAR"/>
  12. <result property="carinfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject"
  13. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  14. <result property="userid" column="userid" jdbcType="VARCHAR"/>
  15. <result property="username" column="username" jdbcType="VARCHAR"/>
  16. <result property="deptid" column="deptid" jdbcType="VARCHAR"/>
  17. <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
  18. <result property="ownerinfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject"
  19. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  20. <result property="applyinfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
  21. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  22. <result property="insureinfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
  23. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
  24. jdbcType="VARCHAR"/>
  25. <result property="agreeid" column="agreeid" jdbcType="VARCHAR"/>
  26. <result property="productid" column="productid" jdbcType="VARCHAR"/>
  27. <result property="product" column="product" jdbcType="VARCHAR"/>
  28. <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
  29. <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
  30. <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
  31. <result property="insuredname" column="insuredname" jdbcType="VARCHAR"/>
  32. <result property="jqstartdate" column="jqstartdate" jdbcType="VARCHAR"/>
  33. <result property="jqenddate" column="jqenddate" jdbcType="VARCHAR"/>
  34. <result property="systartdate" column="systartdate" jdbcType="VARCHAR"/>
  35. <result property="syenddate" column="syenddate" jdbcType="VARCHAR"/>
  36. <result property="risk" column="risk" javaType="com.alibaba.fastjson.JSONArray"
  37. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  38. <result property="king" column="king" javaType="com.alibaba.fastjson.JSONArray"
  39. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  40. <result property="vehicleAndVesselTax" column="vehicle_and_vessel_tax"
  41. javaType="com.alibaba.fastjson.JSONObject"
  42. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  43. </resultMap>
  44. <resultMap id="OrderResultMap" type="com.ydtech.modules.order.entity.vo.OrderVo">
  45. <id property="orderno" column="orderno" jdbcType="VARCHAR"/>
  46. <result property="quoteno" column="quoteno" jdbcType="VARCHAR"/>
  47. <result property="orderstatus" column="orderstatus" jdbcType="VARCHAR"/>
  48. <result property="carinfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject"
  49. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  50. <result property="userid" column="userid" jdbcType="VARCHAR"/>
  51. <result property="username" column="username" jdbcType="VARCHAR"/>
  52. <result property="deptid" column="deptid" jdbcType="VARCHAR"/>
  53. <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
  54. <result property="ownerinfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject"
  55. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  56. <result property="applyinfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
  57. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  58. <result property="insureinfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
  59. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
  60. jdbcType="VARCHAR"/>
  61. <result property="agreeid" column="agreeid" jdbcType="VARCHAR"/>
  62. <result property="productid" column="productid" jdbcType="VARCHAR"/>
  63. <result property="product" column="product" jdbcType="VARCHAR"/>
  64. <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
  65. <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
  66. <result property="insuredname" column="insuredname" jdbcType="VARCHAR"/>
  67. <result property="jqstartdate" column="jqstartdate" jdbcType="VARCHAR"/>
  68. <result property="jqenddate" column="jqenddate" jdbcType="VARCHAR"/>
  69. <result property="systartdate" column="systartdate" jdbcType="VARCHAR"/>
  70. <result property="syenddate" column="syenddate" jdbcType="VARCHAR"/>
  71. <result property="id" column="id" jdbcType="BIGINT"/>
  72. <result property="companyId" column="company_id" jdbcType="BIGINT"/>
  73. <result property="reptxt" column="reptxt" javaType="com.alibaba.fastjson.JSONObject"
  74. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  75. <result property="vehicleAndVesselTax" column="vehicle_and_vessel_tax"
  76. javaType="com.alibaba.fastjson.JSONObject"
  77. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  78. <result property="inscompany" column="inscompany" jdbcType="VARCHAR"/>
  79. <result property="jqapplyno" column="jqapplyno" jdbcType="VARCHAR"/>
  80. <result property="jqpolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
  81. <result property="syapplyno" column="syapplyno" jdbcType="VARCHAR"/>
  82. <result property="sypolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
  83. <result property="riskinfo" column="riskinfo" javaType="com.alibaba.fastjson.JSONArray"
  84. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  85. <result property="kindinfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
  86. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  87. <result property="jqpremium" column="jqpremium" jdbcType="DECIMAL"/>
  88. <result property="sypremium" column="sypremium" jdbcType="DECIMAL"/>
  89. <result property="jypremium" column="jypremium" jdbcType="DECIMAL"/>
  90. <result property="taxamount" column="taxamount" jdbcType="DECIMAL"/>
  91. <result property="sumpremium" column="sumpremium" jdbcType="DECIMAL"/>
  92. <result property="jqdiscountrate" column="jqdiscountrate" jdbcType="DOUBLE"/>
  93. <result property="sydiscountrate" column="sydiscountrate" jdbcType="DOUBLE"/>
  94. <result property="feerate" column="feerate" jdbcType="DOUBLE"/>
  95. <result property="disrate" column="disrate" jdbcType="DOUBLE"/>
  96. <result property="auditid" column="auditid" jdbcType="VARCHAR"/>
  97. <result property="auditname" column="auditname" jdbcType="VARCHAR"/>
  98. <result property="audittime" column="audittime" jdbcType="TIMESTAMP"/>
  99. <result property="auditopinion" column="auditopinion" jdbcType="VARCHAR"/>
  100. <result property="jqappoint" column="jqappoint" jdbcType="VARCHAR"/>
  101. <result property="syappoint" column="syappoint" jdbcType="VARCHAR"/>
  102. <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
  103. <result property="paymentLink" column="payment_link" jdbcType="VARCHAR"/>
  104. <result property="accidentInfo" column="accident_info" javaType="com.alibaba.fastjson.JSONArray"
  105. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  106. <result property="taxArrears" column="tax_arrears" javaType="com.alibaba.fastjson.JSONArray"
  107. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  108. <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
  109. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  110. </resultMap>
  111. <resultMap id="OrderExcelResultMap" type="com.ydtech.modules.ins.model.InsOrdersExcel">
  112. <id property="orderNo" column="orderno" jdbcType="VARCHAR"/>
  113. <result property="licenseNo" column="licenseno" jdbcType="VARCHAR"/>
  114. <result property="fraMeno" column="frameno" jdbcType="VARCHAR"/>
  115. <result property="carInfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  116. <result property="score" column="score" jdbcType="VARCHAR"/>
  117. <result property="ownerInfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  118. <result property="jqpRemIum" column="jqpremium" jdbcType="VARCHAR"/>
  119. <result property="apiType" column="api_type" jdbcType="VARCHAR"/>
  120. <result property="jqPolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
  121. <result property="sypRemIum" column="sypremium" jdbcType="VARCHAR"/>
  122. <result property="syPolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
  123. <result property="jypRemIum" column="jypremium" jdbcType="VARCHAR"/>
  124. <result property="taxaMount" column="taxamount" jdbcType="VARCHAR"/>
  125. <result property="jqStartDate" column="jq_start_date" jdbcType="VARCHAR"/>
  126. <result property="jqEndDate" column="jq_end_date" jdbcType="VARCHAR"/>
  127. <result property="syStartDate" column="sy_start_date" jdbcType="VARCHAR"/>
  128. <result property="syEndDate" column="sy_end_date" jdbcType="VARCHAR"/>
  129. <result property="jqScore" column="jq_score" jdbcType="VARCHAR"/>
  130. <result property="syScore" column="sy_score" jdbcType="VARCHAR"/>
  131. <result property="lossRation" column="loss_ration" jdbcType="VARCHAR"/>
  132. <result property="jqLossRation" column="jq_loss_ration" jdbcType="VARCHAR"/>
  133. <result property="syLossRation" column="sy_loss_ration" jdbcType="VARCHAR"/>
  134. <result property="insCompany" column="inscompany" jdbcType="VARCHAR"/>
  135. <result property="agreementId" column="agreement_id" jdbcType="VARCHAR"/>
  136. <result property="userId" column="userid" jdbcType="VARCHAR"/>
  137. <result property="userName" column="username" jdbcType="VARCHAR"/>
  138. <result property="applyInfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
  139. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  140. <result property="insureInfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
  141. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  142. <result property="kindInfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
  143. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  144. <result property="payDate" column="pay_date" jdbcType="VARCHAR"/>
  145. <result property="signingTime" column="signing_time" jdbcType="VARCHAR"/>
  146. <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
  147. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  148. </resultMap>
  149. <sql id="Base_Column_List">
  150. orderno,quoteno,orderstatus,
  151. carinfo,userid,username,
  152. deptid,deptname,ownerinfo,
  153. applyinfo,insureinfo,agreeid,
  154. productid,product,createtime,
  155. frameno,licenseno,insuredname,
  156. jqstartdate,jqenddate,systartdate,
  157. syenddate
  158. </sql>
  159. <select id="getOrderAndAreaCompany" parameterType="java.lang.String" resultMap="OrderResultMap">
  160. select o.orderno,
  161. o.quoteno,
  162. o.car_info_id,
  163. o.userid,
  164. o.username,
  165. o.deptid,
  166. o.deptname,
  167. o.owner_id,
  168. o.apply_id,
  169. o.insure_id,
  170. o.agreeid,
  171. o.productid,
  172. o.product,
  173. o.frameno,
  174. o.licenseno,
  175. o.insuredname,
  176. o.vehicle_and_vessel_tax,
  177. iac.jq_start_date as jqstartdate,
  178. iac.jq_end_date as jqenddate,
  179. iac.sy_start_date as systartdate,
  180. iac.sy_end_date as syenddate,
  181. iac.id,
  182. iac.company_id,
  183. iac.reptxt,
  184. iac.orderstatus,
  185. iac.inscompany,
  186. iac.jqapplyno,
  187. iac.jqpolicyno,
  188. iac.syapplyno,
  189. iac.sypolicyno,
  190. iac.jqpremium,
  191. iac.sypremium,
  192. iac.jypremium,
  193. iac.taxamount,
  194. iac.sumpremium,
  195. iac.jqdiscountrate,
  196. iac.sydiscountrate,
  197. iac.feerate,
  198. iac.disrate,
  199. iac.auditid,
  200. iac.auditname,
  201. iac.audittime,
  202. iac.auditopinion,
  203. iac.jqappoint,
  204. iac.syappoint,
  205. iac.createtime,
  206. iac.payment_link,
  207. iac.accident_info,
  208. iac.cross_insurance
  209. from ins_orders as o
  210. join ins_area_company iac on o.orderno = iac.orderno
  211. where iac.id = #{companyId}
  212. </select>
  213. <select id="getByUseridAndLicenseNo" resultType="com.ydtech.modules.order.entity.InsOrders"
  214. parameterType="com.ydtech.modules.order.entity.vo.VerifyOrdersVo">
  215. select orderno,
  216. quoteno,
  217. orderstatus,
  218. carinfo,
  219. userid,
  220. username,
  221. deptid,
  222. deptname,
  223. ownerinfo,
  224. applyinfo,
  225. insureinfo,
  226. agreeid,
  227. productid,
  228. product,
  229. createtime,
  230. frameno,
  231. licenseno,
  232. insuredname,
  233. jqstartdate,
  234. jqenddate,
  235. systartdate,
  236. syenddate,
  237. risk,
  238. king,
  239. vehicle_and_vessel_tax
  240. from ins_orders
  241. where userid = #{userId, jdbcType=VARCHAR}
  242. and licenseno = #{licenseNo, jdbcType=VARCHAR}
  243. and createtime > DATE_SUB(CURDATE(), INTERVAL 6 MONTH)
  244. </select>
  245. <select id="queryPageOrderCount" resultType="Long">
  246. select
  247. count(1)
  248. from (
  249. select
  250. io.orderno
  251. from
  252. ins_orders io
  253. <!--如果存在 公司查询则进行连表 -->
  254. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  255. left JOIN
  256. ins_area_company iac on iac.orderno = io.orderno
  257. </if>
  258. <where>
  259. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  260. and io.orderno = #{orderQueryVo.orderNo}
  261. </if>
  262. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' and isTeamLeader">
  263. and io.deptid like "${orderQueryVo.deptId}%"
  264. </if>
  265. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  266. and io.orderstatus = #{orderQueryVo.orderStatus}
  267. </if>
  268. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  269. and io.frameno = #{orderQueryVo.frameNo}
  270. </if>
  271. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  272. and io.licenseno = #{orderQueryVo.licenseNo}
  273. </if>
  274. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  275. and io.insuredname = #{orderQueryVo.insuredName}
  276. </if>
  277. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  278. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  279. </if>
  280. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  281. and iac.company_id = #{orderQueryVo.companyId}
  282. </if>
  283. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
  284. and io.operatorid = #{orderQueryVo.userId}
  285. </if>
  286. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
  287. and io.userid = #{orderQueryVo.userId}
  288. </if>
  289. </where>
  290. group by io.orderno
  291. ) as s
  292. </select>
  293. <select id="queryPageOrder" resultMap="BaseResultMap">
  294. select
  295. io.*
  296. from
  297. ins_orders io
  298. <!--如果存在 公司查询则进行连表 -->
  299. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  300. left JOIN
  301. ins_area_company iac on iac.orderno = io.orderno
  302. </if>
  303. <where>
  304. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  305. and io.orderno = #{orderQueryVo.orderNo}
  306. </if>
  307. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' and isTeamLeader">
  308. and io.deptid like "${orderQueryVo.deptId}%"
  309. </if>
  310. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  311. and io.orderstatus = #{orderQueryVo.orderStatus}
  312. </if>
  313. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  314. and io.frameno = #{orderQueryVo.frameNo}
  315. </if>
  316. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  317. and io.licenseno = #{orderQueryVo.licenseNo}
  318. </if>
  319. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  320. and io.insuredname = #{orderQueryVo.insuredName}
  321. </if>
  322. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  323. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  324. </if>
  325. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  326. and iac.company_id = #{orderQueryVo.companyId}
  327. </if>
  328. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
  329. and io.operatorid = #{orderQueryVo.userId}
  330. </if>
  331. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
  332. and io.userid = #{orderQueryVo.userId}
  333. </if>
  334. </where>
  335. group by orderno
  336. order by io.createtime desc
  337. </select>
  338. <select id="queryOrderList" parameterType="com.ydtech.modules.ins.model.InsOrdersExcelVo" resultMap="OrderExcelResultMap">
  339. select
  340. a.orderno,
  341. a.licenseno,
  342. a.frameno,
  343. a.carinfo,
  344. b.api_type,
  345. b.score,
  346. a.ownerinfo,
  347. b.jqpremium,
  348. b.jqpolicyno,
  349. b.sypremium,
  350. b.sypolicyno,
  351. b.jypremium,
  352. b.taxamount,
  353. b.jq_start_date,
  354. b.jq_end_date,
  355. b.sy_start_date,
  356. b.sy_end_date,
  357. b.score,
  358. b.jq_score,
  359. b.sy_score,
  360. b.loss_ration,
  361. b.jq_loss_ration,
  362. b.sy_loss_ration,
  363. b.score,
  364. b.inscompany,
  365. b.agreement_id,
  366. a.userid,
  367. a.username,
  368. a.applyinfo,
  369. a.insureinfo,
  370. b.kindinfo,
  371. b.pay_date,
  372. b.signing_time,
  373. b.cross_insurance
  374. FROM ins_orders a LEFT JOIN ins_area_company b on a.orderno = b.orderno
  375. WHERE
  376. 1 = 1
  377. <if test="orderstatus != null and orderstatus != '' ">
  378. and b.inside_order_status = #{orderstatus}
  379. </if>
  380. <if test="startDate != null ">
  381. and a.createtime &gt;= #{startDate}
  382. </if>
  383. <if test="endDate != null ">
  384. and a.createtime &lt;= #{endDate}
  385. </if>
  386. </select>
  387. <resultMap id="PolicyInsuranceReportMap" type="com.ydtech.modules.order.entity.vo.PolicyInsuranceReportResVo">
  388. <result property="insCompany" column="insCompany" jdbcType="VARCHAR"/>
  389. <result property="agreementName" column="agreementName" jdbcType="VARCHAR"/>
  390. <result property="policyNo" column="policyNo" jdbcType="VARCHAR"/>
  391. <result property="quoteDate" column="quoteDate" jdbcType="VARCHAR"/>
  392. <result property="policyStartDate" column="policyStartDate" jdbcType="VARCHAR"/>
  393. <result property="riskName" column="riskName" jdbcType="VARCHAR"/>
  394. <result property="sumPremium" column="sumPremium" jdbcType="DECIMAL"/>
  395. <result property="taxPremium" column="taxPremium" jdbcType="DECIMAL"/>
  396. <result property="taxLaterPremium" column="taxLaterPremium" jdbcType="DECIMAL"/>
  397. <result property="insuranceSubAmount" column="insuranceSubAmount" jdbcType="VARCHAR"/>
  398. <result property="licenseNo" column="licenseNo" jdbcType="VARCHAR"/>
  399. <result property="vehicleUse" column="vehicleUse" jdbcType="VARCHAR"/>
  400. <result property="powerType" column="powerType" jdbcType="VARCHAR"/>
  401. <result property="ciModelClass" column="ciModelClass" jdbcType="VARCHAR"/>
  402. <result property="limitLoad" column="limitLoad" jdbcType="VARCHAR"/>
  403. <result property="appliName" column="appliName" jdbcType="VARCHAR"/>
  404. <result property="insureName" column="insureName" jdbcType="VARCHAR"/>
  405. <result property="deptName" column="deptName" jdbcType="VARCHAR"/>
  406. <result property="userName" column="username" jdbcType="VARCHAR"/>
  407. </resultMap>
  408. <select id="getPolicyInsuranceReport" resultMap="PolicyInsuranceReportMap">
  409. /*交强数据*/
  410. SELECT a.`inscompany` AS insCompany,
  411. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  412. a.`jqpolicyno` AS policyNo,
  413. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  414. a.pay_date AS quoteDate,
  415. </if>
  416. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  417. a.inside_pay_time AS quoteDate,
  418. </if>
  419. a.`jq_start_date` AS policyStartDate,
  420. '交强险' AS riskName,
  421. a.`jqpremium` AS sumPremium,
  422. a.`taxamount` AS taxPremium,
  423. getCarShipLateFee(a.`id`) AS taxLaterPremium,
  424. '交强险 : 200000.00,' AS insuranceSubAmount,
  425. b.`licenseno` AS licenseNo,
  426. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  427. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  428. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  429. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  430. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  431. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  432. b.`deptname` AS deptName,
  433. b.`username` AS userName
  434. FROM ins_area_company a,ins_orders b WHERE a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!='' AND a.`agreement_id` IS NOT NULL
  435. AND a.`orderno`=b.`orderno`
  436. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  437. and b.deptid = #{policyReqVo.deptId}
  438. </if>
  439. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  440. and b.userid = #{policyReqVo.userId}
  441. </if>
  442. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  443. and b.username = #{policyReqVo.userName}
  444. </if>
  445. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  446. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  447. </if>
  448. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  449. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  450. </if>
  451. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  452. and b.productid = #{policyReqVo.productId}
  453. </if>
  454. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  455. and a.company_id = #{policyReqVo.insCompany}
  456. </if>
  457. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  458. and a.operatorid = #{policyReqVo.operatorId}
  459. </if>
  460. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  461. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  462. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  463. </if>
  464. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  465. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  466. </if>
  467. </if>
  468. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  469. and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  470. </if>
  471. UNION ALL
  472. /*##商业数据*/
  473. SELECT a.`inscompany` AS insCompany,
  474. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  475. a.`sypolicyno` AS policyNo,
  476. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  477. a.pay_date AS quoteDate,
  478. </if>
  479. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  480. a.inside_pay_time AS quoteDate,
  481. </if>
  482. a.`sy_start_date` AS policyStartDate,
  483. '商业险' AS riskName,
  484. a.`sypremium` AS sumPremium,
  485. '' AS taxPremium,
  486. '' AS taxLaterPremium,
  487. getSyAmount(a.`orderno`) AS insuranceSubAmount,
  488. b.`licenseno` AS licenseNo,
  489. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  490. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  491. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  492. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  493. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  494. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  495. b.`deptname` AS deptName,
  496. b.`username` AS userName
  497. FROM ins_area_company a,ins_orders b WHERE a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!='' AND a.`agreement_id` IS NOT NULL
  498. AND a.`orderno`=b.`orderno`
  499. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  500. and b.deptid = #{policyReqVo.deptId}
  501. </if>
  502. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  503. and b.userid = #{policyReqVo.userId}
  504. </if>
  505. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  506. and b.username = #{policyReqVo.userName}
  507. </if>
  508. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  509. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  510. </if>
  511. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  512. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  513. </if>
  514. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  515. and b.productid = #{policyReqVo.productId}
  516. </if>
  517. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  518. and a.company_id = #{policyReqVo.insCompany}
  519. </if>
  520. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  521. and a.operatorid = #{policyReqVo.operatorId}
  522. </if>
  523. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  524. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  525. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  526. </if>
  527. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  528. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  529. </if>
  530. </if>
  531. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  532. and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  533. </if>
  534. </select>
  535. <select id="getPolicyInsuranceReportCount" resultType="Long">
  536. select
  537. count(1)
  538. from (
  539. /*交强数据*/
  540. SELECT a.`inscompany` AS insCompany,
  541. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  542. a.`jqpolicyno` AS policyNo,
  543. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  544. a.pay_date AS quoteDate,
  545. </if>
  546. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  547. a.inside_pay_time AS quoteDate,
  548. </if>
  549. a.`jq_start_date` AS policyStartDate,
  550. '交强险' AS riskName,
  551. a.`jqpremium` AS sumPremium,
  552. a.`taxamount` AS taxPremium,
  553. getCarShipLateFee(a.`id`) AS taxLaterPremium,
  554. '交强险 : 200000.00,' AS insuranceSubAmount,
  555. b.`licenseno` AS licenseNo,
  556. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  557. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  558. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  559. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  560. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  561. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  562. b.`deptname` AS deptName,
  563. b.`username` AS userName
  564. FROM ins_area_company a,ins_orders b WHERE a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!='' AND a.`agreement_id` IS NOT NULL
  565. AND a.`orderno`=b.`orderno`
  566. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  567. and b.deptid = #{policyReqVo.deptId}
  568. </if>
  569. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  570. and b.userid = #{policyReqVo.userId}
  571. </if>
  572. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  573. and b.username = #{policyReqVo.userName}
  574. </if>
  575. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  576. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  577. </if>
  578. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  579. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  580. </if>
  581. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  582. and b.productid = #{policyReqVo.productId}
  583. </if>
  584. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  585. and a.company_id = #{policyReqVo.insCompany}
  586. </if>
  587. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  588. and a.operatorid = #{policyReqVo.operatorId}
  589. </if>
  590. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  591. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  592. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  593. </if>
  594. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  595. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  596. </if>
  597. </if>
  598. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  599. and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  600. </if>
  601. UNION ALL
  602. /*##商业数据*/
  603. SELECT a.`inscompany` AS insCompany,
  604. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  605. a.`sypolicyno` AS policyNo,
  606. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  607. a.pay_date AS quoteDate,
  608. </if>
  609. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  610. a.inside_pay_time AS quoteDate,
  611. </if>
  612. a.`sy_start_date` AS policyStartDate,
  613. '商业险' AS riskName,
  614. a.`sypremium` AS sumPremium,
  615. '' AS taxPremium,
  616. '' AS taxLaterPremium,
  617. getSyAmount(a.`orderno`) AS insuranceSubAmount,
  618. b.`licenseno` AS licenseNo,
  619. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  620. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  621. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  622. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  623. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  624. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  625. b.`deptname` AS deptName,
  626. b.`username` AS userName
  627. FROM ins_area_company a,ins_orders b WHERE a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!='' AND a.`agreement_id` IS NOT NULL
  628. AND a.`orderno`=b.`orderno`
  629. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  630. and b.deptid = #{policyReqVo.deptId}
  631. </if>
  632. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  633. and b.userid = #{policyReqVo.userId}
  634. </if>
  635. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  636. and b.username = #{policyReqVo.userName}
  637. </if>
  638. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  639. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  640. </if>
  641. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  642. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  643. </if>
  644. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  645. and b.productid = #{policyReqVo.productId}
  646. </if>
  647. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  648. and a.company_id = #{policyReqVo.insCompany}
  649. </if>
  650. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  651. and a.operatorid = #{policyReqVo.operatorId}
  652. </if>
  653. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  654. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  655. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  656. </if>
  657. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  658. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  659. </if>
  660. </if>
  661. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  662. and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  663. </if>
  664. ) as s
  665. </select>
  666. </mapper>