|
|
@@ -62,8 +62,20 @@
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
+ <!--团队返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
|
|
|
+ p.deptid,
|
|
|
+ </if>
|
|
|
+ <!--机构返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
|
|
|
+ substr(p.deptid,1,#{reportReqVo.drilFlag}) institutionId,
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="reportReqVo.riskCode != null and reportReqVo.riskCode != ''">
|
|
|
+ <if test="reportReqVo.riskCode!='ALL'.toString()">
|
|
|
+ p.`risk_name` risk_name,
|
|
|
+ </if>
|
|
|
</if>
|
|
|
- p.`risk_name` risk_name,
|
|
|
count(distinct policyno) policy_count,
|
|
|
SUM(p.`sumpremium`) sumpremium,
|
|
|
SUM(p.`supervise_costs_premiums`) supervise_costs_premiums,
|
|
|
@@ -92,6 +104,15 @@
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
+
|
|
|
+ <!--团队返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
|
|
|
+ and p.deptid = #{reportReqVo.deptId}
|
|
|
+ </if>
|
|
|
+ <!--机构返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
|
|
|
+ and substr(p.deptid,1,#{reportReqVo.drilFlag}) = #{reportReqVo.deptId}
|
|
|
+ </if>
|
|
|
</if>
|
|
|
<!--非下钻查询时拼接-->
|
|
|
<if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '0'.toString()">
|
|
|
@@ -123,27 +144,71 @@
|
|
|
<if test="reportReqVo.quoteStartDate != null and reportReqVo.quoteEndDate != null">
|
|
|
and p.inside_pay_time between #{reportReqVo.quoteStartDate} AND #{reportReqVo.quoteEndDate}
|
|
|
</if>
|
|
|
- GROUP BY p.`risk_name`
|
|
|
- <!--下钻查询时拼接-->
|
|
|
- <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '1'.toString()">
|
|
|
- <!--按团队下钻时-->
|
|
|
- <if test="reportReqVo.drilType != null and reportReqVo.drilType == '1'.toString()">
|
|
|
- ,p.`username`,p.userid order by p.`username`,p.`risk_name`
|
|
|
- </if>
|
|
|
- <!--按机构下钻时-->
|
|
|
- <if test="reportReqVo.drilType != null and reportReqVo.drilType == '0'.toString()">
|
|
|
- <choose>
|
|
|
- <!--下钻的是五级机构时,下钻到团队-->
|
|
|
- <when test="reportReqVo.drilFlag != null and reportReqVo.drilFlag == '0'.toString()">
|
|
|
- ,p.deptid order by p.deptid,p.`risk_name`
|
|
|
- </when>
|
|
|
- <!--下钻的非五级机构时,下钻到下级机构-->
|
|
|
- <otherwise>
|
|
|
- ,substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag}),p.`risk_name`
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
+
|
|
|
+ <choose>
|
|
|
+ <when test="reportReqVo.riskCode != null and reportReqVo.riskCode!='ALL'.toString()">
|
|
|
+ GROUP BY p.`risk_name`
|
|
|
+ <!--下钻查询时拼接-->
|
|
|
+ <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '1'.toString()">
|
|
|
+ <!--按团队下钻时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '1'.toString()">
|
|
|
+ ,p.`username`,p.userid order by p.`username`,p.`risk_name`
|
|
|
+ </if>
|
|
|
+ <!--按机构下钻时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '0'.toString()">
|
|
|
+ <choose>
|
|
|
+ <!--下钻的是五级机构时,下钻到团队-->
|
|
|
+ <when test="reportReqVo.drilFlag != null and reportReqVo.drilFlag == '0'.toString()">
|
|
|
+ ,p.deptid order by p.deptid,p.`risk_name`
|
|
|
+ </when>
|
|
|
+ <!--下钻的非五级机构时,下钻到下级机构-->
|
|
|
+ <otherwise>
|
|
|
+ ,substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag}),p.`risk_name`
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <!--团队返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
|
|
|
+ ,p.deptid order by p.deptid
|
|
|
+ </if>
|
|
|
+ <!--机构返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
|
|
|
+ ,substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag})
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <!--下钻查询时拼接-->
|
|
|
+ <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '1'.toString()">
|
|
|
+ <!--按团队下钻时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '1'.toString()">
|
|
|
+ group by p.`username`,p.userid order by p.`username`
|
|
|
+ </if>
|
|
|
+ <!--按机构下钻时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '0'.toString()">
|
|
|
+ <choose>
|
|
|
+ <!--下钻的是五级机构时,下钻到团队-->
|
|
|
+ <when test="reportReqVo.drilFlag != null and reportReqVo.drilFlag == '0'.toString()">
|
|
|
+ group by p.deptid order by p.deptid
|
|
|
+ </when>
|
|
|
+ <!--下钻的非五级机构时,下钻到下级机构-->
|
|
|
+ <otherwise>
|
|
|
+ group by substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag})
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <!--团队返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
|
|
|
+ group by p.deptid order by p.deptid
|
|
|
+ </if>
|
|
|
+ <!--机构返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
|
|
|
+ group by substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag})
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
</select>
|
|
|
|
|
|
<resultMap id="OrderAndCostDataMap" type="com.ydtech.modules.report.model.vo.OrderVolumeAndCostStatisticsResVo">
|
|
|
@@ -161,6 +226,7 @@
|
|
|
select
|
|
|
count(1)
|
|
|
from (
|
|
|
+
|
|
|
SELECT
|
|
|
<!--下钻查询时拼接-->
|
|
|
<if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '1'.toString()">
|
|
|
@@ -181,8 +247,20 @@
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
+ <!--团队返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
|
|
|
+ p.deptid,
|
|
|
+ </if>
|
|
|
+ <!--机构返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
|
|
|
+ substr(p.deptid,1,#{reportReqVo.drilFlag}) institutionId,
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="reportReqVo.riskCode != null and reportReqVo.riskCode != ''">
|
|
|
+ <if test="reportReqVo.riskCode!='ALL'.toString()">
|
|
|
+ p.`risk_name` risk_name,
|
|
|
+ </if>
|
|
|
</if>
|
|
|
- p.`risk_name` risk_name,
|
|
|
count(distinct policyno) policy_count,
|
|
|
SUM(p.`sumpremium`) sumpremium,
|
|
|
SUM(p.`supervise_costs_premiums`) supervise_costs_premiums,
|
|
|
@@ -211,6 +289,15 @@
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
+
|
|
|
+ <!--团队返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
|
|
|
+ and p.deptid = #{reportReqVo.deptId}
|
|
|
+ </if>
|
|
|
+ <!--机构返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
|
|
|
+ and substr(p.deptid,1,#{reportReqVo.drilFlag}) = #{reportReqVo.deptId}
|
|
|
+ </if>
|
|
|
</if>
|
|
|
<!--非下钻查询时拼接-->
|
|
|
<if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '0'.toString()">
|
|
|
@@ -242,27 +329,71 @@
|
|
|
<if test="reportReqVo.quoteStartDate != null and reportReqVo.quoteEndDate != null">
|
|
|
and p.inside_pay_time between #{reportReqVo.quoteStartDate} AND #{reportReqVo.quoteEndDate}
|
|
|
</if>
|
|
|
- GROUP BY p.`risk_name`
|
|
|
- <!--下钻查询时拼接-->
|
|
|
- <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '1'.toString()">
|
|
|
- <!--按团队下钻时-->
|
|
|
- <if test="reportReqVo.drilType != null and reportReqVo.drilType == '1'.toString()">
|
|
|
- ,p.`username`,p.userid order by p.`username`,p.`risk_name`
|
|
|
- </if>
|
|
|
- <!--按机构下钻时-->
|
|
|
- <if test="reportReqVo.drilType != null and reportReqVo.drilType == '0'.toString()">
|
|
|
- <choose>
|
|
|
- <!--下钻的是五级机构时,下钻到团队-->
|
|
|
- <when test="reportReqVo.drilFlag != null and reportReqVo.drilFlag == '0'.toString()">
|
|
|
- ,p.deptid order by p.deptid,p.`risk_name`
|
|
|
- </when>
|
|
|
- <!--下钻的非五级机构时,下钻到下级机构-->
|
|
|
- <otherwise>
|
|
|
- ,substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag}),p.`risk_name`
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
+
|
|
|
+ <choose>
|
|
|
+ <when test="reportReqVo.riskCode != null and reportReqVo.riskCode!='ALL'.toString()">
|
|
|
+ GROUP BY p.`risk_name`
|
|
|
+ <!--下钻查询时拼接-->
|
|
|
+ <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '1'.toString()">
|
|
|
+ <!--按团队下钻时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '1'.toString()">
|
|
|
+ ,p.`username`,p.userid order by p.`username`,p.`risk_name`
|
|
|
+ </if>
|
|
|
+ <!--按机构下钻时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '0'.toString()">
|
|
|
+ <choose>
|
|
|
+ <!--下钻的是五级机构时,下钻到团队-->
|
|
|
+ <when test="reportReqVo.drilFlag != null and reportReqVo.drilFlag == '0'.toString()">
|
|
|
+ ,p.deptid order by p.deptid,p.`risk_name`
|
|
|
+ </when>
|
|
|
+ <!--下钻的非五级机构时,下钻到下级机构-->
|
|
|
+ <otherwise>
|
|
|
+ ,substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag}),p.`risk_name`
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <!--团队返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
|
|
|
+ ,p.deptid order by p.deptid
|
|
|
+ </if>
|
|
|
+ <!--机构返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
|
|
|
+ ,substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag})
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <!--下钻查询时拼接-->
|
|
|
+ <if test="reportReqVo.isDrilling != null and reportReqVo.isDrilling == '1'.toString()">
|
|
|
+ <!--按团队下钻时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '1'.toString()">
|
|
|
+ group by p.`username`,p.userid order by p.`username`
|
|
|
+ </if>
|
|
|
+ <!--按机构下钻时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '0'.toString()">
|
|
|
+ <choose>
|
|
|
+ <!--下钻的是五级机构时,下钻到团队-->
|
|
|
+ <when test="reportReqVo.drilFlag != null and reportReqVo.drilFlag == '0'.toString()">
|
|
|
+ group by p.deptid order by p.deptid
|
|
|
+ </when>
|
|
|
+ <!--下钻的非五级机构时,下钻到下级机构-->
|
|
|
+ <otherwise>
|
|
|
+ group by substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag})
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <!--团队返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '2'.toString()">
|
|
|
+ group by p.deptid order by p.deptid
|
|
|
+ </if>
|
|
|
+ <!--机构返回上层时-->
|
|
|
+ <if test="reportReqVo.drilType != null and reportReqVo.drilType == '3'.toString()">
|
|
|
+ group by substr(p.deptid,1,#{reportReqVo.drilFlag}) order by substr(p.deptid,1,#{reportReqVo.drilFlag})
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
) as s
|
|
|
</select>
|
|
|
|