InsSettleDetailMapper.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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.InsSettleDetailMapper">
  4. <resultMap id="BaseResultMap" type="com.ydtech.modules.ins.model.InsSettleDetail">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="settleno" jdbcType="VARCHAR" property="settleno"/>
  7. <result column="policyno" jdbcType="VARCHAR" property="policyno"/>
  8. <result column="commission" jdbcType="DECIMAL" property="commission"/>
  9. <result column="checkflag" jdbcType="CHAR" property="checkflag"/>
  10. </resultMap>
  11. <sql id="Base_Column_List">
  12. id, settleno, policyno, commission, checkflag
  13. </sql>
  14. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  15. select
  16. <include refid="Base_Column_List"/>
  17. from ins_settle_detail
  18. where id = #{id,jdbcType=BIGINT}
  19. </select>
  20. <select id="selectSettleDetail" parameterType="com.ydtech.modules.ins.model.vo.InsSettleReqVo"
  21. resultType="com.ydtech.modules.ins.model.vo.PolicynoDetailResVo">
  22. SELECT
  23. b.id id,
  24. b.settleno settleno,
  25. b.policyno policyno,
  26. c.riskcode riskcode,
  27. c.riskname riskname,
  28. a.insurercode inscompany,
  29. e.name inscompanyname,
  30. c.comcode teamcode,
  31. f.name teamname,
  32. IF(SUBSTR(c.comcode, 1, 5) like '%D%',
  33. (select aa.name from sys_dept aa where aa.parent_id ='100' and aa.id=c.comcode),
  34. (select aa.name from sys_dept aa where aa.parent_id ='100' and aa.id=(SUBSTR(c.comcode, 1, 5)))) comname,
  35. IF(SUBSTR(c.comcode, 1, 5) like '%D%', c.comcode, SUBSTR(c.comcode, 1, 5)) comcode,
  36. c.updatedate updatedate,
  37. c.commissionrate commissionrate,
  38. b.commission commission,
  39. c.sumpremium sumpremium,
  40. c.notaxpremium notaxpremium,
  41. b.checkflag checkflag,
  42. c.operatedate operatedate,
  43. c.startdate startdate,
  44. c.applicode applicode,
  45. c.appliname appliname,
  46. c.insuredcode insuredcode,
  47. c.insuredname insuredname
  48. FROM
  49. ins_settle_detail b
  50. LEFT JOIN ins_settle a ON a.settleno = b.settleno
  51. LEFT JOIN ins_cmain c ON b.policyno = c.policyno
  52. LEFT JOIN esm_product d ON d.id = c.riskcode
  53. LEFT JOIN esm_ins_company e ON a.insurercode = e.id
  54. LEFT JOIN sys_dept f ON f.id=c.comcode
  55. WHERE
  56. 1 = 1
  57. <if test="settleno != null and settleno != ''">
  58. AND b.settleno = #{settleno,jdbcType=VARCHAR}
  59. </if>
  60. <if test="insurercode != null and insurercode != ''">
  61. AND a.insurercode = #{insurercode,jdbcType=VARCHAR}
  62. </if>
  63. <if test="createdate != null">
  64. AND DATE_FORMAT(a.createdate, '%Y-%m-%d') = DATE_FORMAT(#{createdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  65. </if>
  66. <if test="createcode != null and createcode != ''">
  67. AND a.createcode = #{createcode,jdbcType=VARCHAR}
  68. </if>
  69. <if test="confirmdate != null">
  70. AND DATE_FORMAT(a.confirmdate, '%Y-%m-%d') = DATE_FORMAT(#{confirmdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  71. </if>
  72. <if test="confirmcode != null and confirmcode != ''">
  73. AND a.confirmcode = #{confirmcode,jdbcType=VARCHAR}
  74. </if>
  75. <if test="checkno != null and checkno != ''">
  76. AND a.checkno = #{checkno,jdbcType=VARCHAR}
  77. </if>
  78. <if test="status != null and status != ''">
  79. AND a.status = #{status,jdbcType=VARCHAR}
  80. </if>
  81. <if test="account != null and account != ''">
  82. AND a.account = #{account,jdbcType=VARCHAR}
  83. </if>
  84. <if test="origCommno != null and origCommno != ''">
  85. AND a.orig_commno = #{origCommno,jdbcType=VARCHAR}
  86. </if>
  87. <if test="updatedate != null">
  88. AND DATE_FORMAT(a.updatedate, '%Y-%m-%d') = DATE_FORMAT(#{updatedate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  89. </if>
  90. <if test="checkflag != null and checkflag != ''">
  91. AND b.checkflag = #{checkflag,jdbcType=CHAR}
  92. </if>
  93. ORDER BY b.id asc
  94. </select>
  95. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  96. delete
  97. from ins_settle_detail
  98. where id = #{id,jdbcType=BIGINT}
  99. </delete>
  100. <insert id="insert" parameterType="com.ydtech.modules.ins.model.InsSettleDetail">
  101. insert into ins_settle_detail (id, settleno, policyno,
  102. commission, checkflag)
  103. values (#{id,jdbcType=BIGINT}, #{settleno,jdbcType=VARCHAR}, #{policyno,jdbcType=VARCHAR},
  104. #{commission,jdbcType=DECIMAL}, #{checkflag,jdbcType=CHAR})
  105. </insert>
  106. <insert id="insertSelective" parameterType="com.ydtech.modules.ins.model.InsSettleDetail">
  107. insert into ins_settle_detail
  108. <trim prefix="(" suffix=")" suffixOverrides=",">
  109. <if test="id != null">
  110. id,
  111. </if>
  112. <if test="settleno != null">
  113. settleno,
  114. </if>
  115. <if test="policyno != null">
  116. policyno,
  117. </if>
  118. <if test="commission != null">
  119. commission,
  120. </if>
  121. <if test="checkflag != null">
  122. checkflag,
  123. </if>
  124. </trim>
  125. <trim prefix="values (" suffix=")" suffixOverrides=",">
  126. <if test="id != null">
  127. #{id,jdbcType=BIGINT},
  128. </if>
  129. <if test="settleno != null">
  130. #{settleno,jdbcType=VARCHAR},
  131. </if>
  132. <if test="policyno != null">
  133. #{policyno,jdbcType=VARCHAR},
  134. </if>
  135. <if test="commission != null">
  136. #{commission,jdbcType=DECIMAL},
  137. </if>
  138. <if test="checkflag != null">
  139. #{checkflag,jdbcType=CHAR},
  140. </if>
  141. </trim>
  142. </insert>
  143. <insert id="batchInsert" parameterType="list">
  144. insert into ins_settle_detail (
  145. <include refid="Base_Column_List"/>
  146. )
  147. values
  148. <foreach collection="insSettleDetailList" item="item" separator=",">
  149. (#{item.id}, #{item.settleno}, #{item.policyno}, #{item.commission}, #{item.checkflag})
  150. </foreach>
  151. </insert>
  152. <update id="updateByPrimaryKeySelective" parameterType="com.ydtech.modules.ins.model.InsSettleDetail">
  153. update ins_settle_detail
  154. <set>
  155. <if test="settleno != null">
  156. settleno = #{settleno,jdbcType=VARCHAR},
  157. </if>
  158. <if test="policyno != null">
  159. policyno = #{policyno,jdbcType=VARCHAR},
  160. </if>
  161. <if test="commission != null">
  162. commission = #{commission,jdbcType=DECIMAL},
  163. </if>
  164. <if test="checkflag != null">
  165. checkflag = #{checkflag,jdbcType=CHAR},
  166. </if>
  167. </set>
  168. where id = #{id,jdbcType=BIGINT}
  169. </update>
  170. <update id="updateByPrimaryKey" parameterType="com.ydtech.modules.ins.model.InsSettleDetail">
  171. update ins_settle_detail
  172. set settleno = #{settleno,jdbcType=VARCHAR},
  173. policyno = #{policyno,jdbcType=VARCHAR},
  174. commission = #{commission,jdbcType=DECIMAL},
  175. checkflag = #{checkflag,jdbcType=CHAR}
  176. where id = #{id,jdbcType=BIGINT}
  177. </update>
  178. </mapper>