123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.simuwang.base.mapper.daq.DistributionMapper">
- <resultMap id="BaseMap" type="com.simuwang.base.pojo.dos.DistributionDO">
- <id column="id" property="id"/>
- <result column="fund_id" property="fundId"/>
- <result column="distribute_date" property="distributeDate"/>
- <result column="distribute_type" property="distributeType"/>
- <result column="distribution" property="distribution"/>
- <result column="isvalid" property="isvalid"/>
- <result column="creatorid" property="creatorId"/>
- <result column="createtime" property="createTime"/>
- <result column="updaterid" property="updaterId"/>
- <result column="updatetime" property="updateTime"/>
- </resultMap>
- <resultMap id="BasePageMap" type="com.simuwang.base.pojo.dos.DistributionTablePageDO">
- <id column="id" property="id"/>
- <result column="fund_name" property="fundName"/>
- <result column="company_name" property="companyName"/>
- <result column="register_number" property="registerNumber"/>
- <result column="fund_id" property="fundId"/>
- <result column="distribute_date" property="distributeDate"/>
- <result column="distribute_type" property="distributeType"/>
- <result column="distribution" property="distribution"/>
- <result column="nav" property="nav"/>
- <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
- <result column="isvalid" property="isvalid"/>
- <result column="creatorid" property="creatorId"/>
- <result column="createtime" property="createTime"/>
- <result column="updaterid" property="updaterId"/>
- <result column="updatetime" property="updateTime"/>
- </resultMap>
- <insert id="saveDistribution" parameterType="com.simuwang.base.pojo.dos.DistributionDO">
- insert into distribution(fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid)
- values (#{fundId},#{distributeDate},#{distributeType},#{distribution},#{isvalid},#{creatorId},#{createTime},#{updateTime},#{updaterId})
- </insert>
- <update id="updateDistributionById" parameterType="com.simuwang.base.pojo.dos.DistributionDO">
- update distribution set distribute_date=#{distributeDate},distribute_type=#{distributeType},distribution=#{distribution},updatetime=#{updateTime},updaterid=#{updaterId}
- where id=#{id} and isvalid =1
- </update>
- <delete id="deleteDistribution" parameterType="com.simuwang.base.pojo.vo.IdListVO">
- update distribution set isvalid =0,updatetime=now(),updaterid=#{updaterId} where isvalid =1 and id in
- <foreach item="id" collection="ids" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="searchDistributionList" resultMap="BasePageMap"
- parameterType="com.simuwang.base.pojo.dto.query.DistributionPageQuery">
- SELECT DISTINCT
- d.id,
- d.fund_id,
- info.fund_name,
- info.register_number,
- c.company_name,
- d.distribute_date,
- d.distribute_type,
- d.distribution,
- n.nav,
- n.cumulative_nav_withdrawal,
- d.updatetime,
- d.isvalid,
- d.creatorid,
- d.createtime,
- d.updatetime
- FROM
- distribution d
- JOIN pvn_fund_info info
- ON d.fund_id = info.fund_id
- left JOIN pvn_company_info c
- ON info.trust_id = c.company_id AND c.isvalid = 1
- JOIN nav n
- ON n.fund_id = d.fund_id and d.distribute_date=n.price_date
- AND n.isvalid = 1
- WHERE d.isvalid = 1
- AND info.isvalid = 1
- <if test="companyName != null and companyName !=''">
- and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
- </if>
- <if test="fundName != null and fundName !=''">
- and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%'))
- </if>
- <if test="distributeType != null">
- and d.distribute_type = #{distributeType}
- </if>
- <if test="startDate != null and startDate !=''">
- and d.distribute_date >= #{startDate}
- </if>
- <if test="endDate != null and endDate !=''">
- and d.distribute_date <![CDATA[ <= ]]> #{endDate}
- </if>
- <choose>
- <when test="sort != null and sort !='' and sort=='distributeDate' and order != null and order !=''">
- order by d.distribute_date ${order}
- </when>
- <otherwise>
- order by d.distribute_date desc
- </otherwise>
- </choose>
- limit #{offset},#{pageSize}
- </select>
- <select id="countDistributionList" resultType="java.lang.Long"
- parameterType="com.simuwang.base.pojo.dto.query.DistributionPageQuery">
- select count(distinct d.id)
- FROM
- distribution d
- JOIN pvn_fund_info info
- ON d.fund_id = info.fund_id
- left JOIN pvn_company_info c
- ON info.trust_id = c.company_id AND c.isvalid = 1
- JOIN nav n
- ON n.fund_id = d.fund_id and d.distribute_date=n.price_date
- WHERE d.isvalid = 1 AND info.isvalid = 1
- AND n.isvalid = 1
- <if test="companyName != null and companyName !=''">
- and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
- </if>
- <if test="fundName != null and fundName !=''">
- and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%'))
- </if>
- <if test="distributeType != null">
- and d.distribute_type = #{distributeType}
- </if>
- <if test="startDate != null and startDate !=''">
- and d.distribute_date >= #{startDate}
- </if>
- <if test="endDate != null and endDate !=''">
- and d.distribute_date <![CDATA[ <= ]]> #{endDate}
- </if>
- </select>
- <select id="selectDistributionById" resultMap="BaseMap"
- parameterType="java.lang.Integer">
- select id,fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid
- from distribution where isvalid =1 and id=#{id}
- </select>
- <select id="selectDistributionByDate" resultMap="BaseMap">
- select id,fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid
- from distribution where isvalid =1 and fund_id=#{fundId} and distribute_date=#{distributeDate}
- </select>
- <select id="getDistributionByFundId" resultMap="BaseMap">
- select id,fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid
- from distribution where isvalid =1 and fund_id=#{fundId} and distribute_type=#{distributeType}
- </select>
- <select id="getSumDistributeByFundId" resultType="java.math.BigDecimal" parameterType="java.lang.String">
- select sum(distribution) from distribution where isvalid =1 and fund_id=#{fundId} and distribute_date <![CDATA[ <= ]]> #{distributeDate}
- </select>
- <select id="countDistributionTotal" resultType="java.lang.Long">
- select count(1) from distribution where isvalid =1
- </select>
- <select id="selectDistributeListByTime" resultMap="BaseMap">
- select id,fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid
- from distribution where updatetime <![CDATA[ <= ]]> #{endDate}
- <if test="startDate != null and startDate !=''">
- and updatetime >= #{startDate}
- </if>
- order by updatetime desc
- </select>
- </mapper>
|