|
|
@@ -6,42 +6,36 @@
|
|
|
|
|
|
<select id="getBusinessAgentData" resultType="com.ydtech.modules.admin.model.vo.BusinessAgentData">
|
|
|
select
|
|
|
- io.userid as "userId",
|
|
|
+ su.id as "userId",
|
|
|
su.name as "userName",
|
|
|
sd.id as "deptId",
|
|
|
+ IFNULL(a.sumpremium,0) as "sumpremium",
|
|
|
+ IFNULL(a.jqpremium,0) as "jqpremium",
|
|
|
+ IFNULL(a.sypremium,0) as "sypremium",
|
|
|
+ IFNULL(a.taxamount,0) as "taxamount",
|
|
|
+ IFNULL(a.jypremium,0) as "jypremium",
|
|
|
+ sd.management_source as "managementSource"
|
|
|
+ from sys_user su
|
|
|
+ left join sys_dept sd on sd.id =su.dept_id
|
|
|
+ left join (
|
|
|
+ select
|
|
|
+ io.userid as "userId",
|
|
|
sum(IFNULL(jqpremium, 0) + IFNULL(sypremium, 0)+ IFNULL(jypremium, 0)) as "sumpremium",
|
|
|
IFNULL(sum(jqpremium),0) as "jqpremium",
|
|
|
IFNULL(sum(sypremium),0) as "sypremium",
|
|
|
IFNULL(sum(taxamount),0) as "taxamount",
|
|
|
- IFNULL(sum(jypremium),0) as "jypremium",
|
|
|
- sd.management_source as "managementSource"
|
|
|
+ IFNULL(sum(jypremium),0) as "jypremium"
|
|
|
from ins_area_company iac
|
|
|
left join ins_orders io on io.orderno =iac.orderno
|
|
|
- left join sys_user su on io.userid =su.id
|
|
|
- left join sys_dept sd on sd.id =su.dept_id
|
|
|
<where>
|
|
|
iac.orderstatus = '3'
|
|
|
<if test="vo.createtimeStart != null and vo.createtimeStart!='' and vo.createtimeEnd != null and vo.createtimeEnd!=''">
|
|
|
- AND DATE_FORMAT( iac.signing_time, '%Y-%m-%d') BETWEEN DATE_FORMAT( #{vo.createtimeStart}, '%Y-%m-%d') AND
|
|
|
- DATE_FORMAT( #{vo.createtimeEnd}, '%Y-%m-%d')
|
|
|
+ AND DATE_FORMAT( iac.signing_time, '%Y-%m-%d') BETWEEN DATE_FORMAT( #{vo.createtimeStart}, '%Y-%m-%d')
|
|
|
+ AND DATE_FORMAT( #{vo.createtimeEnd}, '%Y-%m-%d')
|
|
|
</if>
|
|
|
|
|
|
- <if test="vo.userId !=null and vo.userId!=''">
|
|
|
- and su.id=#{vo.userId}
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="vo.managementSource !=null and vo.managementSource!=''">
|
|
|
- and sd.management_source=#{vo.managementSource}
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="vo.userIds !=null and vo.userIds!='' and vo.userIds.size()>0">
|
|
|
- and su.id in
|
|
|
- <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
<if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
|
|
|
- AND io.deptid in
|
|
|
+ AND io.deptid in
|
|
|
<foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
@@ -50,74 +44,55 @@
|
|
|
<if test="vo.deptId !=null and vo.deptId!=''">
|
|
|
and io.deptid like concat('%',#{vo.deptId},'%')
|
|
|
</if>
|
|
|
-
|
|
|
+ </where>
|
|
|
+ group by io.userid
|
|
|
+ ) a on a.userId =su.id
|
|
|
+ <where>
|
|
|
+ 1=1
|
|
|
+ <if test="vo.userId !=null and vo.userId!=''">
|
|
|
+ and su.id=#{vo.userId}
|
|
|
+ </if>
|
|
|
+ <if test="vo.userIds !=null and vo.userIds!='' and vo.userIds.size()>0">
|
|
|
+ and su.id in
|
|
|
+ <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
<if test="vo.userName !=null and vo.userName!=''">
|
|
|
and su.name=#{vo.userName}
|
|
|
</if>
|
|
|
+
|
|
|
+ <if test="vo.managementSource !=null and vo.managementSource!=''">
|
|
|
+ and sd.management_source=#{vo.managementSource}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
- group by io.userid,su.name,sd.management_source,sd.id
|
|
|
+ order by a.sumpremium desc
|
|
|
</select>
|
|
|
|
|
|
<select id="getBusinessAgentDataTotal" resultType="java.lang.Long">
|
|
|
select
|
|
|
- count(0)
|
|
|
- from (
|
|
|
- select
|
|
|
- io.userid
|
|
|
- from ins_area_company iac
|
|
|
- left join ins_orders io on io.orderno =iac.orderno
|
|
|
- left join sys_user su on io.userid =su.id
|
|
|
+ COUNT(0)
|
|
|
+ from sys_user su
|
|
|
left join sys_dept sd on sd.id =su.dept_id
|
|
|
-
|
|
|
<where>
|
|
|
- iac.orderstatus = '3'
|
|
|
- <if test="vo.createtimeStart != null and vo.createtimeStart!='' and vo.createtimeEnd != null and vo.createtimeEnd!=''">
|
|
|
- AND DATE_FORMAT( iac.signing_time, '%Y-%m-%d') BETWEEN DATE_FORMAT( #{vo.createtimeStart}, '%Y-%m-%d') AND
|
|
|
- DATE_FORMAT( #{vo.createtimeEnd}, '%Y-%m-%d')
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="vo.days !=null and vo.days !='' and vo.days != 0 ">
|
|
|
- and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{vo.days} DAY)
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="vo.userName !=null and vo.userName!=''">
|
|
|
- and su.name=#{vo.userName}
|
|
|
- </if>
|
|
|
-
|
|
|
+ 1=1
|
|
|
<if test="vo.userId !=null and vo.userId!=''">
|
|
|
and su.id=#{vo.userId}
|
|
|
</if>
|
|
|
-
|
|
|
<if test="vo.userIds !=null and vo.userIds!='' and vo.userIds.size()>0">
|
|
|
and su.id in
|
|
|
<foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
-
|
|
|
- <if test="vo.deptId !=null and vo.deptId!=''">
|
|
|
- and io.deptid like concat('%',#{vo.deptId},'%')
|
|
|
+ <if test="vo.userName !=null and vo.userName!=''">
|
|
|
+ and su.name=#{vo.userName}
|
|
|
</if>
|
|
|
|
|
|
<if test="vo.managementSource !=null and vo.managementSource!=''">
|
|
|
and sd.management_source=#{vo.managementSource}
|
|
|
</if>
|
|
|
- <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
|
|
|
- AND io.deptid in
|
|
|
- <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
|
|
|
- AND io.userid in
|
|
|
- <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
</where>
|
|
|
- group by io.userid
|
|
|
- ) a
|
|
|
</select>
|
|
|
|
|
|
<select id="getBusinessAgentDataTotalAdd" resultType="com.ydtech.modules.admin.model.vo.BusinessAgentData">
|