InsCmainMapper.xml 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.ydtech.modules.ins.dao.InsCmainMapper">
  4. <resultMap id="BaseResultMap" type="com.ydtech.modules.ins.model.InsCmain">
  5. <id column="policyno" jdbcType="VARCHAR" property="policyno"/>
  6. <result column="riskcode" jdbcType="VARCHAR" property="riskcode"/>
  7. <result column="riskname" jdbcType="VARCHAR" property="riskcode"/>
  8. <result column="startdate" jdbcType="TIMESTAMP" property="startdate"/>
  9. <result column="enddate" jdbcType="TIMESTAMP" property="enddate"/>
  10. <result column="inscompany" jdbcType="VARCHAR" property="inscompany"/>
  11. <result column="validstatus" jdbcType="VARCHAR" property="validstatus"/>
  12. <result column="insureragentcode" jdbcType="VARCHAR" property="insureragentcode"/>
  13. <result column="insureragentname" jdbcType="VARCHAR" property="insureragentname"/>
  14. <result column="insureragreementno" jdbcType="VARCHAR" property="insureragreementno"/>
  15. <result column="salesagreementno" jdbcType="VARCHAR" property="salesagreementno"/>
  16. <result column="commissionrate" jdbcType="DOUBLE" property="commissionrate"/>
  17. <result column="operatedate" jdbcType="TIMESTAMP" property="operatedate"/>
  18. <result column="insurercomcode" jdbcType="VARCHAR" property="insurercomcode"/>
  19. <result column="insurercomname" jdbcType="VARCHAR" property="insurercomname"/>
  20. <result column="comcode" jdbcType="VARCHAR" property="comcode"/>
  21. <result column="businessnature" jdbcType="VARCHAR" property="businessnature"/>
  22. <result column="handlercode" jdbcType="VARCHAR" property="handlercode"/>
  23. <result column="applicode" jdbcType="VARCHAR" property="applicode"/>
  24. <result column="appliname" jdbcType="VARCHAR" property="appliname"/>
  25. <result column="insuredcode" jdbcType="VARCHAR" property="insuredcode"/>
  26. <result column="insuredname" jdbcType="VARCHAR" property="insuredname"/>
  27. <result column="sumamount" jdbcType="DOUBLE" property="sumamount"/>
  28. <result column="sumpremium" jdbcType="DOUBLE" property="sumpremium"/>
  29. <result column="netpointcode" jdbcType="VARCHAR" property="netpointcode"/>
  30. <result column="netpointname" jdbcType="VARCHAR" property="netpointname"/>
  31. <result column="updatedate" jdbcType="TIMESTAMP" property="updatedate"/>
  32. <result column="carflag" jdbcType="VARCHAR" property="carflag"/>
  33. <result column="channel" jdbcType="VARCHAR" property="channel"/>
  34. <result column="isself" jdbcType="VARCHAR" property="isself"/>
  35. <result column="notaxpremium" jdbcType="DOUBLE" property="notaxpremium"/>
  36. <result column="jffs" jdbcType="VARCHAR" property="jffs"/>
  37. <result column="sfds" jdbcType="VARCHAR" property="sfds"/>
  38. <result column="license_no" jdbcType="VARCHAR" property="licenseNo"/>
  39. <result column="frame_no" jdbcType="VARCHAR" property="frameNo"/>
  40. <result column="engine_no" jdbcType="VARCHAR" property="engineNo"/>
  41. <result column="car_type_no" jdbcType="VARCHAR" property="carTypeNo"/>
  42. <result column="zkxs" jdbcType="VARCHAR" property="zkxs"/>
  43. <result column="applicertno" jdbcType="VARCHAR" property="applicertno"/>
  44. <result column="applimobile" jdbcType="VARCHAR" property="applimobile"/>
  45. <result column="appliaddress" jdbcType="VARCHAR" property="appliaddress"/>
  46. <result column="insuredcertno" jdbcType="VARCHAR" property="insuredcertno"/>
  47. <result column="insuredmobile" jdbcType="VARCHAR" property="insuredmobile"/>
  48. <result column="insuredaddress" jdbcType="VARCHAR" property="insuredaddress"/>
  49. <result column="paydate" jdbcType="TIMESTAMP" property="paydate"/>
  50. </resultMap>
  51. <sql id="Base_Column_List">
  52. policyno, riskcode, riskname, startdate, enddate, inscompany, validstatus, insureragentcode,
  53. insureragentname, insureragreementno, salesagreementno, commissionrate, operatedate,
  54. insurercomcode, insurercomname, comcode, businessnature, handlercode, applicode,
  55. appliname, insuredcode, insuredname, sumamount, sumpremium, netpointcode, netpointname,
  56. updatedate, carflag, channel, isself, notaxpremium, jffs, sfds,
  57. license_no, frame_no, engine_no, car_type_no, zkxs, applicertno, applimobile,
  58. appliaddress, insuredcertno, insuredmobile, insuredaddress, paydate
  59. </sql>
  60. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  61. select
  62. <include refid="Base_Column_List"/>
  63. from ins_cmain
  64. where policyno = #{policyno,jdbcType=VARCHAR}
  65. </select>
  66. <select id="selectInsCmain" resultType="com.ydtech.modules.ins.model.vo.res.InsCmainResVo">
  67. select
  68. <include refid="Base_Column_List"/>,
  69. (select a.name from esm_ins_company a where a.id=inscompany) inscompanyname,
  70. (select a.name from sys_dept a where a.id=comcode) comname,
  71. (select a.name from sys_user a where a.id=handlercode) handlername,
  72. substr(riskcode,1,2) classcode,
  73. (select a.name from esm_product a where a.id=substr(riskcode,1,2)) classname,
  74. '0' hlwbs,
  75. '0' snbs,
  76. (select a.commission from ins_income a where a.policyno=b.policyno) commission
  77. from ins_cmain b
  78. where 1=1
  79. <if test="policyno != null and policyno!=''">
  80. AND policyno=#{policyno,jdbcType=VARCHAR}
  81. </if>
  82. <if test="riskcode != null and riskcode!=''">
  83. AND riskcode=#{riskcode,jdbcType=VARCHAR}
  84. </if>
  85. <if test="riskname != null and riskname!=''">
  86. AND riskname=#{riskname,jdbcType=VARCHAR}
  87. </if>
  88. <if test="startdate != null and enddate != null">
  89. AND DATE_FORMAT(startdate, '%Y-%m-%d') between DATE_FORMAT(#{startdate,jdbcType=TIMESTAMP}, '%Y-%m-%d') and
  90. DATE_FORMAT(#{enddate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  91. </if>
  92. <!-- <if test="enddate != null">-->
  93. <!-- AND DATE_FORMAT(enddate, '%Y-%m-%d') = DATE_FORMAT(#{enddate,jdbcType=TIMESTAMP}, '%Y-%m-%d')-->
  94. <!-- </if>-->
  95. <if test="inscompany != null and inscompany!=''">
  96. AND inscompany=#{inscompany,jdbcType=VARCHAR}
  97. </if>
  98. <if test="validstatus != null and validstatus!=''">
  99. AND validstatus=#{validstatus,jdbcType=VARCHAR}
  100. </if>
  101. <if test="insureragentcode != null and insureragentcode!=''">
  102. AND insureragentcode=#{insureragentcode,jdbcType=VARCHAR}
  103. </if>
  104. <if test="insureragentname != null and insureragentname!=''">
  105. AND insureragentname like concat('%', #{insureragentname,jdbcType=VARCHAR},'%')
  106. </if>
  107. <if test="insureragreementno != null and insureragreementno!=''">
  108. AND insureragreementno=#{insureragreementno,jdbcType=VARCHAR}
  109. </if>
  110. <if test="salesagreementno != null and salesagreementno!=''">
  111. AND salesagreementno=#{salesagreementno,jdbcType=VARCHAR}
  112. </if>
  113. <!-- <if test="operatedate != null">-->
  114. <!-- AND DATE_FORMAT(operatedate, '%Y-%m-%d') = DATE_FORMAT(#{operatedate,jdbcType=TIMESTAMP}, '%Y-%m-%d')-->
  115. <!-- </if>-->
  116. <if test="insurercomcode != null and insurercomcode!=''">
  117. AND insurercomcode=#{insurercomcode,jdbcType=VARCHAR}
  118. </if>
  119. <if test="insurercomname != null and insurercomname!=''">
  120. AND insurercomname like concat('%', #{insurercomname,jdbcType=VARCHAR},'%')
  121. </if>
  122. <if test="comcode != null and comcode!=''">
  123. AND comcode like concat(#{comcode,jdbcType=VARCHAR},'%')
  124. </if>
  125. <if test="businessnature != null and businessnature!=''">
  126. AND businessnature=#{businessnature,jdbcType=VARCHAR}
  127. </if>
  128. <if test="handlercode != null and handlercode!=''">
  129. <choose>
  130. <when test="handlercodeFlag == true">
  131. AND handlercode in (${handlercode})
  132. </when>
  133. <otherwise>
  134. AND handlercode = #{handlercode,jdbcType=VARCHAR}
  135. </otherwise>
  136. </choose>
  137. </if>
  138. <if test="applicode != null and applicode!=''">
  139. AND applicode=#{applicode,jdbcType=VARCHAR}
  140. </if>
  141. <if test="appliname != null and appliname!=''">
  142. AND appliname like concat('%', #{appliname,jdbcType=VARCHAR},'%')
  143. </if>
  144. <if test="insuredcode != null and insuredcode!=''">
  145. AND insuredcode=#{insuredcode,jdbcType=VARCHAR}
  146. </if>
  147. <if test="insuredname != null and insuredname!=''">
  148. AND insuredname like concat('%', #{insuredname,jdbcType=VARCHAR},'%')
  149. </if>
  150. <if test="netpointcode != null and netpointcode!=''">
  151. AND netpointcode=#{netpointcode,jdbcType=VARCHAR}
  152. </if>
  153. <if test="netpointname != null and netpointname!=''">
  154. AND netpointnam like concat('%', #{netpointnam,jdbcType=VARCHAR},'%')
  155. </if>
  156. <if test="updatedate != null">
  157. AND DATE_FORMAT(updatedate, '%Y-%m-%d') = DATE_FORMAT(#{updatedate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  158. </if>
  159. <if test="carflag != null and carflag!=''">
  160. AND carflag=#{carflag,jdbcType=VARCHAR}
  161. </if>
  162. <if test="channel != null and channel!=''">
  163. AND channel=#{channel,jdbcType=VARCHAR}
  164. </if>
  165. <if test="isself != null and isself!=''">
  166. AND isself=#{isself,jdbcType=VARCHAR}
  167. </if>
  168. order by policyno
  169. </select>
  170. <select id="selectInsCmainDetail" resultType="com.ydtech.modules.ins.model.vo.res.InsCmainDetailResVo">
  171. SELECT
  172. SUBSTR(a.comcode, 1,5) com2code,
  173. (SELECT z.name from sys_dept z where z.id=SUBSTR(a.comcode, 1,5)) com2name,
  174. SUBSTR(a.comcode, 1,9) com3code,
  175. (SELECT z.name from sys_dept z where z.id=SUBSTR(a.comcode, 1,9)) com3name,
  176. c.dept_id handlercomcode ,
  177. h.name handlercomname,
  178. a.comcode comcode,
  179. (SELECT z.name from sys_dept z where z.id=a.comcode) comname,
  180. a.handlercode handlercode,
  181. c.name handlername,
  182. a.inscompany inscompany,
  183. d.name inscompanyname,
  184. a.policyno policyno,
  185. '' endorseno,
  186. a.applicode applicode,
  187. a.appliname appliname,
  188. a.insuredcode insuredcode,
  189. a.insuredname insuredname,
  190. i.parent_id classcode,
  191. (select name from esm_product t where t.id=i.parent_id) classname,
  192. a.riskcode riskcode,
  193. a.riskname riskname,
  194. DATE_FORMAT(a.startdate,'%Y-%m-%d') startdate,
  195. DATE_FORMAT(a.enddate,'%Y-%m-%d') enddate,
  196. null updatedate,
  197. null pmOperatedate,
  198. '' tbxg,
  199. '' xzzh,
  200. '' xbzh,
  201. '' cldl,
  202. '' clyt,
  203. '' clxl,
  204. CASE a.businessnature WHEN '1' THEN '直属业务' WHEN '2' THEN '代理业务' ELSE '' END businessnature,
  205. '' ywqd,
  206. a.sumpremium sumpremium,
  207. a.notaxpremium notaxpremium,
  208. a.commissionrate commissionrate,
  209. e.commission commission,
  210. a.jffs jffs,
  211. CASE a.sfds WHEN '1' THEN '是' WHEN '0' THEN '否' ELSE '' END sfds,
  212. a.sumamount sumamount,
  213. CASE a.channel WHEN '1' THEN '核心' WHEN '2' THEN '二维码' WHEN '3' THEN '车加意' ELSE '' END channel,
  214. a.license_no licenseNo,
  215. a.frame_no frameNo,
  216. a.engine_no engineNo,
  217. a.car_type_no carTypeNo,
  218. a.zkxs zkxs,
  219. a.applicertno applicertno,
  220. a.applimobile applimobile,
  221. a.appliaddress appliaddress,
  222. a.insuredcertno insuredcertno,
  223. a.insuredmobile insuredmobile,
  224. a.insuredaddress insuredaddress,
  225. a.paydate paydate
  226. FROM
  227. ins_cmain a
  228. left JOIN ins_pmain b ON a.policyno = b.policyno
  229. LEFT JOIN sys_user c ON a.handlercode=c.id
  230. LEFT JOIN sys_dept h ON h.id=c.dept_id
  231. LEFT JOIN esm_ins_company d ON a.inscompany=d.id
  232. LEFT JOIN ins_income e ON e.policyno=a.policyno
  233. /*LEFT JOIN ods_riskinfo f ON a.policyno=f.policy_no
  234. LEFT join ods_carinfo g ON g.order_no=f.order_no*/
  235. LEFT JOIN esm_product i ON i.id=a.riskcode
  236. where 1=1
  237. <if test="carflag != null and carflag!=''">
  238. AND a.carflag=#{carflag,jdbcType=VARCHAR}
  239. </if>
  240. <if test="operatedate != null">
  241. AND DATE_FORMAT(a.operatedate,'%Y-%m-%d') between DATE_FORMAT(#{operatedate,jdbcType=TIMESTAMP},'%Y-%m-%d')
  242. and DATE_FORMAT(#{operatedate,jdbcType=TIMESTAMP} ,'%Y-%m-%d')
  243. </if>
  244. <if test="startdate != null and enddate!=null">
  245. AND DATE_FORMAT(a.startdate,'%Y-%m-%d') between DATE_FORMAT(#{startdate,jdbcType=TIMESTAMP},'%Y-%m-%d') and
  246. DATE_FORMAT(#{enddate,jdbcType=TIMESTAMP},'%Y-%m-%d')
  247. </if>
  248. <if test="inscompany != null and inscompany!=''">
  249. AND a.inscompany like concat(#{inscompany,jdbcType=VARCHAR},'%')
  250. </if>
  251. <if test="policyno != null and policyno!=''">
  252. AND a.policyno=#{policyno,jdbcType=VARCHAR}
  253. </if>
  254. <if test="comcode != null and comcode!=''">
  255. AND a.comcode like concat(#{comcode,jdbcType=VARCHAR},'%')
  256. </if>
  257. <if test="handlercode != null and handlercode!=''">
  258. AND a.handlercode=#{handlercode,jdbcType=VARCHAR}
  259. </if>
  260. UNION
  261. SELECT
  262. SUBSTR(a.comcode, 1,5) com2code,
  263. (SELECT z.name from sys_dept z where z.id=SUBSTR(a.comcode, 1,5)) com2name,
  264. SUBSTR(a.comcode, 1,9) com3code,
  265. (SELECT z.name from sys_dept z where z.id=SUBSTR(a.comcode, 1,9)) com3name,
  266. c.dept_id handlercomcode ,
  267. h.name handlercomname,
  268. a.comcode comcode,
  269. (SELECT z.name from sys_dept z where z.id=a.comcode) comname,
  270. a.handlercode handlercode,
  271. c.name handlername,
  272. a.inscompany inscompany,
  273. d.name inscompanyname,
  274. a.policyno policyno,
  275. b.endorseno endorseno,
  276. a.applicode applicode,
  277. a.appliname appliname,
  278. a.insuredcode insuredcode,
  279. a.insuredname insuredname,
  280. i.parent_id classcode,
  281. (select name from esm_product t where t.id=i.parent_id) classname,
  282. a.riskcode riskcode,
  283. a.riskname riskname,
  284. DATE_FORMAT(b.startdate,'%Y-%m-%d') startdate,
  285. DATE_FORMAT(b.enddate,'%Y-%m-%d') enddate,
  286. DATE_FORMAT(b.updatedate,'%Y-%m-%d') updatedate,
  287. DATE_FORMAT(b.operatedate,'%Y-%m-%d') pmOperatedate,
  288. '' tbxg,
  289. '' xzzh,
  290. '' xbzh,
  291. '' cldl,
  292. '' clyt,
  293. '' clxl,
  294. CASE a.businessnature WHEN '1' THEN '直属业务' WHEN '2' THEN '代理业务' ELSE '' END businessnature,
  295. '' ywqd,
  296. a.sumpremium sumpremium,
  297. a.notaxpremium notaxpremium,
  298. a.commissionrate commissionrate,
  299. e.commission commission,
  300. a.jffs jffs,
  301. CASE a.sfds WHEN '1' THEN '是' WHEN '0' THEN '否' ELSE '' END sfds,
  302. a.sumamount sumamount,
  303. CASE a.channel WHEN '1' THEN '核心' WHEN '2' THEN '二维码' WHEN '3' THEN '车加意' ELSE '' END channel,
  304. a.license_no licenseNo,
  305. a.frame_no frameNo,
  306. a.engine_no engineNo,
  307. a.car_type_no carTypeNo,
  308. a.zkxs zkxs,
  309. a.applicertno applicertno,
  310. a.applimobile applimobile,
  311. a.appliaddress appliaddress,
  312. a.insuredcertno insuredcertno,
  313. a.insuredmobile insuredmobile,
  314. a.insuredaddress insuredaddress,
  315. b.paydate paydate
  316. FROM
  317. ins_pmain b
  318. LEFT JOIN ins_cmain a ON a.policyno = b.policyno
  319. LEFT JOIN sys_user c ON a.handlercode=c.id
  320. LEFT JOIN sys_dept h ON h.id=c.dept_id
  321. LEFT JOIN esm_ins_company d ON a.inscompany=d.id
  322. LEFT JOIN ins_income e ON e.policyno=a.policyno
  323. LEFT JOIN esm_product i ON i.id=a.riskcode
  324. where 1=1
  325. <if test="carflag != null and carflag!=''">
  326. AND a.carflag=#{carflag,jdbcType=VARCHAR}
  327. </if>
  328. <if test="operatedate != null">
  329. AND DATE_FORMAT(a.operatedate,'%Y-%m-%d') between DATE_FORMAT(#{operatedate,jdbcType=TIMESTAMP},'%Y-%m-%d')
  330. and DATE_FORMAT(#{operatedate,jdbcType=TIMESTAMP} ,'%Y-%m-%d')
  331. </if>
  332. <if test="startdate != null and enddate!=null">
  333. AND DATE_FORMAT(b.startdate,'%Y-%m-%d') between DATE_FORMAT(#{startdate,jdbcType=TIMESTAMP},'%Y-%m-%d') and
  334. DATE_FORMAT(#{enddate,jdbcType=TIMESTAMP},'%Y-%m-%d')
  335. </if>
  336. <if test="inscompany != null and inscompany!=''">
  337. AND a.inscompany like concat(#{inscompany,jdbcType=VARCHAR},'%')
  338. </if>
  339. <if test="policyno != null and policyno!=''">
  340. AND b.policyno=#{policyno,jdbcType=VARCHAR}
  341. </if>
  342. <if test="comcode != null and comcode!=''">
  343. AND a.comcode like concat(#{comcode,jdbcType=VARCHAR},'%')
  344. </if>
  345. <if test="handlercode != null and handlercode!=''">
  346. AND a.handlercode=#{handlercode,jdbcType=VARCHAR}
  347. </if>
  348. </select>
  349. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  350. delete
  351. from ins_cmain
  352. where policyno = #{policyno,jdbcType=VARCHAR}
  353. </delete>
  354. <delete id="deleteInsCmain">
  355. DELETE FROM ins_cmain
  356. WHERE
  357. DATE_FORMAT(operatedate, '%Y-%m-%d') = DATE_FORMAT(#{operatedate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  358. AND channel=#{channel,jdbcType=VARCHAR}
  359. <choose>
  360. <when test="handlercodeFlag == true">
  361. AND handlercode in (${handlercode})
  362. </when>
  363. <otherwise>
  364. AND handlercode = #{handlercode,jdbcType=VARCHAR}
  365. </otherwise>
  366. </choose>
  367. </delete>
  368. <delete id="deleteBatch">
  369. DELETE FROM ins_cmain
  370. WHERE (policyno, updatedate) in
  371. <foreach collection="clist" item="item" index="index" separator="," open="(" close=")">
  372. (#{item.policyno, jdbcType=VARCHAR}, DATE_FORMAT(#{item.updatedate, jdbcType=TIMESTAMP}, '%Y-%m-%d'))
  373. </foreach>
  374. </delete>
  375. <insert id="insert" parameterType="com.ydtech.modules.ins.model.InsCmain">
  376. insert into ins_cmain (policyno, riskcode, riskname, startdate,
  377. enddate, inscompany, validstatus,
  378. insureragentcode, insureragentname, insureragreementno,
  379. salesagreementno, commissionrate, operatedate,
  380. insurercomcode, insurercomname, comcode,
  381. businessnature, handlercode, applicode,
  382. appliname, insuredcode, insuredname,
  383. sumamount, sumpremium, netpointcode,
  384. netpointname, updatedate, carflag,
  385. channel, isself, notaxpremium,
  386. jffs, sfds,
  387. license_no, frame_no, engine_no, car_type_no, zkxs,
  388. applicertno, applimobile, appliaddress, insuredcertno, insuredmobile,
  389. insuredaddress, paydate)
  390. values (#{policyno,jdbcType=VARCHAR}, #{riskcode,jdbcType=VARCHAR}, #{riskname,jdbcType=VARCHAR},
  391. #{startdate,jdbcType=TIMESTAMP},
  392. #{enddate,jdbcType=TIMESTAMP}, #{inscompany,jdbcType=VARCHAR}, #{validstatus,jdbcType=VARCHAR},
  393. #{insureragentcode,jdbcType=VARCHAR}, #{insureragentname,jdbcType=VARCHAR},
  394. #{insureragreementno,jdbcType=VARCHAR},
  395. #{salesagreementno,jdbcType=VARCHAR}, #{commissionrate,jdbcType=DOUBLE},
  396. #{operatedate,jdbcType=TIMESTAMP},
  397. #{insurercomcode,jdbcType=VARCHAR}, #{insurercomname,jdbcType=VARCHAR}, #{comcode,jdbcType=VARCHAR},
  398. #{businessnature,jdbcType=VARCHAR}, #{handlercode,jdbcType=VARCHAR}, #{applicode,jdbcType=VARCHAR},
  399. #{appliname,jdbcType=VARCHAR}, #{insuredcode,jdbcType=VARCHAR}, #{insuredname,jdbcType=VARCHAR},
  400. #{sumamount,jdbcType=DOUBLE}, #{sumpremium,jdbcType=DOUBLE}, #{netpointcode,jdbcType=VARCHAR},
  401. #{netpointname,jdbcType=VARCHAR}, #{updatedate,jdbcType=TIMESTAMP}, #{carflag,jdbcType=VARCHAR},
  402. #{channel,jdbcType=VARCHAR}, #{isself,jdbcType=VARCHAR}, #{notaxpremium,jdbcType=DOUBLE},
  403. #{jffs,jdbcType=VARCHAR}, #{sfds,jdbcType=VARCHAR},
  404. #{licenseNo,jdbcType=VARCHAR}, #{frameNo,jdbcType=VARCHAR}, #{engineNo,jdbcType=VARCHAR},
  405. #{carTypeNo,jdbcType=VARCHAR}, #{zkxs,jdbcType=VARCHAR}, #{applicertno,jdbcType=DOUBLE},
  406. #{applimobile,jdbcType=VARCHAR}, #{appliaddress,jdbcType=VARCHAR}, #{insuredcertno,jdbcType=DOUBLE},
  407. #{insuredmobile,jdbcType=VARCHAR}, #{insuredaddress,jdbcType=VARCHAR}, #{paydate,jdbcType=TIMESTAMP})
  408. </insert>
  409. <insert id="insertSelective" parameterType="com.ydtech.modules.ins.model.InsCmain">
  410. insert into ins_cmain
  411. <trim prefix="(" suffix=")" suffixOverrides=",">
  412. <if test="policyno != null">
  413. policyno,
  414. </if>
  415. <if test="riskcode != null">
  416. riskcode,
  417. </if>
  418. <if test="riskname != null">
  419. riskname,
  420. </if>
  421. <if test="startdate != null">
  422. startdate,
  423. </if>
  424. <if test="enddate != null">
  425. enddate,
  426. </if>
  427. <if test="inscompany != null">
  428. inscompany,
  429. </if>
  430. <if test="validstatus != null">
  431. validstatus,
  432. </if>
  433. <if test="insureragentcode != null">
  434. insureragentcode,
  435. </if>
  436. <if test="insureragentname != null">
  437. insureragentname,
  438. </if>
  439. <if test="insureragreementno != null">
  440. insureragreementno,
  441. </if>
  442. <if test="salesagreementno != null">
  443. salesagreementno,
  444. </if>
  445. <if test="commissionrate != null">
  446. commissionrate,
  447. </if>
  448. <if test="operatedate != null">
  449. operatedate,
  450. </if>
  451. <if test="insurercomcode != null">
  452. insurercomcode,
  453. </if>
  454. <if test="insurercomname != null">
  455. insurercomname,
  456. </if>
  457. <if test="comcode != null">
  458. comcode,
  459. </if>
  460. <if test="businessnature != null">
  461. businessnature,
  462. </if>
  463. <if test="handlercode != null">
  464. handlercode,
  465. </if>
  466. <if test="applicode != null">
  467. applicode,
  468. </if>
  469. <if test="appliname != null">
  470. appliname,
  471. </if>
  472. <if test="insuredcode != null">
  473. insuredcode,
  474. </if>
  475. <if test="insuredname != null">
  476. insuredname,
  477. </if>
  478. <if test="sumamount != null">
  479. sumamount,
  480. </if>
  481. <if test="sumpremium != null">
  482. sumpremium,
  483. </if>
  484. <if test="netpointcode != null">
  485. netpointcode,
  486. </if>
  487. <if test="netpointname != null">
  488. netpointname,
  489. </if>
  490. <if test="updatedate != null">
  491. updatedate,
  492. </if>
  493. <if test="carflag != null">
  494. carflag,
  495. </if>
  496. <if test="channel != null">
  497. channel,
  498. </if>
  499. <if test="isself != null">
  500. isself,
  501. </if>
  502. <if test="notaxpremium != null">
  503. notaxpremium,
  504. </if>
  505. <if test="jffs != null">
  506. jffs,
  507. </if>
  508. <if test="sfds != null">
  509. sfds,
  510. </if>
  511. <if test="licenseNo != null">
  512. license_no,
  513. </if>
  514. <if test="frameNo != null">
  515. frame_no,
  516. </if>
  517. <if test="engineNo != null">
  518. engine_no,
  519. </if>
  520. <if test="carTypeNo != null">
  521. car_type_no,
  522. </if>
  523. <if test="zkxs != null">
  524. zkxs,
  525. </if>
  526. <if test="applicertno != null">
  527. applicertno,
  528. </if>
  529. <if test="applimobile != null">
  530. applimobile,
  531. </if>
  532. <if test="appliaddress != null">
  533. appliaddress,
  534. </if>
  535. <if test="insuredcertno != null">
  536. insuredcertno,
  537. </if>
  538. <if test="insuredmobile != null">
  539. insuredmobile,
  540. </if>
  541. <if test="insuredaddress != null">
  542. insuredaddress,
  543. </if>
  544. <if test="paydate != null">
  545. paydate,
  546. </if>
  547. </trim>
  548. <trim prefix="values (" suffix=")" suffixOverrides=",">
  549. <if test="policyno != null">
  550. #{policyno,jdbcType=VARCHAR},
  551. </if>
  552. <if test="riskcode != null">
  553. #{riskcode,jdbcType=VARCHAR},
  554. </if>
  555. <if test="riskname != null">
  556. #{riskname,jdbcType=VARCHAR},
  557. </if>
  558. <if test="startdate != null">
  559. #{startdate,jdbcType=TIMESTAMP},
  560. </if>
  561. <if test="enddate != null">
  562. #{enddate,jdbcType=TIMESTAMP},
  563. </if>
  564. <if test="inscompany != null">
  565. #{inscompany,jdbcType=VARCHAR},
  566. </if>
  567. <if test="validstatus != null">
  568. #{validstatus,jdbcType=VARCHAR},
  569. </if>
  570. <if test="insureragentcode != null">
  571. #{insureragentcode,jdbcType=VARCHAR},
  572. </if>
  573. <if test="insureragentname != null">
  574. #{insureragentname,jdbcType=VARCHAR},
  575. </if>
  576. <if test="insureragreementno != null">
  577. #{insureragreementno,jdbcType=VARCHAR},
  578. </if>
  579. <if test="salesagreementno != null">
  580. #{salesagreementno,jdbcType=VARCHAR},
  581. </if>
  582. <if test="commissionrate != null">
  583. #{commissionrate,jdbcType=DOUBLE},
  584. </if>
  585. <if test="operatedate != null">
  586. #{operatedate,jdbcType=TIMESTAMP},
  587. </if>
  588. <if test="insurercomcode != null">
  589. #{insurercomcode,jdbcType=VARCHAR},
  590. </if>
  591. <if test="insurercomname != null">
  592. #{insurercomname,jdbcType=VARCHAR},
  593. </if>
  594. <if test="comcode != null">
  595. #{comcode,jdbcType=VARCHAR},
  596. </if>
  597. <if test="businessnature != null">
  598. #{businessnature,jdbcType=VARCHAR},
  599. </if>
  600. <if test="handlercode != null">
  601. #{handlercode,jdbcType=VARCHAR},
  602. </if>
  603. <if test="applicode != null">
  604. #{applicode,jdbcType=VARCHAR},
  605. </if>
  606. <if test="appliname != null">
  607. #{appliname,jdbcType=VARCHAR},
  608. </if>
  609. <if test="insuredcode != null">
  610. #{insuredcode,jdbcType=VARCHAR},
  611. </if>
  612. <if test="insuredname != null">
  613. #{insuredname,jdbcType=VARCHAR},
  614. </if>
  615. <if test="sumamount != null">
  616. #{sumamount,jdbcType=DOUBLE},
  617. </if>
  618. <if test="sumpremium != null">
  619. #{sumpremium,jdbcType=DOUBLE},
  620. </if>
  621. <if test="netpointcode != null">
  622. #{netpointcode,jdbcType=VARCHAR},
  623. </if>
  624. <if test="netpointname != null">
  625. #{netpointname,jdbcType=VARCHAR},
  626. </if>
  627. <if test="updatedate != null">
  628. #{updatedate,jdbcType=TIMESTAMP},
  629. </if>
  630. <if test="carflag != null">
  631. #{carflag,jdbcType=VARCHAR},
  632. </if>
  633. <if test="channel != null">
  634. #{channel,jdbcType=VARCHAR},
  635. </if>
  636. <if test="isself != null">
  637. #{isself,jdbcType=VARCHAR},
  638. </if>
  639. <if test="notaxpremium != null">
  640. #{notaxpremium,jdbcType=DOUBLE},
  641. </if>
  642. <if test="jffs != null">
  643. #{jffs,jdbcType=VARCHAR},
  644. </if>
  645. <if test="sfds != null">
  646. #{sfds,jdbcType=VARCHAR},
  647. </if>
  648. <if test="licenseNo != null">
  649. #{licenseNo,jdbcType=VARCHAR},
  650. </if>
  651. <if test="frameNo != null">
  652. #{frameNo,jdbcType=VARCHAR},
  653. </if>
  654. <if test="engineNo != null">
  655. #{engineNo,jdbcType=VARCHAR},
  656. </if>
  657. <if test="carTypeNo != null">
  658. #{carTypeNo,jdbcType=VARCHAR},
  659. </if>
  660. <if test="zkxs != null">
  661. #{zkxs,jdbcType=VARCHAR},
  662. </if>
  663. <if test="applicertno != null">
  664. #{applicertno,jdbcType=VARCHAR},
  665. </if>
  666. <if test="applimobile != null">
  667. #{applimobile,jdbcType=VARCHAR},
  668. </if>
  669. <if test="appliaddress != null">
  670. #{appliaddress,jdbcType=VARCHAR},
  671. </if>
  672. <if test="insuredcertno != null">
  673. #{insuredcertno,jdbcType=VARCHAR},
  674. </if>
  675. <if test="insuredmobile != null">
  676. #{insuredmobile,jdbcType=VARCHAR},
  677. </if>
  678. <if test="insuredaddress != null">
  679. #{insuredaddress,jdbcType=VARCHAR},
  680. </if>
  681. <if test="paydate != null">
  682. #{paydate,jdbcType=TIMESTAMP},
  683. </if>
  684. </trim>
  685. </insert>
  686. <insert id="insertBatch" parameterType="list">
  687. insert into ins_cmain (
  688. <include refid="Base_Column_List"/>
  689. )
  690. values
  691. <foreach collection="qtList" item="item" separator=",">
  692. (#{item.policyno}, #{item.riskcode}, #{item.riskname}, #{item.startdate}, #{item.enddate},
  693. #{item.inscompany}, '1',
  694. #{item.insureragentcode}, #{item.insureragentname}, #{item.insureragreementno}, #{item.salesagreementno},
  695. #{item.commissionrate}, #{item.operatedate},
  696. #{item.insurercomcode}, #{item.insurercomname}, #{item.comcode}, #{item.businessnature},
  697. #{item.handlercode}, #{item.applicode},
  698. #{item.appliname}, #{item.insuredcode}, #{item.insuredname}, #{item.sumamount}, #{item.sumpremium},
  699. #{item.netpointcode},
  700. #{item.netpointname}, #{item.updatedate}, #{item.carflag}, #{item.channel}, #{item.isself},
  701. #{item.notaxpremium},
  702. #{item.jffs}, #{item.sfds}, #{item.licenseNo}, #{item.frameNo}, #{item.engineNo}, #{item.carTypeNo},
  703. #{item.zkxs},
  704. #{item.applicertno}, #{item.applimobile}, #{item.appliaddress}, #{item.insuredcertno},
  705. #{item.insuredmobile}, #{item.insuredaddress},
  706. #{item.paydate}
  707. )
  708. </foreach>
  709. </insert>
  710. <update id="updateByPrimaryKeySelective" parameterType="com.ydtech.modules.ins.model.InsCmain">
  711. update ins_cmain
  712. <set>
  713. <if test="riskcode != null">
  714. riskcode = #{riskcode,jdbcType=VARCHAR},
  715. </if>
  716. <if test="riskname != null">
  717. riskname = #{riskname,jdbcType=VARCHAR},
  718. </if>
  719. <if test="startdate != null">
  720. startdate = #{startdate,jdbcType=TIMESTAMP},
  721. </if>
  722. <if test="enddate != null">
  723. enddate = #{enddate,jdbcType=TIMESTAMP},
  724. </if>
  725. <if test="inscompany != null">
  726. inscompany = #{inscompany,jdbcType=VARCHAR},
  727. </if>
  728. <if test="validstatus != null">
  729. validstatus = #{validstatus,jdbcType=VARCHAR},
  730. </if>
  731. <if test="insureragentcode != null">
  732. insureragentcode = #{insureragentcode,jdbcType=VARCHAR},
  733. </if>
  734. <if test="insureragentname != null">
  735. insureragentname = #{insureragentname,jdbcType=VARCHAR},
  736. </if>
  737. <if test="insureragreementno != null">
  738. insureragreementno = #{insureragreementno,jdbcType=VARCHAR},
  739. </if>
  740. <if test="salesagreementno != null">
  741. salesagreementno = #{salesagreementno,jdbcType=VARCHAR},
  742. </if>
  743. <if test="commissionrate != null">
  744. commissionrate = #{commissionrate,jdbcType=DOUBLE},
  745. </if>
  746. <if test="operatedate != null">
  747. operatedate = #{operatedate,jdbcType=TIMESTAMP},
  748. </if>
  749. <if test="insurercomcode != null">
  750. insurercomcode = #{insurercomcode,jdbcType=VARCHAR},
  751. </if>
  752. <if test="insurercomname != null">
  753. insurercomname = #{insurercomname,jdbcType=VARCHAR},
  754. </if>
  755. <if test="comcode != null">
  756. comcode = #{comcode,jdbcType=VARCHAR},
  757. </if>
  758. <if test="businessnature != null">
  759. businessnature = #{businessnature,jdbcType=VARCHAR},
  760. </if>
  761. <if test="handlercode != null">
  762. handlercode = #{handlercode,jdbcType=VARCHAR},
  763. </if>
  764. <if test="applicode != null">
  765. applicode = #{applicode,jdbcType=VARCHAR},
  766. </if>
  767. <if test="appliname != null">
  768. appliname = #{appliname,jdbcType=VARCHAR},
  769. </if>
  770. <if test="insuredcode != null">
  771. insuredcode = #{insuredcode,jdbcType=VARCHAR},
  772. </if>
  773. <if test="insuredname != null">
  774. insuredname = #{insuredname,jdbcType=VARCHAR},
  775. </if>
  776. <if test="sumamount != null">
  777. sumamount = #{sumamount,jdbcType=DOUBLE},
  778. </if>
  779. <if test="sumpremium != null">
  780. sumpremium = #{sumpremium,jdbcType=DOUBLE},
  781. </if>
  782. <if test="netpointcode != null">
  783. netpointcode = #{netpointcode,jdbcType=VARCHAR},
  784. </if>
  785. <if test="netpointname != null">
  786. netpointname = #{netpointname,jdbcType=VARCHAR},
  787. </if>
  788. <if test="updatedate != null">
  789. updatedate = #{updatedate,jdbcType=TIMESTAMP},
  790. </if>
  791. <if test="carflag != null">
  792. carflag = #{carflag,jdbcType=VARCHAR},
  793. </if>
  794. <if test="channel != null">
  795. channel = #{channel,jdbcType=VARCHAR},
  796. </if>
  797. <if test="isself != null">
  798. isself = #{isself,jdbcType=VARCHAR},
  799. </if>
  800. <if test="notaxpremium != null">
  801. notaxpremium = #{notaxpremium,jdbcType=DOUBLE},
  802. </if>
  803. <if test="jffs != null">
  804. jffs = #{jffs,jdbcType=VARCHAR},
  805. </if>
  806. <if test="sfds != null">
  807. sfds = #{sfds,jdbcType=VARCHAR},
  808. </if>
  809. <if test="licenseNo != null">
  810. license_no = #{licenseNo,jdbcType=VARCHAR},
  811. </if>
  812. <if test="frameNo != null">
  813. frame_no = #{frameNo,jdbcType=VARCHAR},
  814. </if>
  815. <if test="engineNo != null">
  816. engine_no = #{engineNo,jdbcType=VARCHAR},
  817. </if>
  818. <if test="carTypeNo != null">
  819. car_type_no = #{carTypeNo,jdbcType=VARCHAR},
  820. </if>
  821. <if test="zkxs != null">
  822. zkxs = #{zkxs,jdbcType=VARCHAR},
  823. </if>
  824. <if test="applicertno != null">
  825. applicertno = #{applicertno,jdbcType=VARCHAR},
  826. </if>
  827. <if test="applimobile != null">
  828. applimobile = #{applimobile,jdbcType=VARCHAR},
  829. </if>
  830. <if test="appliaddress != null">
  831. appliaddress = #{appliaddress,jdbcType=VARCHAR},
  832. </if>
  833. <if test="insuredcertno != null">
  834. insuredcertno = #{insuredcertno,jdbcType=VARCHAR},
  835. </if>
  836. <if test="insuredmobile != null">
  837. insuredmobile = #{insuredmobile,jdbcType=VARCHAR},
  838. </if>
  839. <if test="insuredaddress != null">
  840. insuredaddress = #{insuredaddress,jdbcType=VARCHAR},
  841. </if>
  842. <if test="paydate != null">
  843. paydate = #{paydate,jdbcType=TIMESTAMP},
  844. </if>
  845. </set>
  846. where policyno = #{policyno,jdbcType=VARCHAR}
  847. </update>
  848. <update id="updateByPrimaryKey" parameterType="com.ydtech.modules.ins.model.InsCmain">
  849. update ins_cmain
  850. set riskcode = #{riskcode,jdbcType=VARCHAR},
  851. riskname = #{riskname,jdbcType=VARCHAR},
  852. startdate = #{startdate,jdbcType=TIMESTAMP},
  853. enddate = #{enddate,jdbcType=TIMESTAMP},
  854. inscompany = #{inscompany,jdbcType=VARCHAR},
  855. validstatus = #{validstatus,jdbcType=VARCHAR},
  856. insureragentcode = #{insureragentcode,jdbcType=VARCHAR},
  857. insureragentname = #{insureragentname,jdbcType=VARCHAR},
  858. insureragreementno = #{insureragreementno,jdbcType=VARCHAR},
  859. salesagreementno = #{salesagreementno,jdbcType=VARCHAR},
  860. commissionrate = #{commissionrate,jdbcType=DOUBLE},
  861. operatedate = #{operatedate,jdbcType=TIMESTAMP},
  862. insurercomcode = #{insurercomcode,jdbcType=VARCHAR},
  863. insurercomname = #{insurercomname,jdbcType=VARCHAR},
  864. comcode = #{comcode,jdbcType=VARCHAR},
  865. businessnature = #{businessnature,jdbcType=VARCHAR},
  866. handlercode = #{handlercode,jdbcType=VARCHAR},
  867. applicode = #{applicode,jdbcType=VARCHAR},
  868. appliname = #{appliname,jdbcType=VARCHAR},
  869. insuredcode = #{insuredcode,jdbcType=VARCHAR},
  870. insuredname = #{insuredname,jdbcType=VARCHAR},
  871. sumamount = #{sumamount,jdbcType=DOUBLE},
  872. sumpremium = #{sumpremium,jdbcType=DOUBLE},
  873. netpointcode = #{netpointcode,jdbcType=VARCHAR},
  874. netpointname = #{netpointname,jdbcType=VARCHAR},
  875. updatedate = #{updatedate,jdbcType=TIMESTAMP},
  876. carflag = #{carflag,jdbcType=VARCHAR},
  877. channel = #{channel,jdbcType=VARCHAR},
  878. isself = #{isself,jdbcType=VARCHAR},
  879. notaxpremium = #{notaxpremium,jdbcType=DOUBLE},
  880. jffs = #{jffs,jdbcType=VARCHAR},
  881. sfds = #{sfds,jdbcType=VARCHAR},
  882. license_no = #{licenseNo,jdbcType=VARCHAR},
  883. frame_no = #{frameNo,jdbcType=VARCHAR},
  884. engine_no = #{engineNo,jdbcType=VARCHAR},
  885. car_type_no = #{carTypeNo,jdbcType=VARCHAR},
  886. zkxs = #{zkxs,jdbcType=VARCHAR},
  887. applicertno = #{applicertno,jdbcType=VARCHAR},
  888. applimobile = #{applimobile,jdbcType=VARCHAR},
  889. appliaddress = #{appliaddress,jdbcType=VARCHAR},
  890. insuredcertno = #{insuredcertno,jdbcType=VARCHAR},
  891. insuredmobile = #{insuredmobile,jdbcType=VARCHAR},
  892. insuredaddress = #{insuredaddress,jdbcType=VARCHAR},
  893. paydate = #{paydate,jdbcType=TIMESTAMP}
  894. where policyno = #{policyno,jdbcType=VARCHAR}
  895. </update>
  896. <select id="selectBFJELJ" resultType="Double">
  897. select coalesce(sum(t.notaxpremium),0.00) from
  898. (SELECT coalesce(sum(notaxpremium),0.00) as notaxpremium from ins_cmain a
  899. where 1=1
  900. <if test="inscompany != null and inscompany !=''">
  901. and inscompany = #{inscompany,jdbcType=VARCHAR}
  902. </if>
  903. <if test="sign == 2">
  904. and inscompany like "100001%"
  905. </if>
  906. <if test="sign == 3">
  907. and inscompany not like "100001%"
  908. </if>
  909. <if test="riskcode != null and riskcode != ''">
  910. and riskcode like #{riskcode,jdbcType=VARCHAR}"%"
  911. </if>
  912. <if test="comcode != null and comcode != ''">
  913. and comcode like #{comcode,jdbcType=VARCHAR}"%"
  914. </if>
  915. <if test="startdate != null and enddate != null">
  916. AND DATE_FORMAT(IF ( a.operatedate <![CDATA[<]]> a.paydate, a.paydate, a.operatedate ), '%Y-%m-%d') between
  917. DATE_FORMAT(#{startdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  918. and DATE_FORMAT(#{enddate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  919. </if>
  920. union
  921. SELECT coalesce(sum(p.notaxpremium),0.00) as notaxpremium from ins_pmain p
  922. left join ins_cmain a on p.policyno=a.policyno
  923. where 1=1
  924. <if test="inscompany != null and inscompany !=''">
  925. and a.inscompany = #{inscompany,jdbcType=VARCHAR}
  926. </if>
  927. <if test="sign == 2">
  928. and a.inscompany like "100001%"
  929. </if>
  930. <if test="sign == 3">
  931. and a.inscompany not like "100001%"
  932. </if>
  933. <if test="riskcode != null and riskcode != ''">
  934. and a.riskcode like #{riskcode,jdbcType=VARCHAR}"%"
  935. </if>
  936. <if test="comcode != null and comcode != ''">
  937. and a.comcode like #{comcode,jdbcType=VARCHAR}"%"
  938. </if>
  939. <if test="startdate != null and enddate != null">
  940. AND DATE_FORMAT(IF ( p.operatedate <![CDATA[<]]> p.paydate, p.paydate, p.operatedate ), '%Y-%m-%d') between
  941. DATE_FORMAT(#{startdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  942. and DATE_FORMAT(#{enddate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  943. </if>
  944. ) t
  945. </select>
  946. <select id="selectDLYJLJ" resultType="Double">
  947. select coalesce(sum(t.notaxpremium),0.00) from
  948. (SELECT coalesce(sum(notaxpremium*commissionrate),0.00) as notaxpremium from ins_cmain a
  949. where 1=1
  950. <if test="inscompany != null and inscompany !=''">
  951. and inscompany = #{inscompany,jdbcType=VARCHAR}
  952. </if>
  953. <if test="sign == 2">
  954. and inscompany like "100001%"
  955. </if>
  956. <if test="sign == 3">
  957. and inscompany not like "100001%"
  958. </if>
  959. <if test="riskcode != null and riskcode != ''">
  960. and riskcode like #{riskcode,jdbcType=VARCHAR}"%"
  961. </if>
  962. <if test="comcode != null and comcode != ''">
  963. and comcode like #{comcode,jdbcType=VARCHAR}"%"
  964. </if>
  965. <if test="startdate != null and enddate != null">
  966. AND DATE_FORMAT(IF ( a.operatedate <![CDATA[<]]> a.paydate, a.paydate, a.operatedate ), '%Y-%m-%d') between
  967. DATE_FORMAT(#{startdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  968. and DATE_FORMAT(#{enddate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  969. </if>
  970. union
  971. SELECT coalesce(sum(p.notaxpremium*a.commissionrate),0.00) as notaxpremium from ins_pmain p
  972. left join ins_cmain a on p.policyno=a.policyno
  973. where 1=1
  974. <if test="inscompany != null and inscompany !=''">
  975. and a.inscompany = #{inscompany,jdbcType=VARCHAR}
  976. </if>
  977. <if test="sign == 2">
  978. and a.inscompany like "100001%"
  979. </if>
  980. <if test="sign == 3">
  981. and a.inscompany not like "100001%"
  982. </if>
  983. <if test="riskcode != null and riskcode != ''">
  984. and a.riskcode like #{riskcode,jdbcType=VARCHAR}"%"
  985. </if>
  986. <if test="comcode != null and comcode != ''">
  987. and a.comcode like #{comcode,jdbcType=VARCHAR}"%"
  988. </if>
  989. <if test="startdate != null and enddate != null">
  990. AND DATE_FORMAT(IF ( p.operatedate <![CDATA[<]]> p.paydate, p.paydate, p.operatedate ), '%Y-%m-%d') between
  991. DATE_FORMAT(#{startdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  992. and DATE_FORMAT(#{enddate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  993. </if>
  994. ) t
  995. </select>
  996. <select id="selectBFJELJ2" resultType="Double">
  997. SELECT
  998. coalesce(sum(b.notaxpremium),0.00)
  999. FROM
  1000. ins_settle a,
  1001. ins_settle_detail b
  1002. WHERE a.settleno = b.settleno
  1003. <if test="inscompany != null and inscompany !=''">
  1004. and a.insurercode = #{inscompany,jdbcType=VARCHAR}
  1005. </if>
  1006. <if test="sign == 2">
  1007. and a.insurercode like "100001%"
  1008. </if>
  1009. <if test="sign == 3">
  1010. and a.insurercode not like "100001%"
  1011. </if>
  1012. <if test="riskcode != null and riskcode != ''">
  1013. and b.riskcode like #{riskcode,jdbcType=VARCHAR}"%"
  1014. </if>
  1015. <if test="comcode != null and comcode != ''">
  1016. and a.comcode like #{comcode,jdbcType=VARCHAR}"%"
  1017. </if>
  1018. <if test="startdate != null and enddate != null">
  1019. AND DATE_FORMAT(a.updatedate, '%Y-%m-%d') between DATE_FORMAT(#{startdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  1020. and DATE_FORMAT(#{enddate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  1021. </if>
  1022. </select>
  1023. <select id="selectDLYJLJ2" resultType="Double">
  1024. SELECT
  1025. coalesce(sum(b.commission),0.00)
  1026. FROM
  1027. ins_settle a,
  1028. ins_settle_detail b
  1029. WHERE a.settleno = b.settleno
  1030. <if test="inscompany != null and inscompany !=''">
  1031. and a.insurercode = #{inscompany,jdbcType=VARCHAR}
  1032. </if>
  1033. <if test="sign == 2">
  1034. and a.insurercode like "100001%"
  1035. </if>
  1036. <if test="sign == 3">
  1037. and a.insurercode not like "100001%"
  1038. </if>
  1039. <if test="riskcode != null and riskcode != ''">
  1040. and b.riskcode like #{riskcode,jdbcType=VARCHAR}"%"
  1041. </if>
  1042. <if test="comcode != null and comcode != ''">
  1043. and a.comcode like #{comcode,jdbcType=VARCHAR}"%"
  1044. </if>
  1045. <if test="startdate != null and enddate != null">
  1046. AND DATE_FORMAT(a.updatedate, '%Y-%m-%d') between DATE_FORMAT(#{startdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  1047. and DATE_FORMAT(#{enddate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  1048. </if>
  1049. </select>
  1050. </mapper>