ReportInsurancePolicyMapper.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  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.report.dao.ReportInsurancePolicyMapper">
  6. <resultMap id="BaseResultMap" type="com.ydtech.modules.report.model.ReportInsurancePolicy">
  7. <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
  8. <result property="insCompany" column="ins_company" jdbcType="VARCHAR"/>
  9. <result property="agreementId" column="agreement_id" jdbcType="VARCHAR"/>
  10. <result property="agreementName" column="agreement_name" jdbcType="VARCHAR"/>
  11. <result property="policyno" column="policyno" jdbcType="VARCHAR"/>
  12. <result property="insidePayTime" column="inside_pay_time" jdbcType="TIMESTAMP"/>
  13. <result property="startDate" column="start_date" jdbcType="VARCHAR"/>
  14. <result property="endDate" column="end_date" jdbcType="VARCHAR"/>
  15. <result property="riskCode" column="risk_code" jdbcType="VARCHAR"/>
  16. <result property="riskName" column="risk_name" jdbcType="VARCHAR"/>
  17. <result property="sumpremium" column="sumpremium" jdbcType="DECIMAL"/>
  18. <result property="taxpremium" column="taxpremium" jdbcType="DECIMAL"/>
  19. <result property="taxLaterPremium" column="tax_later_premium" jdbcType="DECIMAL"/>
  20. <result property="insuranceSubAmount" column="insurance_sub_amount" jdbcType="VARCHAR"/>
  21. <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
  22. <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
  23. <result property="vehicleUse" column="vehicle_use" jdbcType="VARCHAR"/>
  24. <result property="powerType" column="power_type" jdbcType="VARCHAR"/>
  25. <result property="cimodelclass" column="cimodelclass" jdbcType="VARCHAR"/>
  26. <result property="limitLoad" column="limit_load" jdbcType="VARCHAR"/>
  27. <result property="appliName" column="appli_name" jdbcType="VARCHAR"/>
  28. <result property="insureName" column="insure_name" jdbcType="VARCHAR"/>
  29. <result property="deptid" column="deptid" jdbcType="VARCHAR"/>
  30. <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
  31. <result property="userid" column="userid" jdbcType="VARCHAR"/>
  32. <result property="username" column="username" jdbcType="VARCHAR"/>
  33. <result property="productid" column="productid" jdbcType="VARCHAR"/>
  34. <result property="product" column="product" jdbcType="VARCHAR"/>
  35. <result property="operatorid" column="operatorid" jdbcType="VARCHAR"/>
  36. <result property="sumCostsPremiums" column="sum_costs_premiums" jdbcType="DECIMAL"/>
  37. <result property="superviseCostsPremiums" column="supervise_costs_premiums" jdbcType="DECIMAL"/>
  38. <result property="otherCostsPremiums" column="other_costs_premiums" jdbcType="DECIMAL"/>
  39. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  40. </resultMap>
  41. <select id="queryOrderAndCostData" resultMap="OrderAndCostDataMap">
  42. SELECT
  43. <!--下钻查询时拼接-->
  44. <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '1'.toString()">
  45. <!--按团队下钻时-->
  46. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '1'.toString()">
  47. p.`username`,p.userid userId,
  48. </if>
  49. <!--按机构下钻时-->
  50. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '0'.toString()">
  51. <choose>
  52. <!--下钻的是五级机构时,下钻到团队-->
  53. <when test="reportReqVo.drilFlag != null and reportReqVo.drilFlag == '0'.toString()">
  54. p.deptid,
  55. </when>
  56. <!--下钻的非五级机构时,下钻到下级机构-->
  57. <otherwise>
  58. substr(p.deptid,1,#{reportReqVo.drilFlag}) institutionId,
  59. </otherwise>
  60. </choose>
  61. </if>
  62. <!--团队返回上层时-->
  63. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
  64. p.deptid,
  65. </if>
  66. <!--机构返回上层时-->
  67. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
  68. substr(p.deptid,1,#{reportReqVo.drilFlag}) institutionId,
  69. </if>
  70. </if>
  71. <if test="reportReqVo.riskCode != null and reportReqVo.riskCode != ''">
  72. <if test="reportReqVo.riskCode!='ALL'.toString()">
  73. p.`risk_name` risk_name,
  74. </if>
  75. </if>
  76. count(distinct policyno) policy_count,
  77. SUM(p.`sumpremium`) sumpremium,
  78. SUM(p.`supervise_costs_premiums`) supervise_costs_premiums,
  79. SUM(p.`other_costs_premiums`) other_costs_premiums,
  80. SUM(p.`sum_costs_premiums`) sum_costs_premiums
  81. FROM
  82. report_insurance_policy p WHERE 1=1
  83. <!--下钻查询时拼接-->
  84. <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '1'.toString()">
  85. <!--按团队下钻时-->
  86. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '1'.toString()">
  87. <if test="reportReqVo.teamCode != null and reportReqVo.teamCode != ''">
  88. and p.deptid = #{reportReqVo.teamCode}
  89. </if>
  90. </if>
  91. <!--按机构下钻时-->
  92. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '0'.toString()">
  93. <choose>
  94. <!--下钻的是五级机构时,下钻到团队-->
  95. <when test="reportReqVo.drilFlag != null and reportReqVo.drilFlag == '0'.toString()">
  96. and p.deptid in (SELECT id FROM `sys_dept` WHERE parent_id= #{reportReqVo.deptId} )
  97. </when>
  98. <!--下钻的非五级机构时,下钻到下级机构-->
  99. <otherwise>
  100. and substr(p.deptid,1,#{reportReqVo.drilFlag}) in (SELECT id FROM `sys_dept` WHERE parent_id= #{reportReqVo.deptId} )
  101. </otherwise>
  102. </choose>
  103. </if>
  104. <!--团队返回上层时-->
  105. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
  106. and p.deptid = #{reportReqVo.deptId}
  107. </if>
  108. <!--机构返回上层时-->
  109. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
  110. and substr(p.deptid,1,#{reportReqVo.drilFlag}) = #{reportReqVo.deptId}
  111. </if>
  112. </if>
  113. <!--非下钻查询时拼接-->
  114. <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '0'.toString()">
  115. <choose>
  116. <!--条件中团队不为空时,直接拼接团队-->
  117. <when test="reportReqVo.teamCode != null and reportReqVo.teamCode != ''">
  118. and p.deptid = #{reportReqVo.teamCode}
  119. </when>
  120. <!--条件中团队为空时,使用机构模糊查询-->
  121. <otherwise>
  122. <if test="reportReqVo.deptId != null and reportReqVo.deptId != ''">
  123. and p.deptid like #{reportReqVo.deptId}"%"
  124. </if>
  125. </otherwise>
  126. </choose>
  127. <if test="reportReqVo.userId != null and reportReqVo.userId != ''">
  128. and p.userid = #{reportReqVo.userId}
  129. </if>
  130. </if>
  131. <!--通用查询条件拼接-->
  132. <if test="reportReqVo.insCompany != null and reportReqVo.insCompany != ''">
  133. and p.company_id = #{reportReqVo.insCompany}
  134. </if>
  135. <if test="reportReqVo.riskCode != null and reportReqVo.riskCode != ''">
  136. <if test="reportReqVo.riskCode!='ALL'.toString()">
  137. and p.risk_code = #{reportReqVo.riskCode}
  138. </if>
  139. </if>
  140. <if test="reportReqVo.quoteStartDate != null and reportReqVo.quoteEndDate != null">
  141. and p.inside_pay_time between #{reportReqVo.quoteStartDate} AND #{reportReqVo.quoteEndDate}
  142. </if>
  143. <choose>
  144. <when test="reportReqVo.riskCode != null and reportReqVo.riskCode!='ALL'.toString()">
  145. GROUP BY p.`risk_name`
  146. <!--下钻查询时拼接-->
  147. <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '1'.toString()">
  148. <!--按团队下钻时-->
  149. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '1'.toString()">
  150. ,p.`username`,p.userid order by p.`username`,p.`risk_name`
  151. </if>
  152. <!--按机构下钻时-->
  153. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '0'.toString()">
  154. <choose>
  155. <!--下钻的是五级机构时,下钻到团队-->
  156. <when test="reportReqVo.drilFlag != null and reportReqVo.drilFlag == '0'.toString()">
  157. ,p.deptid order by p.deptid,p.`risk_name`
  158. </when>
  159. <!--下钻的非五级机构时,下钻到下级机构-->
  160. <otherwise>
  161. ,substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag}),p.`risk_name`
  162. </otherwise>
  163. </choose>
  164. </if>
  165. <!--团队返回上层时-->
  166. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
  167. ,p.deptid order by p.deptid
  168. </if>
  169. <!--机构返回上层时-->
  170. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
  171. ,substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag})
  172. </if>
  173. </if>
  174. </when>
  175. <otherwise>
  176. <!--下钻查询时拼接-->
  177. <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '1'.toString()">
  178. <!--按团队下钻时-->
  179. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '1'.toString()">
  180. group by p.`username`,p.userid order by p.`username`
  181. </if>
  182. <!--按机构下钻时-->
  183. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '0'.toString()">
  184. <choose>
  185. <!--下钻的是五级机构时,下钻到团队-->
  186. <when test="reportReqVo.drilFlag != null and reportReqVo.drilFlag == '0'.toString()">
  187. group by p.deptid order by p.deptid
  188. </when>
  189. <!--下钻的非五级机构时,下钻到下级机构-->
  190. <otherwise>
  191. group by substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag})
  192. </otherwise>
  193. </choose>
  194. </if>
  195. <!--团队返回上层时-->
  196. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
  197. group by p.deptid order by p.deptid
  198. </if>
  199. <!--机构返回上层时-->
  200. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
  201. group by substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag})
  202. </if>
  203. </if>
  204. </otherwise>
  205. </choose>
  206. </select>
  207. <resultMap id="OrderAndCostDataMap" type="com.ydtech.modules.report.model.vo.OrderVolumeAndCostStatisticsResVo">
  208. <result property="institution" column="institution" jdbcType="VARCHAR"/>
  209. <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
  210. <result property="username" column="username" jdbcType="VARCHAR"/>
  211. <result property="riskName" column="risk_name" jdbcType="VARCHAR"/>
  212. <result property="policyCount" column="policy_count" jdbcType="DECIMAL"/>
  213. <result property="sumPremium" column="sumremium" jdbcType="DECIMAL"/>
  214. <result property="sumCostsPremiums" column="sum_costs_premiums" jdbcType="DECIMAL"/>
  215. <result property="superviseCostsPremiums" column="supervise_costs_premiums" jdbcType="DECIMAL"/>
  216. <result property="otherCostsPremiums" column="other_costs_premiums" jdbcType="DECIMAL"/>
  217. </resultMap>
  218. <select id="queryOrderAndCostDataCount" resultType="Long">
  219. select
  220. count(1)
  221. from (
  222. SELECT
  223. <!--下钻查询时拼接-->
  224. <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '1'.toString()">
  225. <!--按团队下钻时-->
  226. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '1'.toString()">
  227. p.`username`,p.userid userId,
  228. </if>
  229. <!--按机构下钻时-->
  230. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '0'.toString()">
  231. <choose>
  232. <!--下钻的是五级机构时,下钻到团队-->
  233. <when test="reportReqVo.drilFlag != null and reportReqVo.drilFlag == '0'.toString()">
  234. p.deptid,
  235. </when>
  236. <!--下钻的非五级机构时,下钻到下级机构-->
  237. <otherwise>
  238. substr(p.deptid,1,#{reportReqVo.drilFlag}) institutionId,
  239. </otherwise>
  240. </choose>
  241. </if>
  242. <!--团队返回上层时-->
  243. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
  244. p.deptid,
  245. </if>
  246. <!--机构返回上层时-->
  247. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
  248. substr(p.deptid,1,#{reportReqVo.drilFlag}) institutionId,
  249. </if>
  250. </if>
  251. <if test="reportReqVo.riskCode != null and reportReqVo.riskCode != ''">
  252. <if test="reportReqVo.riskCode!='ALL'.toString()">
  253. p.`risk_name` risk_name,
  254. </if>
  255. </if>
  256. count(distinct policyno) policy_count,
  257. SUM(p.`sumpremium`) sumpremium,
  258. SUM(p.`supervise_costs_premiums`) supervise_costs_premiums,
  259. SUM(p.`other_costs_premiums`) other_costs_premiums,
  260. SUM(p.`sum_costs_premiums`) sum_costs_premiums
  261. FROM
  262. report_insurance_policy p WHERE 1=1
  263. <!--下钻查询时拼接-->
  264. <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '1'.toString()">
  265. <!--按团队下钻时-->
  266. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '1'.toString()">
  267. <if test="reportReqVo.teamCode != null and reportReqVo.teamCode != ''">
  268. and p.deptid = #{reportReqVo.teamCode}
  269. </if>
  270. </if>
  271. <!--按机构下钻时-->
  272. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '0'.toString()">
  273. <choose>
  274. <!--下钻的是五级机构时,下钻到团队-->
  275. <when test="reportReqVo.drilFlag != null and reportReqVo.drilFlag == '0'.toString()">
  276. and p.deptid in (SELECT id FROM `sys_dept` WHERE parent_id= #{reportReqVo.deptId} )
  277. </when>
  278. <!--下钻的非五级机构时,下钻到下级机构-->
  279. <otherwise>
  280. and substr(p.deptid,1,#{reportReqVo.drilFlag}) in (SELECT id FROM `sys_dept` WHERE parent_id= #{reportReqVo.deptId} )
  281. </otherwise>
  282. </choose>
  283. </if>
  284. <!--团队返回上层时-->
  285. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
  286. and p.deptid = #{reportReqVo.deptId}
  287. </if>
  288. <!--机构返回上层时-->
  289. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
  290. and substr(p.deptid,1,#{reportReqVo.drilFlag}) = #{reportReqVo.deptId}
  291. </if>
  292. </if>
  293. <!--非下钻查询时拼接-->
  294. <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '0'.toString()">
  295. <choose>
  296. <!--条件中团队不为空时,直接拼接团队-->
  297. <when test="reportReqVo.teamCode != null and reportReqVo.teamCode != ''">
  298. and p.deptid = #{reportReqVo.teamCode}
  299. </when>
  300. <!--条件中团队为空时,使用机构模糊查询-->
  301. <otherwise>
  302. <if test="reportReqVo.deptId != null and reportReqVo.deptId != ''">
  303. and p.deptid like #{reportReqVo.deptId}"%"
  304. </if>
  305. </otherwise>
  306. </choose>
  307. <if test="reportReqVo.userId != null and reportReqVo.userId != ''">
  308. and p.userid = #{reportReqVo.userId}
  309. </if>
  310. </if>
  311. <!--通用查询条件拼接-->
  312. <if test="reportReqVo.insCompany != null and reportReqVo.insCompany != ''">
  313. and p.company_id = #{reportReqVo.insCompany}
  314. </if>
  315. <if test="reportReqVo.riskCode != null and reportReqVo.riskCode != ''">
  316. <if test="reportReqVo.riskCode!='ALL'.toString()">
  317. and p.risk_code = #{reportReqVo.riskCode}
  318. </if>
  319. </if>
  320. <if test="reportReqVo.quoteStartDate != null and reportReqVo.quoteEndDate != null">
  321. and p.inside_pay_time between #{reportReqVo.quoteStartDate} AND #{reportReqVo.quoteEndDate}
  322. </if>
  323. <choose>
  324. <when test="reportReqVo.riskCode != null and reportReqVo.riskCode!='ALL'.toString()">
  325. GROUP BY p.`risk_name`
  326. <!--下钻查询时拼接-->
  327. <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '1'.toString()">
  328. <!--按团队下钻时-->
  329. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '1'.toString()">
  330. ,p.`username`,p.userid order by p.`username`,p.`risk_name`
  331. </if>
  332. <!--按机构下钻时-->
  333. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '0'.toString()">
  334. <choose>
  335. <!--下钻的是五级机构时,下钻到团队-->
  336. <when test="reportReqVo.drilFlag != null and reportReqVo.drilFlag == '0'.toString()">
  337. ,p.deptid order by p.deptid,p.`risk_name`
  338. </when>
  339. <!--下钻的非五级机构时,下钻到下级机构-->
  340. <otherwise>
  341. ,substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag}),p.`risk_name`
  342. </otherwise>
  343. </choose>
  344. </if>
  345. <!--团队返回上层时-->
  346. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
  347. ,p.deptid order by p.deptid
  348. </if>
  349. <!--机构返回上层时-->
  350. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
  351. ,substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag})
  352. </if>
  353. </if>
  354. </when>
  355. <otherwise>
  356. <!--下钻查询时拼接-->
  357. <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '1'.toString()">
  358. <!--按团队下钻时-->
  359. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '1'.toString()">
  360. group by p.`username`,p.userid order by p.`username`
  361. </if>
  362. <!--按机构下钻时-->
  363. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '0'.toString()">
  364. <choose>
  365. <!--下钻的是五级机构时,下钻到团队-->
  366. <when test="reportReqVo.drilFlag != null and reportReqVo.drilFlag == '0'.toString()">
  367. group by p.deptid order by p.deptid
  368. </when>
  369. <!--下钻的非五级机构时,下钻到下级机构-->
  370. <otherwise>
  371. group by substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag})
  372. </otherwise>
  373. </choose>
  374. </if>
  375. <!--团队返回上层时-->
  376. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
  377. group by p.deptid order by p.deptid
  378. </if>
  379. <!--机构返回上层时-->
  380. <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
  381. group by substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag})
  382. </if>
  383. </if>
  384. </otherwise>
  385. </choose>
  386. ) as s
  387. </select>
  388. <resultMap id="OrderVolumeAndCostStatisticsListResMap" type="com.ydtech.modules.report.model.vo.OrderVolumeAndCostStatisticsListResVo">
  389. <result property="insCompany" column="ins_company" jdbcType="VARCHAR"/>
  390. <result property="agreementName" column="agreement_name" jdbcType="VARCHAR"/>
  391. <result property="policyno" column="policyno" jdbcType="VARCHAR"/>
  392. <result property="insidePayTime" column="inside_pay_time" jdbcType="VARCHAR"/>
  393. <result property="startDate" column="start_date" jdbcType="VARCHAR"/>
  394. <result property="endDate" column="end_date" jdbcType="VARCHAR"/>
  395. <result property="riskName" column="risk_name" jdbcType="VARCHAR"/>
  396. <result property="sumpremium" column="sumpremium" jdbcType="DECIMAL"/>
  397. <result property="taxpremium" column="taxpremium" jdbcType="DECIMAL"/>
  398. <result property="taxLaterPremium" column="tax_later_premium" jdbcType="DECIMAL"/>
  399. <result property="insuranceSubAmount" column="insurance_sub_amount" jdbcType="VARCHAR"/>
  400. <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
  401. <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
  402. <result property="vehicleUse" column="vehicle_use" jdbcType="VARCHAR"/>
  403. <result property="powerType" column="power_type" jdbcType="VARCHAR"/>
  404. <result property="cimodelclass" column="cimodelclass" jdbcType="VARCHAR"/>
  405. <result property="limitLoad" column="limit_load" jdbcType="VARCHAR"/>
  406. <result property="appliName" column="appli_name" jdbcType="VARCHAR"/>
  407. <result property="insureName" column="insure_name" jdbcType="VARCHAR"/>
  408. <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
  409. <result property="username" column="username" jdbcType="VARCHAR"/>
  410. <result property="product" column="product" jdbcType="VARCHAR"/>
  411. <result property="sumCostsPremiums" column="sum_costs_premiums" jdbcType="DECIMAL"/>
  412. <result property="superviseCostsPremiums" column="supervise_costs_premiums" jdbcType="DECIMAL"/>
  413. <result property="otherCostsPremiums" column="other_costs_premiums" jdbcType="DECIMAL"/>
  414. </resultMap>
  415. <select id="queryOrderAndCostList" resultMap="OrderVolumeAndCostStatisticsListResMap">
  416. SELECT
  417. ins_company,
  418. agreement_name,
  419. policyno,
  420. DATE_FORMAT(inside_pay_time, '%Y-%m-%d') inside_pay_time,
  421. DATE_FORMAT(start_date, '%Y-%m-%d') start_date,
  422. DATE_FORMAT(end_date, '%Y-%m-%d') end_date,
  423. risk_name,
  424. sumpremium,
  425. taxpremium,
  426. tax_later_premium,
  427. insurance_sub_amount,
  428. frameno,
  429. licenseno,
  430. vehicle_use,
  431. power_type,
  432. cimodelclass,
  433. limit_load,
  434. appli_name,
  435. insure_name,
  436. deptname,
  437. username,
  438. product,
  439. sum_costs_premiums,
  440. supervise_costs_premiums,
  441. other_costs_premiums
  442. FROM
  443. report_insurance_policy p WHERE 1=1
  444. <choose>
  445. <!--条件中团队不为空时,直接拼接团队-->
  446. <when test="reportReqVo.teamCode != null and reportReqVo.teamCode != ''">
  447. and p.deptid = #{reportReqVo.teamCode}
  448. </when>
  449. <!--条件中团队为空时,使用机构模糊查询-->
  450. <otherwise>
  451. <if test="reportReqVo.deptId != null and reportReqVo.deptId != ''">
  452. and p.deptid like #{reportReqVo.deptId}"%"
  453. </if>
  454. </otherwise>
  455. </choose>
  456. <if test="reportReqVo.userId != null and reportReqVo.userId != ''">
  457. and p.userid = #{reportReqVo.userId}
  458. </if>
  459. <!--通用查询条件拼接-->
  460. <if test="reportReqVo.insCompany != null and reportReqVo.insCompany != ''">
  461. and p.company_id = #{reportReqVo.insCompany}
  462. </if>
  463. <if test="reportReqVo.riskCode != null and reportReqVo.riskCode != ''">
  464. <if test="reportReqVo.riskCode!='ALL'.toString()">
  465. and p.risk_code = #{reportReqVo.riskCode}
  466. </if>
  467. </if>
  468. <if test="reportReqVo.quoteStartDate != null and reportReqVo.quoteEndDate != null">
  469. and p.inside_pay_time between #{reportReqVo.quoteStartDate} AND #{reportReqVo.quoteEndDate}
  470. </if>
  471. </select>
  472. </mapper>