InsPmainMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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.InsPmainMapper">
  4. <resultMap id="BaseResultMap" type="com.ydtech.modules.ins.model.InsPmain">
  5. <id column="endorseno" jdbcType="VARCHAR" property="endorseno"/>
  6. <result column="policyno" jdbcType="VARCHAR" property="policyno"/>
  7. <result column="chgpremium" jdbcType="DOUBLE" property="chgpremium"/>
  8. <result column="chgamount" jdbcType="DOUBLE" property="chgamount"/>
  9. <result column="sumpremium" jdbcType="DOUBLE" property="sumpremium"/>
  10. <result column="sumamount" jdbcType="DOUBLE" property="sumamount"/>
  11. <result column="commissionrate" jdbcType="DOUBLE" property="commissionrate"/>
  12. <result column="startdate" jdbcType="TIMESTAMP" property="startdate"/>
  13. <result column="enddate" jdbcType="TIMESTAMP" property="enddate"/>
  14. <result column="operatedate" jdbcType="TIMESTAMP" property="operatedate"/>
  15. <result column="updatedate" jdbcType="TIMESTAMP" property="updatedate"/>
  16. <result column="notaxpremium" jdbcType="DOUBLE" property="notaxpremium"/>
  17. <result column="paydate" jdbcType="TIMESTAMP" property="paydate"/>
  18. </resultMap>
  19. <sql id="Base_Column_List">
  20. endorseno, policyno, chgpremium, chgamount, sumpremium,
  21. sumamount, commissionrate, startdate, enddate, operatedate,
  22. updatedate, notaxpremium, paydate
  23. </sql>
  24. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  25. select
  26. <include refid="Base_Column_List"/>
  27. from ins_pmain
  28. where endorseno = #{endorseno,jdbcType=VARCHAR}
  29. </select>
  30. <select id="selectByVo" resultType="com.ydtech.modules.ins.model.vo.res.InsPmainResVo">
  31. select
  32. a.endorseno,
  33. a.policyno,
  34. a.chgpremium chgpremium,
  35. a.chgamount,
  36. a.sumpremium,
  37. a.sumamount,
  38. CASE
  39. WHEN a.commissionrate IS NULL THEN
  40. b.commissionrate ELSE a.commissionrate
  41. END as commissionrate,
  42. a.startdate,
  43. a.enddate,
  44. a.operatedate,
  45. a.updatedate,
  46. a.notaxpremium,
  47. b.inscompany,
  48. b.comcode,
  49. (select name from esm_ins_company where id=b.inscompany) inscompanyname,
  50. (select name from sys_dept where id=comcode) comname,
  51. b.carflag,
  52. a.paydate paydate
  53. from ins_pmain a left join ins_cmain b on a.policyno=b.policyno
  54. where 1=1
  55. <if test="endorseno != null and endorseno !='' ">
  56. and a.endorseno = #{endorseno,jdbcType=VARCHAR}
  57. </if>
  58. <if test="policyno != null and policyno !='' ">
  59. and a.policyno = #{policyno,jdbcType=VARCHAR}
  60. </if>
  61. <if test="comcode != null and comcode !='' ">
  62. and b.comcode like concat( #{comcode,jdbcType=VARCHAR} , '%')
  63. </if>
  64. <if test="inscompany != null and inscompany !='' ">
  65. and b.inscompany = #{inscompany,jdbcType=VARCHAR}
  66. </if>
  67. order by a.endorseno
  68. </select>
  69. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  70. delete
  71. from ins_pmain
  72. where endorseno = #{endorseno,jdbcType=VARCHAR}
  73. </delete>
  74. <insert id="insert" parameterType="com.ydtech.modules.ins.model.InsPmain">
  75. insert into ins_pmain (endorseno, policyno, chgpremium,
  76. chgamount, sumpremium, sumamount,
  77. commissionrate, startdate, enddate,
  78. operatedate, updatedate, notaxpremium,
  79. paydate)
  80. values (#{endorseno,jdbcType=VARCHAR}, #{policyno,jdbcType=VARCHAR}, #{chgpremium,jdbcType=DOUBLE},
  81. #{chgamount,jdbcType=DOUBLE}, #{sumpremium,jdbcType=DOUBLE}, #{sumamount,jdbcType=DOUBLE},
  82. #{commissionrate,jdbcType=DOUBLE}, #{startdate,jdbcType=TIMESTAMP}, #{enddate,jdbcType=TIMESTAMP},
  83. #{operatedate,jdbcType=TIMESTAMP}, #{updatedate,jdbcType=TIMESTAMP}, #{notaxpremium,jdbcType=DOUBLE},
  84. #{paydate,jdbcType=TIMESTAMP})
  85. </insert>
  86. <insert id="insertSelective" parameterType="com.ydtech.modules.ins.model.InsPmain">
  87. insert into ins_pmain
  88. <trim prefix="(" suffix=")" suffixOverrides=",">
  89. <if test="endorseno != null">
  90. endorseno,
  91. </if>
  92. <if test="policyno != null">
  93. policyno,
  94. </if>
  95. <if test="chgpremium != null">
  96. chgpremium,
  97. </if>
  98. <if test="chgamount != null">
  99. chgamount,
  100. </if>
  101. <if test="sumpremium != null">
  102. sumpremium,
  103. </if>
  104. <if test="sumamount != null">
  105. sumamount,
  106. </if>
  107. <if test="commissionrate != null">
  108. commissionrate,
  109. </if>
  110. <if test="startdate != null">
  111. startdate,
  112. </if>
  113. <if test="enddate != null">
  114. enddate,
  115. </if>
  116. <if test="operatedate != null">
  117. operatedate,
  118. </if>
  119. <if test="updatedate != null">
  120. updatedate,
  121. </if>
  122. <if test="notaxpremium != null">
  123. notaxpremium,
  124. </if>
  125. <if test="paydate != null">
  126. paydate,
  127. </if>
  128. </trim>
  129. <trim prefix="values (" suffix=")" suffixOverrides=",">
  130. <if test="endorseno != null">
  131. #{endorseno,jdbcType=VARCHAR},
  132. </if>
  133. <if test="policyno != null">
  134. #{policyno,jdbcType=VARCHAR},
  135. </if>
  136. <if test="chgpremium != null">
  137. #{chgpremium,jdbcType=DOUBLE},
  138. </if>
  139. <if test="chgamount != null">
  140. #{chgamount,jdbcType=DOUBLE},
  141. </if>
  142. <if test="sumpremium != null">
  143. #{sumpremium,jdbcType=DOUBLE},
  144. </if>
  145. <if test="sumamount != null">
  146. #{sumamount,jdbcType=DOUBLE},
  147. </if>
  148. <if test="commissionrate != null">
  149. #{commissionrate,jdbcType=DOUBLE},
  150. </if>
  151. <if test="startdate != null">
  152. #{startdate,jdbcType=TIMESTAMP},
  153. </if>
  154. <if test="enddate != null">
  155. #{enddate,jdbcType=TIMESTAMP},
  156. </if>
  157. <if test="operatedate != null">
  158. #{operatedate,jdbcType=TIMESTAMP},
  159. </if>
  160. <if test="updatedate != null">
  161. #{updatedate,jdbcType=TIMESTAMP},
  162. </if>
  163. <if test="notaxpremium != null">
  164. #{notaxpremium,jdbcType=DOUBLE},
  165. </if>
  166. <if test="paydate != null">
  167. #{paydate,jdbcType=TIMESTAMP},
  168. </if>
  169. </trim>
  170. </insert>
  171. <insert id="insertBatch" parameterType="list">
  172. insert into ins_pmain (
  173. <include refid="Base_Column_List"/>
  174. )
  175. values
  176. <foreach collection="qtList" item="item" separator=",">
  177. (#{item.endorseno}, #{item.policyno}, #{item.chgpremium}, #{item.chgamount}, #{item.sumpremium},
  178. #{item.sumamount}, #{item.commissionrate}, #{item.startdate}, #{item.enddate}, #{item.operatedate},
  179. #{item.updatedate}, #{item.notaxpremium}, #{item.paydate})
  180. </foreach>
  181. </insert>
  182. <update id="updateByPrimaryKeySelective" parameterType="com.ydtech.modules.ins.model.InsPmain">
  183. update ins_pmain
  184. <set>
  185. <if test="policyno != null">
  186. policyno = #{policyno,jdbcType=VARCHAR},
  187. </if>
  188. <if test="chgpremium != null">
  189. chgpremium = #{chgpremium,jdbcType=DOUBLE},
  190. </if>
  191. <if test="chgamount != null">
  192. chgamount = #{chgamount,jdbcType=DOUBLE},
  193. </if>
  194. <if test="sumpremium != null">
  195. sumpremium = #{sumpremium,jdbcType=DOUBLE},
  196. </if>
  197. <if test="sumamount != null">
  198. sumamount = #{sumamount,jdbcType=DOUBLE},
  199. </if>
  200. <if test="commissionrate != null">
  201. commissionrate = #{commissionrate,jdbcType=DOUBLE},
  202. </if>
  203. <if test="startdate != null">
  204. startdate = #{startdate,jdbcType=TIMESTAMP},
  205. </if>
  206. <if test="enddate != null">
  207. enddate = #{enddate,jdbcType=TIMESTAMP},
  208. </if>
  209. <if test="operatedate != null">
  210. operatedate = #{operatedate,jdbcType=TIMESTAMP},
  211. </if>
  212. <if test="updatedate != null">
  213. updatedate = #{updatedate,jdbcType=TIMESTAMP},
  214. </if>
  215. <if test="notaxpremium != null">
  216. notaxpremium = #{notaxpremium,jdbcType=DOUBLE},
  217. </if>
  218. <if test="paydate != null">
  219. paydate = #{paydate,jdbcType=TIMESTAMP},
  220. </if>
  221. </set>
  222. where endorseno = #{endorseno,jdbcType=VARCHAR}
  223. </update>
  224. <update id="updateByPrimaryKey" parameterType="com.ydtech.modules.ins.model.InsPmain">
  225. update ins_pmain
  226. set policyno = #{policyno,jdbcType=VARCHAR},
  227. chgpremium = #{chgpremium,jdbcType=DOUBLE},
  228. chgamount = #{chgamount,jdbcType=DOUBLE},
  229. sumpremium = #{sumpremium,jdbcType=DOUBLE},
  230. sumamount = #{sumamount,jdbcType=DOUBLE},
  231. commissionrate = #{commissionrate,jdbcType=DOUBLE},
  232. startdate = #{startdate,jdbcType=TIMESTAMP},
  233. enddate = #{enddate,jdbcType=TIMESTAMP},
  234. operatedate = #{operatedate,jdbcType=TIMESTAMP},
  235. updatedate = #{updatedate,jdbcType=TIMESTAMP},
  236. notaxpremium = #{notaxpremium,jdbcType=DOUBLE},
  237. paydate = #{paydate,jdbcType=TIMESTAMP}
  238. where endorseno = #{endorseno,jdbcType=VARCHAR}
  239. </update>
  240. <delete id="deleteBatch">
  241. DELETE FROM ins_pmain
  242. WHERE (endorseno, policyno, updatedate) in
  243. <foreach collection="plist" item="item" index="index" separator="," open="(" close=")">
  244. (#{item.endorseno, jdbcType=VARCHAR}, #{item.policyno, jdbcType=VARCHAR},
  245. DATE_FORMAT(#{item.updatedate, jdbcType=TIMESTAMP}, '%Y-%m-%d'))
  246. </foreach>
  247. </delete>
  248. </mapper>