insert into PPW_EMAIL.distribution(fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid)
values (#{fundId},#{distributeDate},#{distributeType},#{distribution},#{isvalid},#{creatorId},#{createTime},#{updateTime},#{updaterId})
update PPW_EMAIL.distribution set distribute_date=#{distributeDate},distribute_type=#{distributeType},distribution=#{distribution},updatetime=#{updateTime}
where id=#{id} and isvalid =1
update PPW_EMAIL.distribution set isvalid =0,updatetime=sysdate() where isvalid =1 and id in
#{id}
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
PPW_EMAIL.distribution d
JOIN PPW_EMAIL.pvn_fund_info info
ON d.fund_id = info.fund_id
JOIN PPW_EMAIL.pvn_company_info c
ON info.trust_id = c.company_id
JOIN PPW_EMAIL.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 c.isvalid = 1
AND n.isvalid = 1
and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%'))
and d.distribute_type = #{distributeType}
and d.distribute_date >= #{startDate}
and d.distribute_date #{endDate}
limit #{offset},#{pageSize}
select count(distinct d.id)
from PPW_EMAIL.distribution d
join PPW_EMAIL.pvn_fund_info info on d.fund_id = info.fund_id
join PPW_EMAIL.pvn_company_info c on info.trust_id = c.company_id
join PPW_EMAIL.nav n on n.fund_id = d.fund_id
where d.isvalid=1 and info.isvalid =1 and c.isvalid =1 and n.isvalid=1
and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%'))
and d.distribute_type = #{distributeType}
and d.distribute_date >= #{startDate}
and d.distribute_date #{endDate}
select id,fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid
from PPW_EMAIL.distribution where isvalid =1 and id=#{id}
select id,fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid
from PPW_EMAIL.distribution where isvalid =1 and fund_id=#{fundId} and distribute_date=#{distributeDate}
select id,fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid
from PPW_EMAIL.distribution where isvalid =1 and fund_id=#{fundId} and distribute_type=#{distributeType}