InsSettleMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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.InsSettleMapper">
  4. <resultMap id="BaseResultMap" type="com.ydtech.modules.ins.model.InsSettle">
  5. <id column="settleno" jdbcType="VARCHAR" property="settleno"/>
  6. <result column="billfee" jdbcType="DECIMAL" property="billfee"/>
  7. <result column="insurercode" jdbcType="VARCHAR" property="insurercode"/>
  8. <result column="createdate" jdbcType="TIMESTAMP" property="createdate"/>
  9. <result column="createcode" jdbcType="VARCHAR" property="createcode"/>
  10. <result column="confirmdate" jdbcType="TIMESTAMP" property="confirmdate"/>
  11. <result column="confirmcode" jdbcType="VARCHAR" property="confirmcode"/>
  12. <result column="checkno" jdbcType="VARCHAR" property="checkno"/>
  13. <result column="status" jdbcType="VARCHAR" property="status"/>
  14. <result column="account" jdbcType="VARCHAR" property="account"/>
  15. <result column="orig_commno" jdbcType="VARCHAR" property="origCommno"/>
  16. <result column="updatedate" jdbcType="TIMESTAMP" property="updatedate"/>
  17. <result column="checkflag" jdbcType="CHAR" property="checkflag"/>
  18. <result column="comcode" jdbcType="VARCHAR" property="comcode"/>
  19. <result column="fileid" jdbcType="VARCHAR" property="fileid"/>
  20. <result column="url" jdbcType="VARCHAR" property="url"/>
  21. <result column="agentcode" jdbcType="VARCHAR" property="agentcode"/>
  22. <result column="oppbank" jdbcType="VARCHAR" property="oppbank"/>
  23. <result column="oppbankname" jdbcType="VARCHAR" property="oppbankname"/>
  24. <result column="oppact" jdbcType="VARCHAR" property="oppact"/>
  25. <result column="oppactname" jdbcType="VARCHAR" property="oppactname"/>
  26. </resultMap>
  27. <sql id="Base_Column_List">
  28. settleno, billfee, insurercode, createdate, createcode, confirmdate, confirmcode,
  29. checkno, status, account, orig_commno, updatedate, checkflag, comcode ,fileid, url,agentcode,
  30. oppbank, oppbankname, oppact, oppactname
  31. </sql>
  32. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  33. select
  34. <include refid="Base_Column_List"/>
  35. from ins_settle
  36. where settleno = #{settleno,jdbcType=VARCHAR}
  37. </select>
  38. <select id="selectSettle" parameterType="com.ydtech.modules.ins.model.vo.InsSettleReqVo"
  39. resultType="com.ydtech.modules.ins.model.vo.res.InsSettleResVo">
  40. select
  41. settleno,
  42. billfee,
  43. insurercode,
  44. (select name from esm_ins_company where id=insurercode) insurername,
  45. comcode,
  46. (select name from sys_dept where id=comcode) comname,
  47. createdate,
  48. createcode,
  49. confirmdate,
  50. confirmcode,
  51. checkno,
  52. status,
  53. (select name from sys_account where id=account) account,
  54. orig_commno origCommno,
  55. updatedate,
  56. checkflag,
  57. url,
  58. agentcode,
  59. oppbank,
  60. oppbankname,
  61. oppact,
  62. oppactname,
  63. fileid,
  64. (SELECT a.oldfilename FROM ins_file a where a.fileid=b.fileid) oldname
  65. from ins_settle b
  66. where 1=1
  67. <if test="settleno != null and settleno != ''">
  68. AND settleno = #{settleno,jdbcType=VARCHAR}
  69. </if>
  70. <if test="insurercode != null and insurercode != ''">
  71. AND insurercode = #{insurercode,jdbcType=VARCHAR}
  72. </if>
  73. <if test="createdatestart != null and createdateend != null">
  74. AND DATE_FORMAT(createdate, '%Y-%m-%d') between DATE_FORMAT(#{createdatestart,jdbcType=TIMESTAMP},
  75. '%Y-%m-%d') and DATE_FORMAT(#{createdateend,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  76. </if>
  77. <if test="createcode != null and createcode != ''">
  78. AND createcode = #{createcode,jdbcType=VARCHAR}
  79. </if>
  80. <if test="confirmdate != null">
  81. AND DATE_FORMAT(confirmdate, '%Y-%m-%d') = DATE_FORMAT(#{confirmdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  82. </if>
  83. <if test="confirmcode != null and confirmcode != ''">
  84. AND confirmcode = #{confirmcode,jdbcType=VARCHAR}
  85. </if>
  86. <if test="checkno != null and checkno != ''">
  87. AND checkno like concat('%', #{checkno,jdbcType=VARCHAR} , '%')
  88. </if>
  89. <if test="status != null and status != ''">
  90. AND status = #{status,jdbcType=VARCHAR}
  91. </if>
  92. <if test="account != null and account != ''">
  93. AND account = #{account,jdbcType=VARCHAR}
  94. </if>
  95. <if test="origCommno != null and origCommno != ''">
  96. AND orig_commno = #{origCommno,jdbcType=VARCHAR}
  97. </if>
  98. <if test="updatedatestart != null and updatedateend != null">
  99. AND DATE_FORMAT(updatedate, '%Y-%m-%d') between DATE_FORMAT(#{updatedatestart,jdbcType=TIMESTAMP},
  100. '%Y-%m-%d') and DATE_FORMAT(#{updatedateend,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  101. </if>
  102. <if test="checkflag != null and checkflag != ''">
  103. AND checkflag = #{checkflag,jdbcType=CHAR}
  104. </if>
  105. <if test="comcode != null and comcode != ''">
  106. AND comcode like concat(#{comcode,jdbcType=VARCHAR},'%')
  107. </if>
  108. <if test="url != null and url != ''">
  109. AND url = #{url,jdbcType=CHAR}
  110. </if>
  111. ORDER BY updatedate desc
  112. </select>
  113. <select id="getCountBySettleno" resultType="java.lang.Integer">
  114. select count(0)
  115. from ins_settle
  116. where settleno like concat(#{settleno}, '%')
  117. </select>
  118. <select id="generateBeforePolicyno" parameterType="com.ydtech.modules.ins.model.vo.req.InsCminReqVo"
  119. resultType="com.ydtech.modules.ins.model.vo.PolicynoDetailResVo">
  120. SELECT
  121. a.policyno policyno,
  122. b.riskcode riskcode,
  123. IFNULL(c.proname,e.name) riskname,
  124. b.inscompany inscompany,
  125. d.name inscompanyname,
  126. b.comcode comcode,
  127. f.name comname,
  128. b.appliname appliname,
  129. b.applicode applicode,
  130. b.insuredcode insuredcode,
  131. b.insuredname insuredname,
  132. b.operatedate operatedate,
  133. b.startdate startdate,
  134. b.sumpremium sumpremium,
  135. b.notaxpremium notaxpremium,
  136. b.commissionrate commissionrate,
  137. a.commission - a.doingcommission - a.finalcommission commission
  138. FROM
  139. ins_income a
  140. LEFT JOIN ins_cmain b ON a.policyno = b.policyno
  141. LEFT JOIN esm_product_fc c ON c.planno = b.riskcode
  142. LEFT JOIN esm_product e ON e.id = b.riskcode
  143. LEFT JOIN esm_ins_company d ON b.inscompany = d.id
  144. LEFT JOIN sys_dept f on f.id=b.comcode
  145. WHERE 1=1
  146. <if test="inscompany != null and inscompany != ''">
  147. AND b.inscompany LIKE concat('%', #{inscompany},'%')
  148. </if>
  149. <if test="operatedatestart != null and operatedateend !=null">
  150. AND DATE_FORMAT(b.operatedate, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{operatedatestart}, '%Y-%m-%d') AND
  151. DATE_FORMAT(#{operatedateend}, '%Y-%m-%d')
  152. </if>
  153. <if test="creattime != null ">
  154. AND DATE_FORMAT(a.creattime, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{creattime}, '%Y-%m-%d') AND
  155. DATE_FORMAT(#{creattime}, '%Y-%m-%d')
  156. </if>
  157. <if test="riskcode != null and riskcode != ''">
  158. AND b.riskcode = #{riskcode}
  159. </if>
  160. <if test="comcode != null and comcode != ''">
  161. AND b.comcode LIKE concat(#{comcode},'%')
  162. </if>
  163. AND (a.commission - a.doingcommission - a.finalcommission != 0)
  164. ORDER BY
  165. a.POLICYNO
  166. </select>
  167. <select id="selectBySettlenoAndStatus" resultType="com.ydtech.modules.ins.model.InsSettle">
  168. select
  169. <include refid="Base_Column_List"/>
  170. from ins_settle
  171. where settleno = #{settleno} and status=#{status}
  172. </select>
  173. <select id="selectBySettlenoAndCheckflag" resultType="java.lang.Integer">
  174. select count(1)
  175. from ins_settle
  176. where settleno = #{settleno}
  177. and checkflag = #{checkflag}
  178. </select>
  179. <select id="selectByCheckno" resultType="com.ydtech.modules.ins.model.InsSettle">
  180. select
  181. <include refid="Base_Column_List"/>
  182. from ins_settle
  183. where checkno=#{checkno}
  184. </select>
  185. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  186. delete
  187. from ins_settle
  188. where settleno = #{settleno,jdbcType=VARCHAR}
  189. </delete>
  190. <insert id="insert" parameterType="com.ydtech.modules.ins.model.InsSettle">
  191. insert into ins_settle (settleno, billfee, insurercode,
  192. createdate, createcode, confirmdate,
  193. confirmcode, checkno, status,
  194. account, orig_commno, updatedate,
  195. checkflag, comcode,
  196. oppbank,
  197. oppbankname,
  198. oppact,
  199. oppactname)
  200. values (#{settleno,jdbcType=VARCHAR}, #{billfee,jdbcType=DECIMAL}, #{insurercode,jdbcType=VARCHAR},
  201. #{createdate,jdbcType=TIMESTAMP}, #{createcode,jdbcType=VARCHAR}, #{confirmdate,jdbcType=TIMESTAMP},
  202. #{confirmcode,jdbcType=VARCHAR}, #{checkno,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
  203. #{account,jdbcType=VARCHAR}, #{origCommno,jdbcType=VARCHAR}, #{updatedate,jdbcType=TIMESTAMP},
  204. #{checkflag,jdbcType=CHAR}, #{comcode,jdbcType=VARCHAR},
  205. #{oppbank,jdbcType=VARCHAR},
  206. #{oppbankname,jdbcType=VARCHAR},
  207. #{oppact,jdbcType=VARCHAR},
  208. #{oppactname,jdbcType=VARCHAR})
  209. </insert>
  210. <insert id="insertSelective" parameterType="com.ydtech.modules.ins.model.InsSettle">
  211. insert into ins_settle
  212. <trim prefix="(" suffix=")" suffixOverrides=",">
  213. <if test="settleno != null">
  214. settleno,
  215. </if>
  216. <if test="billfee != null">
  217. billfee,
  218. </if>
  219. <if test="insurercode != null">
  220. insurercode,
  221. </if>
  222. <if test="createdate != null">
  223. createdate,
  224. </if>
  225. <if test="createcode != null">
  226. createcode,
  227. </if>
  228. <if test="confirmdate != null">
  229. confirmdate,
  230. </if>
  231. <if test="confirmcode != null">
  232. confirmcode,
  233. </if>
  234. <if test="checkno != null">
  235. checkno,
  236. </if>
  237. <if test="status != null">
  238. status,
  239. </if>
  240. <if test="account != null">
  241. account,
  242. </if>
  243. <if test="origCommno != null">
  244. orig_commno,
  245. </if>
  246. <if test="updatedate != null">
  247. updatedate,
  248. </if>
  249. <if test="checkflag != null">
  250. checkflag,
  251. </if>
  252. <if test="comcode != null">
  253. comcode,
  254. </if>
  255. <if test="oppbank != null">
  256. oppbank,
  257. </if>
  258. <if test="oppbankname != null">
  259. oppbankname,
  260. </if>
  261. <if test="oppact != null">
  262. oppact,
  263. </if>
  264. <if test="oppactname != null">
  265. oppactname,
  266. </if>
  267. </trim>
  268. <trim prefix="values (" suffix=")" suffixOverrides=",">
  269. <if test="settleno != null">
  270. #{settleno,jdbcType=VARCHAR},
  271. </if>
  272. <if test="billfee != null">
  273. #{billfee,jdbcType=DECIMAL},
  274. </if>
  275. <if test="insurercode != null">
  276. #{insurercode,jdbcType=VARCHAR},
  277. </if>
  278. <if test="createdate != null">
  279. #{createdate,jdbcType=TIMESTAMP},
  280. </if>
  281. <if test="createcode != null">
  282. #{createcode,jdbcType=VARCHAR},
  283. </if>
  284. <if test="confirmdate != null">
  285. #{confirmdate,jdbcType=TIMESTAMP},
  286. </if>
  287. <if test="confirmcode != null">
  288. #{confirmcode,jdbcType=VARCHAR},
  289. </if>
  290. <if test="checkno != null">
  291. #{checkno,jdbcType=VARCHAR},
  292. </if>
  293. <if test="status != null">
  294. #{status,jdbcType=VARCHAR},
  295. </if>
  296. <if test="account != null">
  297. #{account,jdbcType=VARCHAR},
  298. </if>
  299. <if test="origCommno != null">
  300. #{origCommno,jdbcType=VARCHAR},
  301. </if>
  302. <if test="updatedate != null">
  303. #{updatedate,jdbcType=TIMESTAMP},
  304. </if>
  305. <if test="checkflag != null">
  306. #{checkflag,jdbcType=CHAR},
  307. </if>
  308. <if test="comcode != null">
  309. #{comcode,jdbcType=CHAR},
  310. </if>
  311. <if test="oppbank != null">
  312. #{oppbank,jdbcType=VARCHAR},
  313. </if>
  314. <if test="oppbankname != null">
  315. #{oppbankname,jdbcType=VARCHAR},
  316. </if>
  317. <if test="oppact != null">
  318. #{oppact,jdbcType=VARCHAR},
  319. </if>
  320. <if test="oppactname != null">
  321. #{oppactname,jdbcType=VARCHAR},
  322. </if>
  323. </trim>
  324. </insert>
  325. <update id="updateByPrimaryKeySelective" parameterType="com.ydtech.modules.ins.model.InsSettle">
  326. update ins_settle
  327. <set>
  328. <if test="billfee != null">
  329. billfee = #{billfee,jdbcType=DECIMAL},
  330. </if>
  331. <if test="insurercode != null">
  332. insurercode = #{insurercode,jdbcType=VARCHAR},
  333. </if>
  334. <if test="createdate != null">
  335. createdate = #{createdate,jdbcType=TIMESTAMP},
  336. </if>
  337. <if test="createcode != null">
  338. createcode = #{createcode,jdbcType=VARCHAR},
  339. </if>
  340. <if test="confirmdate != null">
  341. confirmdate = #{confirmdate,jdbcType=TIMESTAMP},
  342. </if>
  343. <if test="confirmcode != null">
  344. confirmcode = #{confirmcode,jdbcType=VARCHAR},
  345. </if>
  346. <if test="checkno != null">
  347. checkno = #{checkno,jdbcType=VARCHAR},
  348. </if>
  349. <if test="status != null">
  350. status = #{status,jdbcType=VARCHAR},
  351. </if>
  352. <if test="account != null">
  353. account = #{account,jdbcType=VARCHAR},
  354. </if>
  355. <if test="origCommno != null">
  356. orig_commno = #{origCommno,jdbcType=VARCHAR},
  357. </if>
  358. <if test="updatedate != null">
  359. updatedate = #{updatedate,jdbcType=TIMESTAMP},
  360. </if>
  361. <if test="checkflag != null">
  362. checkflag = #{checkflag,jdbcType=CHAR},
  363. </if>
  364. <if test="comcode != null">
  365. comcode = #{comcode,jdbcType=VARCHAR},
  366. </if>
  367. <if test="oppbank != null">
  368. oppbank = #{oppbank,jdbcType=VARCHAR},
  369. </if>
  370. <if test="oppbankname != null">
  371. oppbankname = #{oppbankname,jdbcType=VARCHAR},
  372. </if>
  373. <if test="oppact != null">
  374. oppact = #{oppact,jdbcType=VARCHAR},
  375. </if>
  376. <if test="oppactname != null">
  377. oppactname = #{oppactname,jdbcType=VARCHAR},
  378. </if>
  379. <if test="fileid != null and fileid != '' ">
  380. fileid = #{fileid,jdbcType=VARCHAR},
  381. </if>
  382. </set>
  383. where settleno = #{settleno,jdbcType=VARCHAR}
  384. </update>
  385. <update id="updateByPrimaryKey" parameterType="com.ydtech.modules.ins.model.InsSettle">
  386. update ins_settle
  387. set billfee = #{billfee,jdbcType=DECIMAL},
  388. insurercode = #{insurercode,jdbcType=VARCHAR},
  389. createdate = #{createdate,jdbcType=TIMESTAMP},
  390. createcode = #{createcode,jdbcType=VARCHAR},
  391. confirmdate = #{confirmdate,jdbcType=TIMESTAMP},
  392. confirmcode = #{confirmcode,jdbcType=VARCHAR},
  393. checkno = #{checkno,jdbcType=VARCHAR},
  394. status = #{status,jdbcType=VARCHAR},
  395. account = #{account,jdbcType=VARCHAR},
  396. orig_commno = #{origCommno,jdbcType=VARCHAR},
  397. updatedate = #{updatedate,jdbcType=TIMESTAMP},
  398. checkflag = #{checkflag,jdbcType=CHAR},
  399. comcode = #{comcode,jdbcType=VARCHAR},
  400. oppbank = #{oppbank,jdbcType=VARCHAR},
  401. oppbankname = #{oppbankname,jdbcType=VARCHAR},
  402. oppact = #{oppact,jdbcType=VARCHAR},
  403. fileid = #{fileid,jdbcType=VARCHAR},
  404. oppactname = #{oppactname,jdbcType=VARCHAR}
  405. where settleno = #{settleno,jdbcType=VARCHAR}
  406. </update>
  407. <update id="updateFileid" parameterType="com.ydtech.modules.ins.model.InsSettle">
  408. update ins_settle
  409. set fileid = #{fileid,jdbcType=VARCHAR},
  410. url = #{url,jdbcType=VARCHAR}
  411. where settleno = #{settleno,jdbcType=VARCHAR}
  412. </update>
  413. </mapper>