123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- <?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.EmailFundNavMapper">
- <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailFundNavDO">
- <id column="id" property="id"/>
- <result column="file_id" property="fileId"/>
- <result column="fund_id" property="fundId"/>
- <result column="fund_name" property="fundName"/>
- <result column="register_number" property="registerNumber"/>
- <result column="price_date" property="priceDate"/>
- <result column="nav" property="nav"/>
- <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
- <result column="is_stored" property="isStored"/>
- <result column="exception_status" property="exceptionStatus"/>
- <result column="template_id" property="templateId"/>
- <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"/>
- <result column="email_title" property="emailTitle"/>
- <result column="target_fund_name" property="targetFundName"/>
- <result column="target_fund_id" property="targetFundId"/>
- </resultMap>
- <insert id="batchInsert" parameterType="com.simuwang.base.pojo.dos.EmailFundNavDO">
- insert into PPW_EMAIL.email_fund_nav(file_id, fund_id, fund_name,register_number,price_date,
- nav,cumulative_nav_withdrawal,is_stored,exception_status,template_id,
- isvalid, creatorid, createtime, updaterid, updatetime)
- values
- <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
- (#{itemDo.fileId},#{itemDo.fundId},#{itemDo.fundName},#{itemDo.registerNumber},#{itemDo.priceDate},
- #{itemDo.nav},#{itemDo.cumulativeNavWithdrawal},#{itemDo.isStored},#{itemDo.exceptionStatus},#{itemDo.templateId},
- #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
- </foreach>
- </insert>
- <update id="batchUpdate">
- <foreach collection="navList" item="itemDo" index="index" open="" close="" separator=";">
- update PPW_EMAIL.email_fund_nav
- <set>
- fund_id = #{itemDo.fundId},
- exception_status = #{itemDo.exceptionStatus},
- updatetime=#{itemDo.updateTime},
- is_stored=#{itemDo.isStored}
- </set>
- where isvalid = 1
- and id = #{itemDo.id}
- </foreach>
- </update>
- <delete id="deleteByFileId" parameterType="java.lang.Integer">
- update PPW_EMAIL.email_fund_nav nav set isvalid = 0,updatetime=sysdate() where file_id=#{fileId}
- </delete>
- <select id="searchNavDetail" resultMap="BaseResultMap">
- SELECT nav.id,
- nav.file_id,
- nav.fund_id,
- nav.fund_name,
- info.fund_id as target_fund_id,
- info.fund_name as target_fund_name,
- nav.register_number,
- nav.price_date,
- nav.nav,
- nav.cumulative_nav_withdrawal,
- nav.exception_status,
- nav.is_stored,
- nav.updatetime,
- parse.id as email_id
- FROM
- PPW_EMAIL.email_fund_nav nav
- join PPW_EMAIL.email_file_info file
- on nav.file_id = file.id
- join PPW_EMAIL.email_parse_info parse
- on file.email_id = parse.id
- left join PPW_EMAIL.pvn_fund_info info
- on nav.fund_id=info.fund_id and info.isvalid=1
- WHERE nav.isvalid = 1 and file.isvalid=1 and parse.isvalid=1
- <if test="fundName != null and fundName !=''">
- and (nav.fund_name like concat('%',#{fundName},'%') or nav.register_number like concat('%',#{fundName},'%'))
- </if>
- <if test="priceStartDate != null and priceStartDate !=''">
- and nav.price_date >= #{priceStartDate}
- </if>
- <if test="priceEndDate != null and priceEndDate !=''">
- and nav.price_date <![CDATA[ <= ]]> #{priceEndDate}
- </if>
- <if test="exceptionStatusList != null">
- and nav.exception_status in
- <foreach collection="exceptionStatusList" index="index" item="exceptionStatus" separator="," open="(" close=")">
- #{exceptionStatus}
- </foreach>
- </if>
- <if test="updateStartDate != null and updateStartDate !=''">
- and nav.updatetime <![CDATA[ >= ]]> #{updateStartDate}
- </if>
- <if test="updateEndDate != null and updateEndDate !=''">
- and nav.updatetime <![CDATA[ <= ]]> #{updateEndDate}
- </if>
- <if test="isStore != null">
- and nav.is_stored = #{isStore}
- </if>
- <if test="emailId != null and emailId !=''">
- and parse.id =#{emailId}
- </if>
- <choose>
- <when test="sort != null and sort=='priceDate' and order != null and order =='asc'">
- order by nav.price_date asc
- </when>
- <otherwise>
- order by nav.price_date desc
- </otherwise>
- </choose>
- limit #{offset},#{pageSize}
- </select>
- <select id="countNavDetail" resultType="java.lang.Long"
- parameterType="com.simuwang.base.pojo.dto.query.ParseDetailPageQuery">
- select count(1) from
- PPW_EMAIL.email_fund_nav nav
- join PPW_EMAIL.email_file_info file
- on nav.file_id = file.id
- join PPW_EMAIL.email_parse_info parse
- on file.email_id = parse.id
- left join PPW_EMAIL.pvn_fund_info info
- on nav.fund_id=info.fund_id and info.isvalid=1
- WHERE nav.isvalid = 1 and file.isvalid=1 and parse.isvalid=1
- <if test="fundName != null and fundName !=''">
- and (nav.fund_name like concat('%',#{fundName},'%') or nav.register_number like concat('%',#{fundName},'%'))
- </if>
- <if test="priceStartDate != null and priceStartDate !=''">
- and nav.price_date >= #{priceStartDate}
- </if>
- <if test="priceEndDate != null and priceEndDate !=''">
- and nav.price_date <![CDATA[ <= ]]> #{priceEndDate}
- </if>
- <if test="exceptionStatusList != null">
- and nav.exception_status in
- <foreach collection="exceptionStatusList" index="index" item="exceptionStatus" separator="," open="(" close=")">
- #{exceptionStatus}
- </foreach>
- </if>
- <if test="updateStartDate != null and updateStartDate !=''">
- and nav.updatetime <![CDATA[ >= ]]> #{updateStartDate}
- </if>
- <if test="updateEndDate != null and updateEndDate !=''">
- and nav.updatetime <![CDATA[ <= ]]> #{updateEndDate}
- </if>
- <if test="isStore != null">
- and nav.is_stored = #{isStore}
- </if>
- <if test="emailId != null and emailId != ''">
- and parse.id=#{emailId}
- </if>
- </select>
- <select id="countNoStoreNav" resultType="java.lang.Integer" parameterType="java.lang.String">
- select count(nav.id)
- from PPW_EMAIL.email_fund_nav nav
- where nav.isvalid =1 and nav.exception_status=3
- <if test="fundName != null and fundName != ''">
- and nav.fund_name=#{fundName}
- </if>
- <if test="registerNumber != null and registerNumber != ''">
- and nav.register_number=#{registerNumber}
- </if>
- <if test="registerNumber == null ">
- and nav.register_number is null
- </if>
- <if test="fundName == null ">
- and nav.fund_name is null
- </if>
- </select>
- <select id="selectFileIdByFundName" resultType="java.lang.Integer" parameterType="java.lang.String">
- select distinct nav.file_id from PPW_EMAIL.email_fund_nav nav where nav.isvalid =1 and nav.exception_status in(1,3)
- <if test="fundName != null and fundName != ''">
- and nav.fund_name=#{fundName}
- </if>
- <if test="registerNumber != null and registerNumber != ''">
- and nav.register_number=#{registerNumber}
- </if>
- </select>
- <select id="selectNotMappingNav" resultMap="BaseResultMap"
- parameterType="java.lang.String">
- select nav.id,
- nav.file_id,
- nav.fund_id,
- nav.fund_name,
- nav.register_number,
- nav.price_date,
- nav.nav,
- nav.cumulative_nav_withdrawal,
- nav.exception_status,
- nav.is_stored,
- nav.isvalid,
- nav.creatorid,
- nav.updaterid,
- nav.updatetime,
- nav.createtime
- from PPW_EMAIL.email_fund_nav nav
- where nav.isvalid =1 and nav.exception_status in (1,3)
- <if test="fundName != null and fundName != ''">
- and nav.fund_name=#{fundName}
- </if>
- <if test="registerNumber != null and registerNumber != ''">
- and nav.register_number=#{registerNumber}
- </if>
- order by nav.updatetime desc
- </select>
- <select id="getMaxPriceDate" resultType="java.lang.String" parameterType="java.lang.String">
- select max(nav.price_date) from PPW_EMAIL.email_fund_nav nav where nav.isvalid =1 and nav.exception_status in (1,3)
- and nav.fund_name=#{fundName}
- </select>
- <resultMap id="BaseDetailMap" type="com.simuwang.base.pojo.dos.EmailParseDetailDO">
- <result column="fund_id" property="fundId"/>
- <result column="fund_name" property="fundName"/>
- <result column="register_number" property="registerNumber"/>
- <result column="price_date" property="priceDate"/>
- <result column="nav" property="nav"/>
- <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
- <result column="asset_net" property="assetNet"/>
- <result column="asset_share" property="assetShare"/>
- <result column="nav_is_stored" property="navIsStored"/>
- <result column="nav_exception_status" property="navExceptionStatus"/>
- <result column="asset_is_stored" property="assetIsStored"/>
- <result column="asset_exception_status" property="assetExceptionStatus"/>
- <result column="updatetime" property="updateTime"/>
- </resultMap>
- <select id="selectFundNavByFielId" resultMap="BaseDetailMap">
- SELECT DISTINCT
- nav.fund_id,
- nav.fund_name,
- nav.register_number,
- nav.price_date,
- nav.nav,
- nav.cumulative_nav_withdrawal,
- null as asset_net,
- null as asset_share,
- nav.is_stored AS nav_is_stored,
- nav.exception_status AS nav_exception_status,
- null as asset_is_stored,
- null as asset_exception_status,
- nav.updatetime
- FROM
- PPW_EMAIL.EMAIL_FILE_INFO efi
- JOIN PPW_EMAIL.email_fund_nav nav
- ON efi.id = nav.file_id
- AND nav.isvalid = 1
- WHERE efi.isvalid = 1
- AND efi.id = #{fileId} and nav.price_date=#{priceDate}
- </select>
- <select id="selectNavByFundId" resultMap="BaseResultMap">
- select nav.id,
- nav.file_id,
- nav.fund_id,
- nav.fund_name,
- nav.register_number,
- nav.price_date,
- nav.nav,
- nav.cumulative_nav_withdrawal,
- nav.exception_status,
- nav.is_stored,
- nav.isvalid,
- nav.creatorid,
- nav.updaterid,
- nav.updatetime,
- nav.createtime
- from PPW_EMAIL.email_fund_nav nav
- where nav.isvalid =1 and nav.exception_status=1
- and nav.fund_id = #{fundId}
- </select>
- <select id="countEmailNavTotal" resultType="java.lang.Long">
- select count(1) from PPW_EMAIL.email_fund_nav where isvalid=1
- </select>
- </mapper>
|