FncVouBusinessMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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.fnc.dao.FncVouBusinessMapper">
  4. <resultMap id="BaseResultMap" type="com.ydtech.modules.fnc.model.FncVouBusiness">
  5. <result column="c_seq_no" jdbcType="VARCHAR" property="cSeqNo"/>
  6. <result column="policyno" jdbcType="VARCHAR" property="policyno"/>
  7. <result column="notaxpremium" jdbcType="DOUBLE" property="notaxpremium"/>
  8. <result column="commissionrate" jdbcType="DOUBLE" property="commissionrate"/>
  9. <result column="commission" jdbcType="DOUBLE" property="commission"/>
  10. <result column="settleno" jdbcType="VARCHAR" property="settleno"/>
  11. <result column="billfee" jdbcType="DOUBLE" property="billfee"/>
  12. <result column="inputdate" jdbcType="TIMESTAMP" property="inputdate"/>
  13. <result column="agentcode" jdbcType="VARCHAR" property="agentcode"/>
  14. <result column="comcode" jdbcType="VARCHAR" property="comcode"/>
  15. <result column="inscompany" jdbcType="VARCHAR" property="inscompany"/>
  16. </resultMap>
  17. <sql id="Example_Where_Clause">
  18. <where>
  19. <foreach collection="oredCriteria" item="criteria" separator="or">
  20. <if test="criteria.valid">
  21. <trim prefix="(" prefixOverrides="and" suffix=")">
  22. <foreach collection="criteria.criteria" item="criterion">
  23. <choose>
  24. <when test="criterion.noValue">
  25. and ${criterion.condition}
  26. </when>
  27. <when test="criterion.singleValue">
  28. and ${criterion.condition} #{criterion.value}
  29. </when>
  30. <when test="criterion.betweenValue">
  31. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  32. </when>
  33. <when test="criterion.listValue">
  34. and ${criterion.condition}
  35. <foreach close=")" collection="criterion.value" item="listItem" open="("
  36. separator=",">
  37. #{listItem}
  38. </foreach>
  39. </when>
  40. </choose>
  41. </foreach>
  42. </trim>
  43. </if>
  44. </foreach>
  45. </where>
  46. </sql>
  47. <sql id="Update_By_Example_Where_Clause">
  48. <where>
  49. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  50. <if test="criteria.valid">
  51. <trim prefix="(" prefixOverrides="and" suffix=")">
  52. <foreach collection="criteria.criteria" item="criterion">
  53. <choose>
  54. <when test="criterion.noValue">
  55. and ${criterion.condition}
  56. </when>
  57. <when test="criterion.singleValue">
  58. and ${criterion.condition} #{criterion.value}
  59. </when>
  60. <when test="criterion.betweenValue">
  61. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  62. </when>
  63. <when test="criterion.listValue">
  64. and ${criterion.condition}
  65. <foreach close=")" collection="criterion.value" item="listItem" open="("
  66. separator=",">
  67. #{listItem}
  68. </foreach>
  69. </when>
  70. </choose>
  71. </foreach>
  72. </trim>
  73. </if>
  74. </foreach>
  75. </where>
  76. </sql>
  77. <sql id="Base_Column_List">
  78. c_seq_no, policyno, notaxpremium, commissionrate, commission, settleno, billfee,
  79. inputdate, agentcode, comcode, inscompany
  80. </sql>
  81. <select id="selectByExample" parameterType="com.ydtech.modules.fnc.model.FncVouBusinessExample"
  82. resultMap="BaseResultMap">
  83. select
  84. <if test="distinct">
  85. distinct
  86. </if>
  87. 'true' as QUERYID,
  88. <include refid="Base_Column_List"/>
  89. from fnc_vou_business
  90. <if test="_parameter != null">
  91. <include refid="Example_Where_Clause"/>
  92. </if>
  93. <if test="orderByClause != null">
  94. order by ${orderByClause}
  95. </if>
  96. </select>
  97. <delete id="deleteByExample" parameterType="com.ydtech.modules.fnc.model.FncVouBusinessExample">
  98. delete from fnc_vou_business
  99. <if test="_parameter != null">
  100. <include refid="Example_Where_Clause"/>
  101. </if>
  102. </delete>
  103. <insert id="insert" parameterType="com.ydtech.modules.fnc.model.FncVouBusiness">
  104. insert into fnc_vou_business (c_seq_no, policyno, notaxpremium,
  105. commissionrate, commission, settleno,
  106. billfee, inputdate, agentcode,
  107. comcode, inscompany)
  108. values (#{cSeqNo,jdbcType=VARCHAR}, #{policyno,jdbcType=VARCHAR}, #{notaxpremium,jdbcType=DOUBLE},
  109. #{commissionrate,jdbcType=DOUBLE}, #{commission,jdbcType=DOUBLE}, #{settleno,jdbcType=VARCHAR},
  110. #{billfee,jdbcType=DOUBLE}, #{inputdate,jdbcType=TIMESTAMP}, #{agentcode,jdbcType=VARCHAR},
  111. #{comcode,jdbcType=VARCHAR}, #{inscompany,jdbcType=VARCHAR})
  112. </insert>
  113. <insert id="insertSelective" parameterType="com.ydtech.modules.fnc.model.FncVouBusiness">
  114. insert into fnc_vou_business
  115. <trim prefix="(" suffix=")" suffixOverrides=",">
  116. <if test="cSeqNo != null">
  117. c_seq_no,
  118. </if>
  119. <if test="policyno != null">
  120. policyno,
  121. </if>
  122. <if test="notaxpremium != null">
  123. notaxpremium,
  124. </if>
  125. <if test="commissionrate != null">
  126. commissionrate,
  127. </if>
  128. <if test="commission != null">
  129. commission,
  130. </if>
  131. <if test="settleno != null">
  132. settleno,
  133. </if>
  134. <if test="billfee != null">
  135. billfee,
  136. </if>
  137. <if test="inputdate != null">
  138. inputdate,
  139. </if>
  140. <if test="agentcode != null">
  141. agentcode,
  142. </if>
  143. <if test="comcode != null">
  144. comcode,
  145. </if>
  146. <if test="inscompany != null">
  147. inscompany,
  148. </if>
  149. </trim>
  150. <trim prefix="values (" suffix=")" suffixOverrides=",">
  151. <if test="cSeqNo != null">
  152. #{cSeqNo,jdbcType=VARCHAR},
  153. </if>
  154. <if test="policyno != null">
  155. #{policyno,jdbcType=VARCHAR},
  156. </if>
  157. <if test="notaxpremium != null">
  158. #{notaxpremium,jdbcType=DOUBLE},
  159. </if>
  160. <if test="commissionrate != null">
  161. #{commissionrate,jdbcType=DOUBLE},
  162. </if>
  163. <if test="commission != null">
  164. #{commission,jdbcType=DOUBLE},
  165. </if>
  166. <if test="settleno != null">
  167. #{settleno,jdbcType=VARCHAR},
  168. </if>
  169. <if test="billfee != null">
  170. #{billfee,jdbcType=DOUBLE},
  171. </if>
  172. <if test="inputdate != null">
  173. #{inputdate,jdbcType=TIMESTAMP},
  174. </if>
  175. <if test="agentcode != null">
  176. #{agentcode,jdbcType=VARCHAR},
  177. </if>
  178. <if test="comcode != null">
  179. #{comcode,jdbcType=VARCHAR},
  180. </if>
  181. <if test="inscompany != null">
  182. #{inscompany,jdbcType=VARCHAR},
  183. </if>
  184. </trim>
  185. </insert>
  186. <select id="countByExample" parameterType="com.ydtech.modules.fnc.model.FncVouBusinessExample"
  187. resultType="java.lang.Long">
  188. select count(*) from fnc_vou_business
  189. <if test="_parameter != null">
  190. <include refid="Example_Where_Clause"/>
  191. </if>
  192. </select>
  193. <update id="updateByExampleSelective" parameterType="map">
  194. update fnc_vou_business
  195. <set>
  196. <if test="record.cSeqNo != null">
  197. c_seq_no = #{record.cSeqNo,jdbcType=VARCHAR},
  198. </if>
  199. <if test="record.policyno != null">
  200. policyno = #{record.policyno,jdbcType=VARCHAR},
  201. </if>
  202. <if test="record.notaxpremium != null">
  203. notaxpremium = #{record.notaxpremium,jdbcType=DOUBLE},
  204. </if>
  205. <if test="record.commissionrate != null">
  206. commissionrate = #{record.commissionrate,jdbcType=DOUBLE},
  207. </if>
  208. <if test="record.commission != null">
  209. commission = #{record.commission,jdbcType=DOUBLE},
  210. </if>
  211. <if test="record.settleno != null">
  212. settleno = #{record.settleno,jdbcType=VARCHAR},
  213. </if>
  214. <if test="record.billfee != null">
  215. billfee = #{record.billfee,jdbcType=DOUBLE},
  216. </if>
  217. <if test="record.inputdate != null">
  218. inputdate = #{record.inputdate,jdbcType=TIMESTAMP},
  219. </if>
  220. <if test="record.agentcode != null">
  221. agentcode = #{record.agentcode,jdbcType=VARCHAR},
  222. </if>
  223. <if test="record.comcode != null">
  224. comcode = #{record.comcode,jdbcType=VARCHAR},
  225. </if>
  226. <if test="record.inscompany != null">
  227. inscompany = #{record.inscompany,jdbcType=VARCHAR},
  228. </if>
  229. </set>
  230. <if test="_parameter != null">
  231. <include refid="Update_By_Example_Where_Clause"/>
  232. </if>
  233. </update>
  234. <update id="updateByExample" parameterType="map">
  235. update fnc_vou_business
  236. set c_seq_no = #{record.cSeqNo,jdbcType=VARCHAR},
  237. policyno = #{record.policyno,jdbcType=VARCHAR},
  238. notaxpremium = #{record.notaxpremium,jdbcType=DOUBLE},
  239. commissionrate = #{record.commissionrate,jdbcType=DOUBLE},
  240. commission = #{record.commission,jdbcType=DOUBLE},
  241. settleno = #{record.settleno,jdbcType=VARCHAR},
  242. billfee = #{record.billfee,jdbcType=DOUBLE},
  243. inputdate = #{record.inputdate,jdbcType=TIMESTAMP},
  244. agentcode = #{record.agentcode,jdbcType=VARCHAR},
  245. comcode = #{record.comcode,jdbcType=VARCHAR},
  246. inscompany = #{record.inscompany,jdbcType=VARCHAR}
  247. <if test="_parameter != null">
  248. <include refid="Update_By_Example_Where_Clause"/>
  249. </if>
  250. </update>
  251. <select id="selectBillfeeByAgentcode" parameterType="java.lang.String" resultMap="BaseResultMap">
  252. select agentcode, SUBSTR(comcode, 1, 5) comcode, sum(a.billfee) billfee
  253. from fnc_vou_business a
  254. where DATE_FORMAT(inputdate, '%Y-%m-%d') = DATE_FORMAT(#{inputdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  255. and policyno is null
  256. and settleno is not null
  257. and inscompany like '100001%'
  258. group by agentcode, SUBSTR(comcode, 1, 5)
  259. </select>
  260. <select id="selectBillfeeByInscompany" parameterType="java.lang.String" resultMap="BaseResultMap">
  261. select inscompany, substring_index(comcode, 'D', 1) comcode, sum(a.billfee) billfee
  262. from fnc_vou_business a
  263. where DATE_FORMAT(inputdate, '%Y-%m-%d') = DATE_FORMAT(#{inputdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  264. and policyno is null
  265. and settleno is not null
  266. and inscompany not like '100001%'
  267. group by inscompany, substring_index(comcode, 'D', 1)
  268. </select>
  269. <select id="selectCommissionByAgentcode" parameterType="java.lang.String" resultMap="BaseResultMap">
  270. select agentcode, SUBSTR(comcode, 1, 5) comcode, sum(a.commission) commission
  271. from fnc_vou_business a
  272. where DATE_FORMAT(inputdate, '%Y-%m-%d') = DATE_FORMAT(#{inputdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  273. and policyno is not null
  274. and settleno is null
  275. and inscompany like '100001%'
  276. group by agentcode, SUBSTR(comcode, 1, 5)
  277. </select>
  278. <select id="selectCommissionByInscompany" parameterType="java.lang.String" resultMap="BaseResultMap">
  279. select inscompany, substring_index(comcode, 'D', 1) comcode, sum(a.commission) commission
  280. from fnc_vou_business a
  281. where DATE_FORMAT(inputdate, '%Y-%m-%d') = DATE_FORMAT(#{inputdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  282. and policyno is not null
  283. and settleno is null
  284. and inscompany not like '100001%'
  285. group by inscompany, substring_index(comcode, 'D', 1)
  286. </select>
  287. <select id="selectBookCodeByAgentcode" parameterType="java.lang.String" resultType="java.lang.String">
  288. SELECT book_code
  289. from fnc_book_agent
  290. where agentcode = #{agentcode,jdbcType=TIMESTAMP}
  291. </select>
  292. <select id="selectBookCodeByComcode" parameterType="java.lang.String" resultType="java.lang.String">
  293. SELECT book_code
  294. from fnc_book_com
  295. where comcode like #{comcode,jdbcType=TIMESTAMP}
  296. </select>
  297. <update id="updateSettleVouByAgentcode" parameterType="com.ydtech.modules.fnc.model.FncVouBusiness">
  298. update fnc_vou_business
  299. set c_seq_no = #{cSeqNo,jdbcType=VARCHAR}
  300. where agentcode = #{agentcode,jdbcType=VARCHAR}
  301. and comcode like concat('%', #{comcode,jdbcType=VARCHAR}, '%')
  302. and DATE_FORMAT(inputdate, '%Y-%m-%d') = DATE_FORMAT(#{inputdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  303. and policyno is null
  304. and settleno is not null
  305. </update>
  306. <update id="updateSettleVouByInscompany" parameterType="com.ydtech.modules.fnc.model.FncVouBusiness">
  307. update fnc_vou_business
  308. set c_seq_no = #{cSeqNo,jdbcType=VARCHAR}
  309. where inscompany = #{inscompany,jdbcType=VARCHAR}
  310. and comcode like concat('%', #{comcode,jdbcType=VARCHAR}, '%')
  311. and DATE_FORMAT(inputdate, '%Y-%m-%d') = DATE_FORMAT(#{inputdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  312. and policyno is null
  313. and settleno is not null
  314. </update>
  315. <update id="updatePolicyVouByAgentcode" parameterType="com.ydtech.modules.fnc.model.FncVouBusiness">
  316. update fnc_vou_business
  317. set c_seq_no = #{cSeqNo,jdbcType=VARCHAR}
  318. where agentcode = #{agentcode,jdbcType=VARCHAR}
  319. and comcode like concat('%', #{comcode,jdbcType=VARCHAR}, '%')
  320. and DATE_FORMAT(inputdate, '%Y-%m-%d') = DATE_FORMAT(#{inputdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  321. and policyno is not null
  322. and settleno is null
  323. </update>
  324. <update id="updatePolicyVouByInscompany" parameterType="com.ydtech.modules.fnc.model.FncVouBusiness">
  325. update fnc_vou_business
  326. set c_seq_no = #{cSeqNo,jdbcType=VARCHAR}
  327. where inscompany = #{inscompany,jdbcType=VARCHAR}
  328. and comcode like concat('%', #{comcode,jdbcType=VARCHAR}, '%')
  329. and DATE_FORMAT(inputdate, '%Y-%m-%d') = DATE_FORMAT(#{inputdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
  330. and policyno is not null
  331. and settleno is null
  332. </update>
  333. </mapper>