123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- <?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.smppw.modaq.domain.mapper.EmailFileInfoMapper">
- <resultMap id="BaseResultMap" type="com.smppw.modaq.domain.entity.EmailFileInfoDO">
- <id column="id" property="id"/>
- <result column="email_id" property="emailId"/>
- <result column="file_name" property="fileName"/>
- <result column="file_path" property="filePath"/>
- <result column="ai_parse" property="aiParse"/>
- <!-- <result column="ai_file_id" property="aiFileId"/>-->
- <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="insertById" parameterType="com.smppw.modaq.domain.entity.EmailFileInfoDO" useGeneratedKeys="true"
- keyProperty="id" keyColumn="id">
- insert into mo_email_file_info(email_id, file_name, file_path,
- isvalid, creatorid, createtime, updaterid, updatetime)
- values (#{itemDo.emailId}, #{itemDo.fileName}, #{itemDo.filePath},
- #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
- </insert>
- <!-- <select id="getEmailFileById" resultMap="BaseResultMap"-->
- <!-- parameterType="java.lang.Integer">-->
- <!-- select id ,email_id, file_name, file_path,ai_parse,ai_file_id,-->
- <!-- isvalid, creatorid, createtime, updaterid, updatetime-->
- <!-- from mo_email_file_info where id=#{id} and isvalid=1-->
- <!-- </select>-->
- <!-- <select id="getEmailFileByEmailId" resultMap="BaseResultMap"-->
- <!-- parameterType="java.lang.Integer">-->
- <!-- select id ,email_id, file_name, file_path,ai_parse,ai_file_id,-->
- <!-- isvalid, creatorid, createtime, updaterid, updatetime-->
- <!-- from mo_email_file_info where email_id=#{emailId} and isvalid=1-->
- <!-- </select>-->
- <select id="queryByEmailId" resultMap="BaseResultMap">
- select id, file_name, file_path,ai_parse
- from mo_email_file_info
- where email_id = #{emailId}
- and isvalid = 1
- </select>
- <!-- <select id="searchFundFileInfo" resultType="com.simuwang.base.pojo.vo.FundFileInfoVO">-->
- <!-- SELECT DISTINCT efi.id as "fileId",-->
- <!-- <if test="fileType != 3">-->
- <!-- efn.fund_id as "fundId",-->
- <!-- efn.fund_name as "fundName",-->
- <!-- </if>-->
- <!-- <if test="fileType == 3">-->
- <!-- info.fund_id as "fundId",-->
- <!-- efn.fund_name as "fundName",-->
- <!-- </if>-->
- <!-- efi.file_name as "fileName",-->
- <!-- efi.file_path as "filePath",-->
- <!-- efi.createtime as "createTime"-->
- <!-- FROM-->
- <!-- PPW_EMAIL.EMAIL_FILE_INFO efi-->
- <!-- <if test="fileType != 3">-->
- <!-- JOIN PPW_EMAIL.EMAIL_FUND_NAV efn-->
- <!-- ON efi.id = efn.file_id-->
- <!-- </if>-->
- <!-- <if test="fileType == 3">-->
- <!-- JOIN PPW_EMAIL.AMAC_REPORT_FUND_INFO efn-->
- <!-- ON efi.id = efn.file_id-->
- <!-- left join PPW_EMAIL.PVN_FUND_INFO info-->
- <!-- on efn.register_number=info.register_number and info.isvalid=1-->
- <!-- </if>-->
- <!-- JOIN PPW_EMAIL.EMAIL_PARSE_INFO epi-->
- <!-- ON epi.id = efi.email_id-->
- <!-- WHERE efi.isvalid = 1-->
- <!-- AND efn.isvalid = 1-->
- <!-- AND epi.isvalid = 1-->
- <!-- AND epi.EMAIL_TYPE = #{fileType}-->
- <!-- <if test="fileType != 3">-->
- <!-- and efn.fund_id=#{fundId}-->
- <!-- </if>-->
- <!-- <if test="fileType == 3">-->
- <!-- and info.fund_id=#{fundId}-->
- <!-- </if>-->
- <!-- order by efi.createtime desc-->
- <!-- limit #{offset},#{pageSize}-->
- <!-- </select>-->
- <!-- <resultMap id="BaseDetailMap" type="com.smppw.modaq.domain.entity.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="searchEmailDetailById" resultMap="BaseDetailMap">-->
- <!-- SELECT distinct-->
- <!-- IFNULL(nav.fund_id,asset.fund_id) as fund_id,-->
- <!-- IFNULL(nav.fund_name,asset.fund_name) as fund_name,-->
- <!-- IFNULL(nav.register_number,asset.register_number) as register_number,-->
- <!-- IFNULL(nav.price_date,asset.price_date) as price_date,-->
- <!-- nav.nav,-->
- <!-- nav.cumulative_nav_withdrawal,-->
- <!-- asset.asset_net,-->
- <!-- asset.asset_share,-->
- <!-- nav.is_stored as nav_is_stored,-->
- <!-- nav.exception_status as nav_exception_status,-->
- <!-- asset.is_stored as asset_is_stored,-->
- <!-- asset.exception_status as asset_exception_status,-->
- <!-- case-->
- <!-- when nav.updatetime is null then-->
- <!-- asset.updatetime-->
- <!-- when asset.updatetime is null then-->
- <!-- nav.updatetime-->
- <!-- when nav.updatetime >= asset.updatetime then-->
- <!-- nav.updatetime-->
- <!-- else-->
- <!-- asset.updatetime-->
- <!-- end as updatetime-->
- <!-- FROM-->
- <!-- PPW_EMAIL.EMAIL_FILE_INFO efi-->
- <!-- LEFT JOIN PPW_EMAIL.email_fund_nav nav-->
- <!-- ON efi.id = nav.file_id-->
- <!-- AND nav.isvalid = 1-->
- <!-- LEFT JOIN PPW_EMAIL.email_fund_asset asset-->
- <!-- ON efi.id = asset.file_id-->
- <!-- AND asset.isvalid = 1 AND (nav.fund_id=asset.fund_id OR nav.register_number=asset.register_number OR nav.fund_name= asset.fund_name) AND nav.price_date=asset.price_date-->
- <!-- WHERE efi.isvalid = 1-->
- <!-- AND efi.id =#{fileId}-->
- <!-- order by fund_name desc,price_date desc-->
- <!-- limit #{offset},#{pageSize}-->
- <!-- </select>-->
- <!-- <select id="countFundFileInfo" resultType="java.lang.Long"-->
- <!-- parameterType="com.simuwang.base.pojo.dto.query.FundFilePageQuery">-->
- <!-- select count(1) from (-->
- <!-- SELECT DISTINCT efi.id as "fileId",-->
- <!-- <if test="fileType != 3">-->
- <!-- efn.fund_id as "fundId",-->
- <!-- efn.fund_name as "fundName",-->
- <!-- </if>-->
- <!-- <if test="fileType == 3">-->
- <!-- info.fund_id as "fundId",-->
- <!-- efn.fund_name as "fundName",-->
- <!-- </if>-->
- <!-- efi.file_name as "fileName",-->
- <!-- efi.file_path as "filePath",-->
- <!-- efi.createtime as "createTime"-->
- <!-- FROM-->
- <!-- PPW_EMAIL.EMAIL_FILE_INFO efi-->
- <!-- <if test="fileType != 3">-->
- <!-- JOIN PPW_EMAIL.EMAIL_FUND_NAV efn-->
- <!-- ON efi.id = efn.file_id-->
- <!-- </if>-->
- <!-- <if test="fileType == 3">-->
- <!-- JOIN PPW_EMAIL.AMAC_REPORT_FUND_INFO efn-->
- <!-- ON efi.id = efn.file_id-->
- <!-- left join PPW_EMAIL.PVN_FUND_INFO info-->
- <!-- on efn.register_number=info.register_number and info.isvalid=1-->
- <!-- </if>-->
- <!-- JOIN PPW_EMAIL.EMAIL_PARSE_INFO epi-->
- <!-- ON epi.id = efi.email_id-->
- <!-- WHERE efi.isvalid = 1-->
- <!-- AND efn.isvalid = 1-->
- <!-- AND epi.isvalid = 1-->
- <!-- AND epi.EMAIL_TYPE = #{fileType}-->
- <!-- <if test="fileType != 3">-->
- <!-- and efn.fund_id=#{fundId}-->
- <!-- </if>-->
- <!-- <if test="fileType == 3">-->
- <!-- and info.fund_id=#{fundId}-->
- <!-- </if>) a-->
- <!-- </select>-->
- <!-- <select id="countEmailDetailById" resultType="java.lang.Long"-->
- <!-- parameterType="com.simuwang.base.pojo.dto.query.EmailFileQuery">-->
- <!-- select count(1) from (-->
- <!-- SELECT distinct-->
- <!-- IFNULL(nav.fund_id,asset.fund_id) as fund_id,-->
- <!-- IFNULL(nav.fund_name,asset.fund_name) as fund_name,-->
- <!-- IFNULL(nav.register_number,asset.register_number) as register_number,-->
- <!-- IFNULL(nav.price_date,asset.price_date) as price_date,-->
- <!-- nav.nav,-->
- <!-- nav.cumulative_nav_withdrawal,-->
- <!-- asset.asset_net,-->
- <!-- asset.asset_share-->
- <!-- FROM-->
- <!-- PPW_EMAIL.EMAIL_FILE_INFO efi-->
- <!-- LEFT JOIN PPW_EMAIL.email_fund_nav nav-->
- <!-- ON efi.id = nav.file_id-->
- <!-- AND nav.isvalid = 1-->
- <!-- LEFT JOIN PPW_EMAIL.email_fund_asset asset-->
- <!-- ON efi.id = asset.file_id-->
- <!-- AND asset.isvalid = 1 AND (nav.fund_id=asset.fund_id OR nav.register_number=asset.register_number OR nav.fund_name= asset.fund_name) AND nav.price_date=asset.price_date-->
- <!-- WHERE efi.isvalid = 1-->
- <!-- AND efi.id =#{fileId}) a-->
- <!-- </select>-->
- <!-- <select id="selectValuationFileId" resultType="java.lang.Integer"-->
- <!-- parameterType="java.util.List">-->
- <!-- SELECT-->
- <!-- distinct file.id-->
- <!-- FROM-->
- <!-- PPW_EMAIL.EMAIL_FILE_INFO file-->
- <!-- JOIN PPW_EMAIL.EMAIL_PARSE_INFO info-->
- <!-- ON file.email_id = info.id-->
- <!-- WHERE info.email_type = 2-->
- <!-- AND file.id IN-->
- <!-- <foreach collection="fileIdList" item="fileId" index="index" separator=",">-->
- <!-- #{fileId}-->
- <!-- </foreach>-->
- <!-- </select>-->
- <!-- <select id="getAllPriceDateByFileId" resultType="java.lang.String" parameterType="java.lang.Integer">-->
- <!-- select * from (select distinct price_date from PPW_EMAIL.EMAIL_FUND_NAV WHERE file_id=#{fileId} and isvalid=1-->
- <!-- union-->
- <!-- select distinct price_date from PPW_EMAIL.EMAIL_FUND_ASSET WHERE file_id=#{fileId} and isvalid=1) a order by price_date desc-->
- <!-- </select>-->
- <update id="updateTimeById">
- update mo_email_file_info
- set updatetime = #{parseDate}
- where isvalid = 1
- and id = #{id}
- </update>
- <update id="updateAiParseByFileId">
- update mo_email_file_info
- set updatetime = now(),
- ai_parse = #{aiParse},
- ai_file_id = #{aiFileId}
- where isvalid = 1
- and id = #{fileId}
- </update>
- <update id="batchUpdateByFileId">
- <foreach collection="entityList" item="entity">
- update mo_email_file_info
- set ai_parse = #{entity.aiParse},
- parse_status = #{entity.parseStatus},
- fail_reason = #{entity.failReason},
- updatetime = now()
- where id = #{entity.id};
- </foreach>
- </update>
- <select id="getLetterFilenameSuccessCount" resultType="int">
- select count(1)
- from mo_email_file_info a
- join mo_email_parse_info e on e.id = a.email_id and e.email_title = #{emailTitle}
- join mo_report_base_info b on b.file_id = a.id and b.report_type = 'LETTER'
- join mo_report_fund_transaction c on a.id = c.file_id and c.fund_name is not null
- join mo_report_investor_info d on a.id = d.file_id and d.investor_name is not null
- where a.file_name = #{filename} and a.isvalid = 1
- </select>
- <select id="getAmacFilenameSuccessCount" resultType="int">
- select count(1)
- from mo_email_file_info a
- join mo_email_parse_info e on e.id = a.email_id and e.email_title = #{emailTitle} and e.attr_size = #{fileSize}
- join mo_report_base_info b on b.file_id = a.id and b.report_type in ('MONTHLY', 'QUARTERLY', 'ANNUALLY')
- join mo_report_fund_info c on a.id = c.file_id and (c.fund_name is not null or c.fund_code is not null)
- where a.file_name = #{filename} and a.isvalid = 1
- </select>
- <select id="getWeeklyFilenameSuccessCount" resultType="int">
- select count(1)
- from mo_email_file_info a
- join mo_email_parse_info e on e.id = a.email_id and e.email_title = #{emailTitle} and e.attr_size = #{fileSize}
- join mo_report_base_info b on b.file_id = a.id and b.report_type = 'WEEKLY'
- join mo_report_fund_info c on a.id = c.file_id and (c.fund_name is not null or c.fund_code is not null)
- where a.file_name = #{filename} and a.isvalid = 1
- </select>
- <select id="getOtherFilenameSuccessCount" resultType="int">
- select count(1)
- from mo_email_file_info a
- join mo_email_parse_info e on e.id = a.email_id and e.email_title = #{emailTitle} and e.attr_size = #{fileSize}
- join mo_report_base_info b on b.file_id = a.id and b.report_type = 'OTHER'
- where a.file_name = #{filename} and a.isvalid = 1
- </select>
- </mapper>
|