InsOrdersMapper.xml 36 KB

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