InsOrdersMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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="carinfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject"
  11. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  12. <result property="userid" column="userid" jdbcType="VARCHAR"/>
  13. <result property="username" column="username" jdbcType="VARCHAR"/>
  14. <result property="deptid" column="deptid" jdbcType="VARCHAR"/>
  15. <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
  16. <result property="ownerinfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject"
  17. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  18. <result property="applyinfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
  19. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  20. <result property="insureinfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
  21. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
  22. jdbcType="VARCHAR"/>
  23. <result property="agreeid" column="agreeid" jdbcType="VARCHAR"/>
  24. <result property="productid" column="productid" jdbcType="VARCHAR"/>
  25. <result property="product" column="product" jdbcType="VARCHAR"/>
  26. <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
  27. <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
  28. <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
  29. <result property="insuredname" column="insuredname" jdbcType="VARCHAR"/>
  30. <result property="jqstartdate" column="jqstartdate" jdbcType="VARCHAR"/>
  31. <result property="jqenddate" column="jqenddate" jdbcType="VARCHAR"/>
  32. <result property="systartdate" column="systartdate" jdbcType="VARCHAR"/>
  33. <result property="syenddate" column="syenddate" jdbcType="VARCHAR"/>
  34. <result property="risk" column="risk" javaType="com.alibaba.fastjson.JSONArray"
  35. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  36. <result property="king" column="king" javaType="com.alibaba.fastjson.JSONArray"
  37. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  38. <result property="vehicleAndVesselTax" column="vehicle_and_vessel_tax"
  39. javaType="com.alibaba.fastjson.JSONObject"
  40. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  41. </resultMap>
  42. <resultMap id="OrderResultMap" type="com.ydtech.modules.order.entity.vo.OrderVo">
  43. <id property="orderno" column="orderno" jdbcType="VARCHAR"/>
  44. <result property="quoteno" column="quoteno" jdbcType="VARCHAR"/>
  45. <result property="orderstatus" column="orderstatus" jdbcType="VARCHAR"/>
  46. <result property="carinfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject"
  47. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  48. <result property="userid" column="userid" jdbcType="VARCHAR"/>
  49. <result property="username" column="username" jdbcType="VARCHAR"/>
  50. <result property="deptid" column="deptid" jdbcType="VARCHAR"/>
  51. <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
  52. <result property="ownerinfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject"
  53. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  54. <result property="applyinfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
  55. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  56. <result property="insureinfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
  57. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
  58. jdbcType="VARCHAR"/>
  59. <result property="agreeid" column="agreeid" jdbcType="VARCHAR"/>
  60. <result property="productid" column="productid" jdbcType="VARCHAR"/>
  61. <result property="product" column="product" jdbcType="VARCHAR"/>
  62. <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
  63. <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
  64. <result property="insuredname" column="insuredname" jdbcType="VARCHAR"/>
  65. <result property="jqstartdate" column="jqstartdate" jdbcType="VARCHAR"/>
  66. <result property="jqenddate" column="jqenddate" jdbcType="VARCHAR"/>
  67. <result property="systartdate" column="systartdate" jdbcType="VARCHAR"/>
  68. <result property="syenddate" column="syenddate" jdbcType="VARCHAR"/>
  69. <result property="id" column="id" jdbcType="BIGINT"/>
  70. <result property="companyId" column="company_id" jdbcType="BIGINT"/>
  71. <result property="reptxt" column="reptxt" javaType="com.alibaba.fastjson.JSONObject"
  72. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  73. <result property="vehicleAndVesselTax" column="vehicle_and_vessel_tax"
  74. javaType="com.alibaba.fastjson.JSONObject"
  75. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  76. <result property="inscompany" column="inscompany" jdbcType="VARCHAR"/>
  77. <result property="jqapplyno" column="jqapplyno" jdbcType="VARCHAR"/>
  78. <result property="jqpolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
  79. <result property="syapplyno" column="syapplyno" jdbcType="VARCHAR"/>
  80. <result property="sypolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
  81. <result property="riskinfo" column="riskinfo" javaType="com.alibaba.fastjson.JSONArray"
  82. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  83. <result property="kindinfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
  84. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  85. <result property="jqpremium" column="jqpremium" jdbcType="DECIMAL"/>
  86. <result property="sypremium" column="sypremium" jdbcType="DECIMAL"/>
  87. <result property="jypremium" column="jypremium" jdbcType="DECIMAL"/>
  88. <result property="taxamount" column="taxamount" jdbcType="DECIMAL"/>
  89. <result property="sumpremium" column="sumpremium" jdbcType="DECIMAL"/>
  90. <result property="jqdiscountrate" column="jqdiscountrate" jdbcType="DOUBLE"/>
  91. <result property="sydiscountrate" column="sydiscountrate" jdbcType="DOUBLE"/>
  92. <result property="feerate" column="feerate" jdbcType="DOUBLE"/>
  93. <result property="disrate" column="disrate" jdbcType="DOUBLE"/>
  94. <result property="auditid" column="auditid" jdbcType="VARCHAR"/>
  95. <result property="auditname" column="auditname" jdbcType="VARCHAR"/>
  96. <result property="audittime" column="audittime" jdbcType="TIMESTAMP"/>
  97. <result property="auditopinion" column="auditopinion" jdbcType="VARCHAR"/>
  98. <result property="jqappoint" column="jqappoint" jdbcType="VARCHAR"/>
  99. <result property="syappoint" column="syappoint" jdbcType="VARCHAR"/>
  100. <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
  101. <result property="paymentLink" column="payment_link" jdbcType="VARCHAR"/>
  102. <result property="accidentInfo" column="accident_info" javaType="com.alibaba.fastjson.JSONArray"
  103. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  104. <result property="taxArrears" column="tax_arrears" javaType="com.alibaba.fastjson.JSONArray"
  105. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  106. <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
  107. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  108. </resultMap>
  109. <sql id="Base_Column_List">
  110. orderno,quoteno,orderstatus,
  111. carinfo,userid,username,
  112. deptid,deptname,ownerinfo,
  113. applyinfo,insureinfo,agreeid,
  114. productid,product,createtime,
  115. frameno,licenseno,insuredname,
  116. jqstartdate,jqenddate,systartdate,
  117. syenddate
  118. </sql>
  119. <select id="getOrderAndAreaCompany" parameterType="java.lang.String" resultMap="OrderResultMap">
  120. select o.orderno,
  121. o.quoteno,
  122. o.carinfo,
  123. o.userid,
  124. o.username,
  125. o.deptid,
  126. o.deptname,
  127. o.ownerinfo,
  128. o.applyinfo,
  129. o.insureinfo,
  130. o.agreeid,
  131. o.productid,
  132. o.product,
  133. o.frameno,
  134. o.licenseno,
  135. o.insuredname,
  136. o.vehicle_and_vessel_tax,
  137. iac.jq_start_date as jqstartdate,
  138. iac.jq_end_date as jqenddate,
  139. iac.sy_start_date as systartdate,
  140. iac.sy_end_date as syenddate,
  141. iac.id,
  142. iac.company_id,
  143. iac.reptxt,
  144. iac.orderstatus,
  145. iac.inscompany,
  146. iac.jqapplyno,
  147. iac.jqpolicyno,
  148. iac.syapplyno,
  149. iac.sypolicyno,
  150. iac.riskinfo,
  151. iac.kindinfo,
  152. iac.jqpremium,
  153. iac.sypremium,
  154. iac.jypremium,
  155. iac.taxamount,
  156. iac.sumpremium,
  157. iac.jqdiscountrate,
  158. iac.sydiscountrate,
  159. iac.feerate,
  160. iac.disrate,
  161. iac.auditid,
  162. iac.auditname,
  163. iac.audittime,
  164. iac.auditopinion,
  165. iac.jqappoint,
  166. iac.syappoint,
  167. iac.createtime,
  168. iac.payment_link,
  169. iac.accident_info,
  170. iac.tax_arrears,
  171. iac.cross_insurance
  172. from ins_orders as o
  173. join ins_area_company iac on o.orderno = iac.orderno
  174. where iac.id = #{companyId}
  175. </select>
  176. <select id="getOrder" resultMap="BaseResultMap" parameterType="com.ydtech.modules.order.entity.vo.OrderQueryVo">
  177. select io.orderno,
  178. io.quoteno,
  179. io.orderstatus,
  180. io.carinfo,
  181. io.userid,
  182. io.username,
  183. io.deptid,
  184. io.deptname,
  185. io.ownerinfo,
  186. io.applyinfo,
  187. io.insureinfo,
  188. io.agreeid,
  189. io.productid,
  190. io.product,
  191. io.createtime,
  192. io.frameno,
  193. io.licenseno,
  194. io.insuredname,
  195. io.jqstartdate,
  196. io.jqenddate,
  197. io.systartdate,
  198. io.syenddate,
  199. io.risk,
  200. io.king,
  201. io.vehicle_and_vessel_tax from ins_orders io
  202. JOIN (SELECT DISTINCT(o.orderno) as orderno
  203. FROM ins_orders o
  204. LEFT JOIN ins_area_company a ON o.orderno = a.orderno
  205. left join sys_user u on o.userid=u.id
  206. WHERE 1 = 1
  207. <if test="orderNo != null and orderNo != ''">
  208. and o.orderno = #{orderNo, jdbcType=VARCHAR}
  209. </if>
  210. <if test="deptId != null and deptId != ''">
  211. and u.dept_id like CONCAT(#{deptId, jdbcType=VARCHAR}, '%')
  212. </if>
  213. <if test="deptId == null and deptId == '' and userId != null and userId != ''">
  214. and o.userid = #{userId, jdbcType=VARCHAR}
  215. </if>
  216. <if test="orderStatus != null and orderStatus != ''">
  217. and a.orderstatus like CONCAT('%', #{orderStatus, jdbcType=VARCHAR}, '%')
  218. </if>
  219. <if test="frameNo != null and frameNo != ''">
  220. and o.frameno like CONCAT('%', #{frameNo, jdbcType=VARCHAR}, '%')
  221. </if>
  222. <if test="licenseNo != null and licenseNo != ''">
  223. and o.licenseno like CONCAT('%', #{licenseNo, jdbcType=VARCHAR}, '%')
  224. </if>
  225. <if test="insuredName != null and insuredName != ''">
  226. and o.insuredname like CONCAT('%', #{insuredName, jdbcType=VARCHAR}, '%')
  227. </if>
  228. <if test="startDate != null and endDate != null">
  229. and o.createtime between #{startDate, jdbcType=TIMESTAMP} and #{endDate, jdbcType=TIMESTAMP}
  230. </if>) as f on io.orderno=f.orderno
  231. order by createtime desc
  232. </select>
  233. <select id="getByUseridAndLicenseNo" resultType="com.ydtech.modules.order.entity.InsOrders"
  234. parameterType="com.ydtech.modules.order.entity.vo.VerifyOrdersVo">
  235. select orderno,
  236. quoteno,
  237. orderstatus,
  238. carinfo,
  239. userid,
  240. username,
  241. deptid,
  242. deptname,
  243. ownerinfo,
  244. applyinfo,
  245. insureinfo,
  246. agreeid,
  247. productid,
  248. product,
  249. createtime,
  250. frameno,
  251. licenseno,
  252. insuredname,
  253. jqstartdate,
  254. jqenddate,
  255. systartdate,
  256. syenddate,
  257. risk,
  258. king,
  259. vehicle_and_vessel_tax
  260. from ins_orders
  261. where userid = #{userId, jdbcType=VARCHAR}
  262. and licenseno = #{licenseNo, jdbcType=VARCHAR}
  263. and createtime > DATE_SUB(CURDATE(), INTERVAL 6 MONTH)
  264. </select>
  265. <select id="selectByOrderQueryVo" resultMap="BaseResultMap" parameterType="com.ydtech.modules.order.entity.vo.OrderQueryVo">
  266. select o.orderno,
  267. o.quoteno,
  268. o.orderstatus,
  269. o.carinfo,
  270. o.userid,
  271. o.username,
  272. o.deptid,
  273. o.deptname,
  274. o.ownerinfo,
  275. o.applyinfo,
  276. o.insureinfo,
  277. o.agreeid,
  278. o.productid,
  279. o.product,
  280. o.createtime,
  281. o.frameno,
  282. o.licenseno,
  283. o.insuredname,
  284. o.jqstartdate,
  285. o.jqenddate,
  286. o.systartdate,
  287. o.syenddate,
  288. o.risk,
  289. o.king,
  290. o.vehicle_and_vessel_tax from ins_orders o
  291. <if test="companyId != null and companyId != ''">
  292. left join ins_area_company iac on iac.orderno = o.orderno
  293. </if>
  294. where 1 = 1
  295. <if test="orderNo != null and orderNo != ''">
  296. and o.orderno = #{orderNo, jdbcType=VARCHAR}
  297. </if>
  298. <if test="deptId != null and deptId != ''">
  299. and o.deptid like CONCAT(#{deptId, jdbcType=VARCHAR}, '%')
  300. </if>
  301. <if test="(deptId == null or deptId == '') and userId != null and userId != ''">
  302. and o.userid = #{userId, jdbcType=VARCHAR}
  303. </if>
  304. <if test="orderStatus != null and orderStatus != ''">
  305. and o.orderstatus like CONCAT('%', #{orderStatus, jdbcType=VARCHAR}, '%')
  306. </if>
  307. <if test="frameNo != null and frameNo != ''">
  308. and o.frameno like CONCAT('%', #{frameNo, jdbcType=VARCHAR}, '%')
  309. </if>
  310. <if test="licenseNo != null and licenseNo != ''">
  311. and o.licenseno like CONCAT('%', #{licenseNo, jdbcType=VARCHAR}, '%')
  312. </if>
  313. <if test="insuredName != null and insuredName != ''">
  314. and o.insuredname like CONCAT('%', #{insuredName, jdbcType=VARCHAR}, '%')
  315. </if>
  316. <if test="startDate != null and endDate != null">
  317. and o.createtime between #{startDate, jdbcType=TIMESTAMP} and DATE_ADD(#{endDate, jdbcType=TIMESTAMP},
  318. INTERVAL 1 DAY)
  319. </if>
  320. <if test="companyId != null and companyId != ''">
  321. and iac.company_id = #{companyId, jdbcType=VARCHAR}
  322. </if>
  323. order by o.createtime desc
  324. </select>
  325. </mapper>