|
@@ -22,6 +22,7 @@
|
|
<result column="level" property="level"/>
|
|
<result column="level" property="level"/>
|
|
<result column="root_package_send_package_dept_id" property="rootPackageSendPackageDeptId"/>
|
|
<result column="root_package_send_package_dept_id" property="rootPackageSendPackageDeptId"/>
|
|
<result column="settle_status" property="settleStatus"/>
|
|
<result column="settle_status" property="settleStatus"/>
|
|
|
|
+ <result column="db_source_id" property="dbSourceId"/>
|
|
<association property="sendPackageDept" javaType="com.retdata.yaoyibi.domain.CsoSysDeptSummary">
|
|
<association property="sendPackageDept" javaType="com.retdata.yaoyibi.domain.CsoSysDeptSummary">
|
|
<id column="send_package_dept_dept_id" property="deptId"/>
|
|
<id column="send_package_dept_dept_id" property="deptId"/>
|
|
<result column="send_package_dept_name" property="name"/>
|
|
<result column="send_package_dept_name" property="name"/>
|
|
@@ -49,6 +50,7 @@
|
|
<result column="p2p_amount" property="p2pAmount"/>
|
|
<result column="p2p_amount" property="p2pAmount"/>
|
|
<result column="p2p_service_amount" property="p2pServiceAmount"/>
|
|
<result column="p2p_service_amount" property="p2pServiceAmount"/>
|
|
<result column="settle_status" property="settleStatus"/>
|
|
<result column="settle_status" property="settleStatus"/>
|
|
|
|
+ <result column="db_source_id" property="dbSourceId"/>
|
|
<association property="sendPackageDept" javaType="com.retdata.yaoyibi.domain.CsoSysDeptSummary">
|
|
<association property="sendPackageDept" javaType="com.retdata.yaoyibi.domain.CsoSysDeptSummary">
|
|
<id column="send_package_dept_dept_id" property="deptId"/>
|
|
<id column="send_package_dept_dept_id" property="deptId"/>
|
|
<result column="send_package_dept_name" property="name"/>
|
|
<result column="send_package_dept_name" property="name"/>
|
|
@@ -150,7 +152,8 @@
|
|
s1.settle_amount,s1.actual_amount as settle_actual_amount,s1.notify_time as settle_notify_time,s1.settle_count,
|
|
s1.settle_amount,s1.actual_amount as settle_actual_amount,s1.notify_time as settle_notify_time,s1.settle_count,
|
|
t2.relation_score_id as grand_parent_id,
|
|
t2.relation_score_id as grand_parent_id,
|
|
case when t1.relation_score_id is null or t1.relation_score_id='' then 0 when t2.relation_score_id is null or t2.relation_score_id='' then 1 else 2 end as level,
|
|
case when t1.relation_score_id is null or t1.relation_score_id='' then 0 when t2.relation_score_id is null or t2.relation_score_id='' then 1 else 2 end as level,
|
|
- COALESCE(t3.send_package_dept_id,t2.send_package_dept_id,t1.send_package_dept_id) as root_package_send_package_dept_id
|
|
|
|
|
|
+ COALESCE(t3.send_package_dept_id,t2.send_package_dept_id,t1.send_package_dept_id) as root_package_send_package_dept_id,
|
|
|
|
+ t1.db_source_id
|
|
from wm_score_package t1
|
|
from wm_score_package t1
|
|
left join sys_dept d1 on d1.dept_id=t1.send_package_dept_id
|
|
left join sys_dept d1 on d1.dept_id=t1.send_package_dept_id
|
|
left join sys_dept d2 on d2.dept_id=t1.dept_id
|
|
left join sys_dept d2 on d2.dept_id=t1.dept_id
|
|
@@ -185,8 +188,8 @@
|
|
</if>
|
|
</if>
|
|
<where><include refid="searchParamsSql"></include></where>
|
|
<where><include refid="searchParamsSql"></include></where>
|
|
</select>
|
|
</select>
|
|
- <select id="selectAllMatchedPackageIds" resultType="integer">
|
|
|
|
- select t1.id
|
|
|
|
|
|
+ <select id="selectAllMatchedPackageIds" resultType="com.retdata.yaoyibi.domain.PackageIdDto">
|
|
|
|
+ select t1.id,t1.db_source_id
|
|
from wm_score_package t1
|
|
from wm_score_package t1
|
|
<if test="searchParams.packageLevel==1 or searchParams.packageLevel==2">
|
|
<if test="searchParams.packageLevel==1 or searchParams.packageLevel==2">
|
|
left join sys_dept d2 on d2.dept_id=t1.dept_id
|
|
left join sys_dept d2 on d2.dept_id=t1.dept_id
|
|
@@ -231,7 +234,7 @@
|
|
t1.id,t1.score_package_name,t1.score,t1.score_package_status,t1.create_time,t1.package_finish_time,t1.package_finish_status,t1.typeid,t1.relation_score_id,t1.p2p_amount,t1.p2p_service_amount,t1.drugtable,t1.settle_status,
|
|
t1.id,t1.score_package_name,t1.score,t1.score_package_status,t1.create_time,t1.package_finish_time,t1.package_finish_status,t1.typeid,t1.relation_score_id,t1.p2p_amount,t1.p2p_service_amount,t1.drugtable,t1.settle_status,
|
|
d1.dept_id as send_package_dept_dept_id,d1.name as send_package_dept_name,d1.level as send_package_dept_level,
|
|
d1.dept_id as send_package_dept_dept_id,d1.name as send_package_dept_name,d1.level as send_package_dept_level,
|
|
d2.dept_id as dept_dept_id,d2.name as dept_name,d2.level as dept_level,
|
|
d2.dept_id as dept_dept_id,d2.name as dept_name,d2.level as dept_level,
|
|
- s1.settle_amount,s1.actual_amount as settle_actual_amount,s1.notify_time as settle_notify_time,s1.settle_count
|
|
|
|
|
|
+ s1.settle_amount,s1.actual_amount as settle_actual_amount,s1.notify_time as settle_notify_time,s1.settle_count,t1.db_source_id
|
|
from wm_score_package t1
|
|
from wm_score_package t1
|
|
left join sys_dept d1 on d1.dept_id=t1.send_package_dept_id
|
|
left join sys_dept d1 on d1.dept_id=t1.send_package_dept_id
|
|
and t1.db_source_id=d1.db_source_id
|
|
and t1.db_source_id=d1.db_source_id
|
|
@@ -248,7 +251,7 @@
|
|
,db_source_id
|
|
,db_source_id
|
|
from wm_score_package_settle_note
|
|
from wm_score_package_settle_note
|
|
group by package_id, db_source_id
|
|
group by package_id, db_source_id
|
|
- ) s1 on s1.package_id=t1.id and t1.db_source_id=s1.db_source_id
|
|
|
|
|
|
+ ) s1 on s1.package_id=t1.id and t1.db_source_id=s1.db_source_id
|
|
<if test="searchParams.receiverName!=null and searchParams.receiverName.length>0">
|
|
<if test="searchParams.receiverName!=null and searchParams.receiverName.length>0">
|
|
inner join (
|
|
inner join (
|
|
select distinct t1.package_id, t1.db_source_id
|
|
select distinct t1.package_id, t1.db_source_id
|
|
@@ -271,13 +274,14 @@
|
|
order by t1.create_time desc
|
|
order by t1.create_time desc
|
|
</select>
|
|
</select>
|
|
<select id="selectWmScorePackageStatusByPackageIds" resultType="com.retdata.yaoyibi.domain.WmScorePackageStatusSummary">
|
|
<select id="selectWmScorePackageStatusByPackageIds" resultType="com.retdata.yaoyibi.domain.WmScorePackageStatusSummary">
|
|
- select t1.id,t1.package_id,t1.user_id as "user.user_id",t2.realname as "user.realname"
|
|
|
|
|
|
+ select t1.id,t1.package_id,t1.user_id as "user.user_id",t2.realname as "user.realname",t1.db_source_id
|
|
from wm_score_package_status t1
|
|
from wm_score_package_status t1
|
|
|
|
+ inner join <foreach collection="packageIds" item="item" separator="union all" open="(" close=")">select #{item.id} id</foreach> t3
|
|
|
|
+ on t1.package_id=t3.id
|
|
left join sys_user t2 on t2.user_id=t1.user_id
|
|
left join sys_user t2 on t2.user_id=t1.user_id
|
|
and t1.db_source_id=t2.db_source_id
|
|
and t1.db_source_id=t2.db_source_id
|
|
<where>
|
|
<where>
|
|
- t1.status=2 and t1.package_id in
|
|
|
|
- <foreach collection="packageIds" item="item" separator="," open="(" close=")">#{item}</foreach>
|
|
|
|
|
|
+ t1.status=2 and t1.db_source_id=#{dbSourceId}
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
<select id="selectSubPackagesByPackageIds" resultMap="searchDtoMap">
|
|
<select id="selectSubPackagesByPackageIds" resultMap="searchDtoMap">
|
|
@@ -298,9 +302,12 @@
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
<select id="selectWmScorePackageChildrenCount" resultType="com.retdata.yaoyibi.domain.WmScorePackageChildrenCount">
|
|
<select id="selectWmScorePackageChildrenCount" resultType="com.retdata.yaoyibi.domain.WmScorePackageChildrenCount">
|
|
- select relation_score_id as packageId,count(1) as childrenCount
|
|
|
|
- from wm_score_package
|
|
|
|
- where relation_score_id in <foreach collection="packageIds" item="item" separator="," open="(" close=")">#{item}</foreach>
|
|
|
|
|
|
+ select a.relation_score_id as packageId,count(1) as childrenCount,a.db_source_id
|
|
|
|
+ from wm_score_package a
|
|
|
|
+ inner join <foreach collection="packageIds" item="item" separator="union all" open="(" close=")">select #{item.id}
|
|
|
|
+ id</foreach> b
|
|
|
|
+ on a.relation_score_id=b.id
|
|
|
|
+ where a.db_source_id=#{dbSourceId}
|
|
group by relation_score_id
|
|
group by relation_score_id
|
|
</select>
|
|
</select>
|
|
<select id="selectExportDtoByPackageIds" resultMap="exportDtoMap">
|
|
<select id="selectExportDtoByPackageIds" resultMap="exportDtoMap">
|
|
@@ -308,8 +315,10 @@
|
|
t1.id,t1.score_package_name,t1.score,t1.score_package_status,t1.create_time,t1.package_finish_time,t1.package_finish_status,t1.typeid,t1.relation_score_id,t1.p2p_amount,t1.p2p_service_amount,t1.drugtable,
|
|
t1.id,t1.score_package_name,t1.score,t1.score_package_status,t1.create_time,t1.package_finish_time,t1.package_finish_status,t1.typeid,t1.relation_score_id,t1.p2p_amount,t1.p2p_service_amount,t1.drugtable,
|
|
d1.dept_id as send_package_dept_dept_id,d1.name as send_package_dept_name,d1.level as send_package_dept_level,
|
|
d1.dept_id as send_package_dept_dept_id,d1.name as send_package_dept_name,d1.level as send_package_dept_level,
|
|
d2.dept_id as dept_dept_id,d2.name as dept_name,d2.level as dept_level,
|
|
d2.dept_id as dept_dept_id,d2.name as dept_name,d2.level as dept_level,
|
|
- s1.settle_amount,s1.actual_amount as settle_actual_amount,s1.notify_time as settle_notify_time,s1.settle_count
|
|
|
|
|
|
+ s1.settle_amount,s1.actual_amount as settle_actual_amount,s1.notify_time as settle_notify_time,s1.settle_count,t1.db_source_id
|
|
from wm_score_package t1
|
|
from wm_score_package t1
|
|
|
|
+ inner join <foreach collection="packageIds" item="item" separator="union all" open="(" close=")">select #{item.id} id</foreach> t2
|
|
|
|
+ on t1.id=t2.id
|
|
left join sys_dept d1 on d1.dept_id=t1.send_package_dept_id
|
|
left join sys_dept d1 on d1.dept_id=t1.send_package_dept_id
|
|
left join sys_dept d2 on d2.dept_id=t1.dept_id
|
|
left join sys_dept d2 on d2.dept_id=t1.dept_id
|
|
left join (
|
|
left join (
|
|
@@ -320,15 +329,17 @@
|
|
) s1 on s1.package_id=t1.id
|
|
) s1 on s1.package_id=t1.id
|
|
and s1.db_source_id=t1.db_source_id
|
|
and s1.db_source_id=t1.db_source_id
|
|
<where>
|
|
<where>
|
|
- t1.id in
|
|
|
|
- <foreach collection="packageIds" item="item" separator="," open="(" close=")">#{item}</foreach>
|
|
|
|
|
|
+ t1.db_source_id=#{dbSourceId}
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
<select id="selectSubPackageSettleTreeNodesByPackageIds" resultMap="settleTreeNodeMap">
|
|
<select id="selectSubPackageSettleTreeNodesByPackageIds" resultMap="settleTreeNodeMap">
|
|
select
|
|
select
|
|
t1.id,t1.typeid,t1.relation_score_id,t1.p2p_amount,t1.p2p_service_amount,t1.score,t1.score_package_status,t1.settle_status,t1.package_finish_time,
|
|
t1.id,t1.typeid,t1.relation_score_id,t1.p2p_amount,t1.p2p_service_amount,t1.score,t1.score_package_status,t1.settle_status,t1.package_finish_time,
|
|
- s1.settle_amount,s1.actual_amount as settle_actual_amount,s1.notify_time as settle_notify_time
|
|
|
|
|
|
+ s1.settle_amount,s1.actual_amount as settle_actual_amount,s1.notify_time as settle_notify_time,t1.db_source_id
|
|
from wm_score_package t1
|
|
from wm_score_package t1
|
|
|
|
+ inner join <foreach collection="packageIds" item="item" separator="union all" open="(" close=")">select #{item.id}
|
|
|
|
+ id</foreach> t2
|
|
|
|
+ on t2.id=t1.relation_score_id
|
|
left join (
|
|
left join (
|
|
select package_id,sum(settle_amount) as settle_amount,sum(actual_amount) as actual_amount,max(notify_time) as notify_time
|
|
select package_id,sum(settle_amount) as settle_amount,sum(actual_amount) as actual_amount,max(notify_time) as notify_time
|
|
,db_source_id
|
|
,db_source_id
|
|
@@ -336,19 +347,16 @@
|
|
group by package_id, db_source_id
|
|
group by package_id, db_source_id
|
|
) s1 on s1.package_id=t1.id
|
|
) s1 on s1.package_id=t1.id
|
|
and t1.db_source_id=s1.db_source_id
|
|
and t1.db_source_id=s1.db_source_id
|
|
- <where>
|
|
|
|
- t1.relation_score_id in
|
|
|
|
- <foreach collection="packageIds" item="item" separator="," open="(" close=")">#{item}</foreach>
|
|
|
|
- </where>
|
|
|
|
|
|
+ where t1.db_source_id=#{dbSourceId}
|
|
</select>
|
|
</select>
|
|
<select id="selectPackageSettleTreeNodesByPackageIdsForScore" resultMap="settleTreeNodeMap">
|
|
<select id="selectPackageSettleTreeNodesByPackageIdsForScore" resultMap="settleTreeNodeMap">
|
|
select
|
|
select
|
|
- t1.id,t1.typeid,t1.relation_score_id,t1.score,t1.score_package_status,t1.send_package_dept_id,t1.package_finish_time,t1.dept_id
|
|
|
|
|
|
+ t1.id,t1.typeid,t1.relation_score_id,t1.score,t1.score_package_status,t1.send_package_dept_id,t1.package_finish_time,t1.dept_id,t1.db_source_id
|
|
from wm_score_package t1
|
|
from wm_score_package t1
|
|
- <where>
|
|
|
|
- t1.id in
|
|
|
|
- <foreach collection="packageIds" item="item" separator="," open="(" close=")">#{item}</foreach>
|
|
|
|
- </where>
|
|
|
|
|
|
+ inner join
|
|
|
|
+ <foreach collection="packageIds" item="item" separator="union all" open="(" close=")">select #{item.id} id</foreach>
|
|
|
|
+ t2 on t2.id=t1.id
|
|
|
|
+ where t1.db_source_id=#{dbSourceId}
|
|
</select>
|
|
</select>
|
|
<select id="selectScoreStatByParams" resultType="com.retdata.yaoyibi.domain.ScoreStat">
|
|
<select id="selectScoreStatByParams" resultType="com.retdata.yaoyibi.domain.ScoreStat">
|
|
select
|
|
select
|
|
@@ -363,6 +371,44 @@
|
|
sum(case when dsp.sign_product='CSO1' then 1 else 0 end) as cso1Count,
|
|
sum(case when dsp.sign_product='CSO1' then 1 else 0 end) as cso1Count,
|
|
sum(case when dsp.sign_product='CSO2' then 1 else 0 end) as cso2Count
|
|
sum(case when dsp.sign_product='CSO2' then 1 else 0 end) as cso2Count
|
|
from wm_score_package rp
|
|
from wm_score_package rp
|
|
|
|
+ inner join (
|
|
|
|
+ select distinct COALESCE(case when t2.relation_score_id='' then null else t2.relation_score_id end,t2.id,t1.id) as
|
|
|
|
+ root_package_id,t1.db_source_id
|
|
|
|
+ from wm_score_package t1
|
|
|
|
+ left join wm_score_package t2 on t1.relation_score_id=t2.id
|
|
|
|
+ and t1.db_source_id=t2.db_source_id
|
|
|
|
+ <if test="(searchParams.rootPackageSendPackageDeptId!=null and searchParams.rootPackageSendPackageDeptId.length>0) or searchParams.rootPackageCreateTimeGe!=null or searchParams.rootPackageCreateTimeLe!=null">
|
|
|
|
+ left join wm_score_package t3 on t2.relation_score_id=t3.id
|
|
|
|
+ and t2.db_source_id=t3.db_source_id
|
|
|
|
+ </if>
|
|
|
|
+ <if test="searchParams.settleNotifyTimeGe!=null or searchParams.settleNotifyTimeLe!=null">
|
|
|
|
+ left join (
|
|
|
|
+ select package_id,max(notify_time) as notify_time,db_source_id
|
|
|
|
+ from wm_score_package_settle_note
|
|
|
|
+ group by package_id, db_source_id
|
|
|
|
+ ) s1 on s1.package_id=t1.id
|
|
|
|
+ and s1.db_source_id=t1.db_source_id
|
|
|
|
+ </if>
|
|
|
|
+ <if test="searchParams.receiverName!=null and searchParams.receiverName.length>0">
|
|
|
|
+ inner join (
|
|
|
|
+ select distinct t1.package_id,t1.db_source_id
|
|
|
|
+ from wm_score_package_status t1
|
|
|
|
+ inner join sys_user t2 on t1.user_id=t2.user_id
|
|
|
|
+ and t1.db_source_id=t2.db_source_id
|
|
|
|
+ where t1.status=2 and t2.realname in
|
|
|
|
+ <foreach collection="searchParams.receiverName" item="item" separator="," open="(" close=")">#{item}</foreach>
|
|
|
|
+ union
|
|
|
|
+ select distinct t4.id as package_id,t4.db_source_id
|
|
|
|
+ from sys_dept t3
|
|
|
|
+ inner join wm_score_package t4 on t3.dept_id=t4.dept_id and t4.typeid in ('0','1','2')
|
|
|
|
+ and t3.db_source_id = t4.db_source_id
|
|
|
|
+ where t3.name in
|
|
|
|
+ <foreach collection="searchParams.receiverName" item="item" separator="," open="(" close=")">#{item}</foreach>
|
|
|
|
+ ) rnt on rnt.package_id=t1.id
|
|
|
|
+ and rnt.db_source_id=t1.db_source_id
|
|
|
|
+ </if>
|
|
|
|
+ <where><include refid="searchParamsSql"></include></where>) rp1
|
|
|
|
+ on rp.id=rp1.root_package_id and rp.db_source_id=rp1.db_source_id
|
|
left join (
|
|
left join (
|
|
select t2.dept_id,t1.sign_product
|
|
select t2.dept_id,t1.sign_product
|
|
from contracted_product_change t1
|
|
from contracted_product_change t1
|
|
@@ -370,42 +416,6 @@
|
|
and t1.db_source_id=t2.db_source_id
|
|
and t1.db_source_id=t2.db_source_id
|
|
where t1.sign_product in ('CSO1','CSO2') and not exists(select 1 from contracted_product_change t3 where t3.object_name=t1.object_name and t3.change_time>t1.change_time)
|
|
where t1.sign_product in ('CSO1','CSO2') and not exists(select 1 from contracted_product_change t3 where t3.object_name=t1.object_name and t3.change_time>t1.change_time)
|
|
) dsp on dsp.dept_id=rp.dept_id
|
|
) dsp on dsp.dept_id=rp.dept_id
|
|
- where id in
|
|
|
|
- (select distinct COALESCE(case when t2.relation_score_id='' then null else t2.relation_score_id end,t2.id,t1.id) as root_package_id
|
|
|
|
- from wm_score_package t1
|
|
|
|
- left join wm_score_package t2 on t1.relation_score_id=t2.id
|
|
|
|
- and t1.db_source_id=t2.db_source_id
|
|
|
|
- <if test="(searchParams.rootPackageSendPackageDeptId!=null and searchParams.rootPackageSendPackageDeptId.length>0) or searchParams.rootPackageCreateTimeGe!=null or searchParams.rootPackageCreateTimeLe!=null">
|
|
|
|
- left join wm_score_package t3 on t2.relation_score_id=t3.id
|
|
|
|
- and t2.db_source_id=t3.db_source_id
|
|
|
|
- </if>
|
|
|
|
- <if test="searchParams.settleNotifyTimeGe!=null or searchParams.settleNotifyTimeLe!=null">
|
|
|
|
- left join (
|
|
|
|
- select package_id,max(notify_time) as notify_time,db_source_id
|
|
|
|
- from wm_score_package_settle_note
|
|
|
|
- group by package_id, db_source_id
|
|
|
|
- ) s1 on s1.package_id=t1.id
|
|
|
|
- and s1.db_source_id=t1.db_source_id
|
|
|
|
- </if>
|
|
|
|
- <if test="searchParams.receiverName!=null and searchParams.receiverName.length>0">
|
|
|
|
- inner join (
|
|
|
|
- select distinct t1.package_id,t1.db_source_id
|
|
|
|
- from wm_score_package_status t1
|
|
|
|
- inner join sys_user t2 on t1.user_id=t2.user_id
|
|
|
|
- and t1.db_source_id=t2.db_source_id
|
|
|
|
- where t1.status=2 and t2.realname in
|
|
|
|
- <foreach collection="searchParams.receiverName" item="item" separator="," open="(" close=")">#{item}</foreach>
|
|
|
|
- union
|
|
|
|
- select distinct t4.id as package_id,t4.db_source_id
|
|
|
|
- from sys_dept t3
|
|
|
|
- inner join wm_score_package t4 on t3.dept_id=t4.dept_id and t4.typeid in ('0','1','2')
|
|
|
|
- and t3.db_source_id = t4.db_source_id
|
|
|
|
- where t3.name in
|
|
|
|
- <foreach collection="searchParams.receiverName" item="item" separator="," open="(" close=")">#{item}</foreach>
|
|
|
|
- ) rnt on rnt.package_id=t1.id
|
|
|
|
- and rnt.db_source_id=t1.db_source_id
|
|
|
|
- </if>
|
|
|
|
- <where><include refid="searchParamsSql"></include></where>)
|
|
|
|
</select>
|
|
</select>
|
|
<select id="selectScoreTimeStatByParams" resultType="com.retdata.yaoyibi.domain.ScoreTimeStat">
|
|
<select id="selectScoreTimeStatByParams" resultType="com.retdata.yaoyibi.domain.ScoreTimeStat">
|
|
select
|
|
select
|
|
@@ -501,16 +511,17 @@
|
|
order by timeKey
|
|
order by timeKey
|
|
</select>
|
|
</select>
|
|
<select id="selectApprovedEntTaskScoreStat" resultType="com.retdata.yaoyibi.domain.ScorePackageEntTaskScoreStat">
|
|
<select id="selectApprovedEntTaskScoreStat" resultType="com.retdata.yaoyibi.domain.ScorePackageEntTaskScoreStat">
|
|
- select t1.score_package_id as packageId,sum(t1.score) as totalScore
|
|
|
|
- from wm_task t1
|
|
|
|
|
|
+ select t1.score_package_id as packageId,sum(t1.score) as totalScore, t1.db_source_id
|
|
|
|
+ from wm_task t1
|
|
|
|
+ inner join <foreach collection="packageIds" item="item" separator="union all" open="(" close=")">select #{item.id} id</foreach> t2
|
|
|
|
+ on t1.score_package_id=t2.id
|
|
where t1.task_status=3 and t1.task_type_id in (SELECT id FROM wm_task_type WHERE task_type_level=1 AND task_receiver_type=2)
|
|
where t1.task_status=3 and t1.task_type_id in (SELECT id FROM wm_task_type WHERE task_type_level=1 AND task_receiver_type=2)
|
|
- and t1.score_package_id in
|
|
|
|
- <foreach collection="packageIds" item="item" separator="," open="(" close=")">#{item}</foreach>
|
|
|
|
- group by t1.score_package_id
|
|
|
|
|
|
+ and t1.db_source_id = #{dbSourceId}
|
|
|
|
+ group by t1.score_package_id, t1.db_source_id
|
|
</select>
|
|
</select>
|
|
- <select id="selectRootPackageIds" resultType="integer">
|
|
|
|
- select distinct COALESCE(case when t2.relation_score_id='' then null else t2.relation_score_id end,t2.id,t1.id)
|
|
|
|
- , t2.db_source_id
|
|
|
|
|
|
+ <select id="selectRootPackageIds" resultType="com.retdata.yaoyibi.domain.PackageIdDto">
|
|
|
|
+ select distinct COALESCE(case when t2.relation_score_id='' then null else t2.relation_score_id end,t2.id,t1.id) id
|
|
|
|
+ , t1.db_source_id
|
|
from wm_score_package t1
|
|
from wm_score_package t1
|
|
left join wm_score_package t2 on t1.relation_score_id=t2.id
|
|
left join wm_score_package t2 on t1.relation_score_id=t2.id
|
|
and t1.db_source_id=t2.db_source_id
|
|
and t1.db_source_id=t2.db_source_id
|
|
@@ -553,7 +564,7 @@
|
|
s1.settle_amount,s1.actual_amount as settle_actual_amount,s1.notify_time as settle_notify_time,
|
|
s1.settle_amount,s1.actual_amount as settle_actual_amount,s1.notify_time as settle_notify_time,
|
|
t2.relation_score_id as grand_parent_id,
|
|
t2.relation_score_id as grand_parent_id,
|
|
case when t1.relation_score_id is null or t1.relation_score_id='' then 0 when t2.relation_score_id is null or t2.relation_score_id='' then 1 else 2 end as level,
|
|
case when t1.relation_score_id is null or t1.relation_score_id='' then 0 when t2.relation_score_id is null or t2.relation_score_id='' then 1 else 2 end as level,
|
|
- COALESCE(t3.send_package_dept_id,t2.send_package_dept_id,t1.send_package_dept_id) as root_package_send_package_dept_id
|
|
|
|
|
|
+ COALESCE(t3.send_package_dept_id,t2.send_package_dept_id,t1.send_package_dept_id) as root_package_send_package_dept_id,t1.db_source_id
|
|
from wm_score_package t1
|
|
from wm_score_package t1
|
|
left join sys_dept d2 on d2.dept_id=t1.dept_id
|
|
left join sys_dept d2 on d2.dept_id=t1.dept_id
|
|
left join wm_score_package t2 on t1.relation_score_id=t2.id
|
|
left join wm_score_package t2 on t1.relation_score_id=t2.id
|
|
@@ -590,14 +601,16 @@
|
|
<select id="selectUserIdsByPackageIds" resultType="integer">
|
|
<select id="selectUserIdsByPackageIds" resultType="integer">
|
|
select distinct t1.user_id
|
|
select distinct t1.user_id
|
|
from wm_score_package_status t1
|
|
from wm_score_package_status t1
|
|
- where t1.status=2 and t1.package_id in
|
|
|
|
- <foreach collection="packageIds" item="item" separator="," open="(" close=")">#{item}</foreach>
|
|
|
|
|
|
+ inner join <foreach collection="packageIds" item="item" separator="union all" open="(" close=")">select #{item.id} id</foreach> t2
|
|
|
|
+ on t1.package_id=t2.id
|
|
|
|
+ where t1.status=2 and t1.db_source_id=#{dbSourceId}
|
|
</select>
|
|
</select>
|
|
<select id="selectPackageStatusByPackageIds" resultType="com.retdata.yaoyibi.domain.WmScorePackageStatus">
|
|
<select id="selectPackageStatusByPackageIds" resultType="com.retdata.yaoyibi.domain.WmScorePackageStatus">
|
|
- select t1.id,t1.user_id,t1.package_id
|
|
|
|
|
|
+ select t1.id,t1.user_id,t1.package_id,t1.db_source_id
|
|
from wm_score_package_status t1
|
|
from wm_score_package_status t1
|
|
- where t1.status=2 and t1.package_id in
|
|
|
|
- <foreach collection="packageIds" item="item" separator="," open="(" close=")">#{item}</foreach>
|
|
|
|
|
|
+ inner join <foreach collection="packageIds" item="item" separator="union all" open="(" close=")">select #{item.id} id</foreach> t2
|
|
|
|
+ on t1.package_id=t2.id
|
|
|
|
+ where t1.status=2 and t1.db_source_id=#{dbSourceId}
|
|
</select>
|
|
</select>
|
|
<select id="selectReceiverNames" resultType="string">
|
|
<select id="selectReceiverNames" resultType="string">
|
|
select t5.name
|
|
select t5.name
|