DistributionMapper.xml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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.simuwang.base.mapper.DistributionMapper">
  4. <resultMap id="BaseMap" type="com.simuwang.base.pojo.dos.DistributionDO">
  5. <id column="id" property="id"/>
  6. <result column="fund_id" property="fundId"/>
  7. <result column="distribute_date" property="distributeDate"/>
  8. <result column="distribute_type" property="distributeType"/>
  9. <result column="distribution" property="distribution"/>
  10. <result column="isvalid" property="isvalid"/>
  11. <result column="creatorid" property="creatorId"/>
  12. <result column="createtime" property="createTime"/>
  13. <result column="updaterid" property="updaterId"/>
  14. <result column="updatetime" property="updateTime"/>
  15. </resultMap>
  16. <resultMap id="BasePageMap" type="com.simuwang.base.pojo.dos.DistributionTablePageDO">
  17. <id column="id" property="id"/>
  18. <result column="fund_name" property="fundName"/>
  19. <result column="company_name" property="companyName"/>
  20. <result column="register_number" property="registerNumber"/>
  21. <result column="fund_id" property="fundId"/>
  22. <result column="distribute_date" property="distributeDate"/>
  23. <result column="distribute_type" property="distributeType"/>
  24. <result column="distribution" property="distribution"/>
  25. <result column="nav" property="nav"/>
  26. <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
  27. <result column="isvalid" property="isvalid"/>
  28. <result column="creatorid" property="creatorId"/>
  29. <result column="createtime" property="createTime"/>
  30. <result column="updaterid" property="updaterId"/>
  31. <result column="updatetime" property="updateTime"/>
  32. </resultMap>
  33. <insert id="saveDistribution" parameterType="com.simuwang.base.pojo.dos.DistributionDO">
  34. insert into PPW_EMAIL.distribution(fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid)
  35. values (#{fundId},#{distributeDate},#{distributeType},#{distribution},#{isvalid},#{creatorId},#{createTime},#{updateTime},#{updaterId})
  36. </insert>
  37. <update id="updateDistributionById" parameterType="com.simuwang.base.pojo.dos.DistributionDO">
  38. update PPW_EMAIL.distribution set distribute_date=#{distributeDate},distribute_type=#{distributeType},distribution=#{distribution},updatetime=#{updateTime}
  39. where id=#{id} and isvalid =1
  40. </update>
  41. <delete id="deleteDistribution" parameterType="com.simuwang.base.pojo.vo.IdListVO">
  42. update PPW_EMAIL.distribution set isvalid =0,updatetime=sysdate() where isvalid =1 and id in
  43. <foreach item="id" collection="ids" open="(" separator="," close=")">
  44. #{id}
  45. </foreach>
  46. </delete>
  47. <select id="searchDistributionList" resultMap="BasePageMap"
  48. parameterType="com.simuwang.base.pojo.dto.query.DistributionPageQuery">
  49. SELECT DISTINCT
  50. d.id,
  51. d.fund_id,
  52. info.fund_name,
  53. info.register_number,
  54. c.company_name,
  55. d.distribute_date,
  56. d.distribute_type,
  57. d.distribution,
  58. n.nav,
  59. n.cumulative_nav_withdrawal,
  60. d.updatetime,
  61. d.isvalid,
  62. d.creatorid,
  63. d.createtime,
  64. d.updatetime
  65. FROM
  66. PPW_EMAIL.distribution d
  67. JOIN PPW_EMAIL.pvn_fund_info info
  68. ON d.fund_id = info.fund_id
  69. left JOIN PPW_EMAIL.pvn_company_info c
  70. ON info.trust_id = c.company_id AND c.isvalid = 1
  71. JOIN PPW_EMAIL.nav n
  72. ON n.fund_id = d.fund_id and d.distribute_date=n.price_date
  73. AND n.isvalid = 1
  74. WHERE d.isvalid = 1
  75. AND info.isvalid = 1
  76. <if test="companyName != null and companyName !=''">
  77. and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
  78. </if>
  79. <if test="fundName != null and fundName !=''">
  80. and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%'))
  81. </if>
  82. <if test="distributeType != null">
  83. and d.distribute_type = #{distributeType}
  84. </if>
  85. <if test="startDate != null and startDate !=''">
  86. and d.distribute_date >= #{startDate}
  87. </if>
  88. <if test="endDate != null and endDate !=''">
  89. and d.distribute_date <![CDATA[ <= ]]> #{endDate}
  90. </if>
  91. order by d.updatetime desc
  92. limit #{offset},#{pageSize}
  93. </select>
  94. <select id="countDistributionList" resultType="java.lang.Long"
  95. parameterType="com.simuwang.base.pojo.dto.query.DistributionPageQuery">
  96. select count(distinct d.id)
  97. FROM
  98. PPW_EMAIL.distribution d
  99. JOIN PPW_EMAIL.pvn_fund_info info
  100. ON d.fund_id = info.fund_id
  101. left JOIN PPW_EMAIL.pvn_company_info c
  102. ON info.trust_id = c.company_id AND c.isvalid = 1
  103. JOIN PPW_EMAIL.nav n
  104. ON n.fund_id = d.fund_id and d.distribute_date=n.price_date
  105. WHERE d.isvalid = 1 AND info.isvalid = 1
  106. AND n.isvalid = 1
  107. <if test="companyName != null and companyName !=''">
  108. and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
  109. </if>
  110. <if test="fundName != null and fundName !=''">
  111. and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%'))
  112. </if>
  113. <if test="distributeType != null">
  114. and d.distribute_type = #{distributeType}
  115. </if>
  116. <if test="startDate != null and startDate !=''">
  117. and d.distribute_date >= #{startDate}
  118. </if>
  119. <if test="endDate != null and endDate !=''">
  120. and d.distribute_date <![CDATA[ <= ]]> #{endDate}
  121. </if>
  122. </select>
  123. <select id="selectDistributionById" resultMap="BaseMap"
  124. parameterType="java.lang.Integer">
  125. select id,fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid
  126. from PPW_EMAIL.distribution where isvalid =1 and id=#{id}
  127. </select>
  128. <select id="selectDistributionByDate" resultMap="BaseMap">
  129. select id,fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid
  130. from PPW_EMAIL.distribution where isvalid =1 and fund_id=#{fundId} and distribute_date=#{distributeDate}
  131. </select>
  132. <select id="getDistributionByFundId" resultMap="BaseMap">
  133. select id,fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid
  134. from PPW_EMAIL.distribution where isvalid =1 and fund_id=#{fundId} and distribute_type=#{distributeType}
  135. </select>
  136. <select id="getSumDistributeByFundId" resultType="java.math.BigDecimal" parameterType="java.lang.String">
  137. select sum(distribution) from PPW_EMAIL.distribution where isvalid =1 and fund_id=#{fundId} and distribute_date <![CDATA[ <= ]]> #{distributeDate}
  138. </select>
  139. </mapper>