|
|
@@ -748,4 +748,183 @@
|
|
|
</if>
|
|
|
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <!--===========================================分割线=======报表手续费和分销费=================================================-->
|
|
|
+
|
|
|
+ <resultMap id="PayApplyUserReportDataMap" type="com.ydtech.modules.report.model.vo.PayApplyUserReportResVo">
|
|
|
+ <result property="institution" column="institution" jdbcType="VARCHAR"/>
|
|
|
+ <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
|
|
|
+ <result property="username" column="username" jdbcType="VARCHAR"/>
|
|
|
+ <result property="waitPayCostsPremiums" column="wait_pay_costs_premiums" jdbcType="DECIMAL"/>
|
|
|
+ <result property="paidCostsPremiums" column="paid_costs_premiums" jdbcType="DECIMAL"/>
|
|
|
+ <result property="sumCostsPremiums" column="sum_costs_premiums" jdbcType="DECIMAL"/>
|
|
|
+ <result property="waitPayRetailPremiums" column="wait_pay_retail_premiums" jdbcType="DECIMAL"/>
|
|
|
+ <result property="paidRetailPremiums" column="paid_retail_premiums" jdbcType="DECIMAL"/>
|
|
|
+ <result property="sumRetailPremiums" column="sum_retail_premiums" jdbcType="DECIMAL"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="queryPayApplyUserReportData" resultMap="PayApplyUserReportDataMap">
|
|
|
+ SELECT deptid,
|
|
|
+ <if test="reportReqVo.userId != null and reportReqVo.userId != ''">
|
|
|
+ userid,
|
|
|
+ </if>
|
|
|
+ SUM( CASE feetype WHEN '1' THEN totalfee ELSE 0 END ) AS sum_costs_premiums,
|
|
|
+ SUM( CASE feetype WHEN '1' THEN paidfee ELSE 0 END ) AS paid_costs_premiums,
|
|
|
+ SUM( CASE feetype WHEN '1' THEN totalfee-paidfee ELSE 0 END ) AS wait_pay_costs_premiums,
|
|
|
+ SUM( CASE feetype WHEN '2' THEN totalfee ELSE 0 END ) AS sum_retail_premiums,
|
|
|
+ SUM( CASE feetype WHEN '2' THEN paidfee ELSE 0 END ) AS paid_retail_premiums,
|
|
|
+ SUM( CASE feetype WHEN '2' THEN totalfee-paidfee ELSE 0 END ) AS wait_pay_retail_premiums
|
|
|
+ FROM report_payable_basedata p WHERE 1=1
|
|
|
+ <choose>
|
|
|
+ <!--条件中团队不为空时,直接拼接团队-->
|
|
|
+ <when test="reportReqVo.teamCode != null and reportReqVo.teamCode != ''">
|
|
|
+ and p.deptid = #{reportReqVo.teamCode}
|
|
|
+ </when>
|
|
|
+ <!--条件中团队为空时,使用机构模糊查询-->
|
|
|
+ <otherwise>
|
|
|
+ <if test="reportReqVo.deptId != null and reportReqVo.deptId != ''">
|
|
|
+ and p.deptid like #{reportReqVo.deptId}"%"
|
|
|
+ </if>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <if test="reportReqVo.userId != null and reportReqVo.userId != ''">
|
|
|
+ and p.userId = #{reportReqVo.userId}
|
|
|
+ </if>
|
|
|
+ <if test="reportReqVo.insCompany != null and reportReqVo.insCompany != ''">
|
|
|
+ and p.inscompany = #{reportReqVo.insCompany}
|
|
|
+ </if>
|
|
|
+ <if test="reportReqVo.quoteStartDate != null and reportReqVo.quoteEndDate != null">
|
|
|
+ and p.signdate between #{reportReqVo.quoteStartDate} AND #{reportReqVo.quoteEndDate}
|
|
|
+ </if>
|
|
|
+ group by deptid
|
|
|
+ <if test="reportReqVo.userId != null and reportReqVo.userId != ''">
|
|
|
+ ,userid
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="queryPayApplyUserReportDataCount" resultType="Long">
|
|
|
+ select
|
|
|
+ count(1)
|
|
|
+ from (
|
|
|
+ SELECT deptid,
|
|
|
+ <if test="reportReqVo.userId != null and reportReqVo.userId != ''">
|
|
|
+ userid,
|
|
|
+ </if>
|
|
|
+ SUM( CASE feetype WHEN '1' THEN totalfee ELSE 0 END ) AS sum_costs_premiums,
|
|
|
+ SUM( CASE feetype WHEN '1' THEN paidfee ELSE 0 END ) AS paid_costs_premiums,
|
|
|
+ SUM( CASE feetype WHEN '1' THEN totalfee-paidfee ELSE 0 END ) AS wait_pay_costs_premiums,
|
|
|
+ SUM( CASE feetype WHEN '2' THEN totalfee ELSE 0 END ) AS sum_retail_premiums,
|
|
|
+ SUM( CASE feetype WHEN '2' THEN paidfee ELSE 0 END ) AS paid_retail_premiums,
|
|
|
+ SUM( CASE feetype WHEN '2' THEN totalfee-paidfee ELSE 0 END ) AS wait_pay_retail_premiums
|
|
|
+ FROM report_payable_basedata p WHERE 1=1
|
|
|
+ <choose>
|
|
|
+ <!--条件中团队不为空时,直接拼接团队-->
|
|
|
+ <when test="reportReqVo.teamCode != null and reportReqVo.teamCode != ''">
|
|
|
+ and p.deptid = #{reportReqVo.teamCode}
|
|
|
+ </when>
|
|
|
+ <!--条件中团队为空时,使用机构模糊查询-->
|
|
|
+ <otherwise>
|
|
|
+ <if test="reportReqVo.deptId != null and reportReqVo.deptId != ''">
|
|
|
+ and p.deptid like #{reportReqVo.deptId}"%"
|
|
|
+ </if>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <if test="reportReqVo.userId != null and reportReqVo.userId != ''">
|
|
|
+ and p.userId = #{reportReqVo.userId}
|
|
|
+ </if>
|
|
|
+ <if test="reportReqVo.insCompany != null and reportReqVo.insCompany != ''">
|
|
|
+ and p.inscompany = #{reportReqVo.insCompany}
|
|
|
+ </if>
|
|
|
+ <if test="reportReqVo.quoteStartDate != null and reportReqVo.quoteEndDate != null">
|
|
|
+ and p.signdate between #{reportReqVo.quoteStartDate} AND #{reportReqVo.quoteEndDate}
|
|
|
+ </if>
|
|
|
+ group by deptid
|
|
|
+ <if test="reportReqVo.userId != null and reportReqVo.userId != ''">
|
|
|
+ ,userid
|
|
|
+ </if>
|
|
|
+ ) as s
|
|
|
+ </select>
|
|
|
+ <resultMap id="PayApplyUserReportListDataMap" type="com.ydtech.modules.report.model.vo.PayApplyUserReportResVo">
|
|
|
+ <result property="institution" column="institution" jdbcType="VARCHAR"/>
|
|
|
+ <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
|
|
|
+ <result property="username" column="username" jdbcType="VARCHAR"/>
|
|
|
+ <result property="inscompany" column="inscompany" jdbcType="VARCHAR"/>
|
|
|
+ <result property="policyno" column="policyno" jdbcType="VARCHAR"/>
|
|
|
+ <result property="riskcode" column="riskcode" jdbcType="VARCHAR"/>
|
|
|
+ <result property="waitPayCostsPremiums" column="wait_pay_costs_premiums" jdbcType="DECIMAL"/>
|
|
|
+ <result property="paidCostsPremiums" column="paid_costs_premiums" jdbcType="DECIMAL"/>
|
|
|
+ <result property="sumCostsPremiums" column="sum_costs_premiums" jdbcType="DECIMAL"/>
|
|
|
+ <result property="waitPayRetailPremiums" column="wait_pay_retail_premiums" jdbcType="DECIMAL"/>
|
|
|
+ <result property="paidRetailPremiums" column="paid_retail_premiums" jdbcType="DECIMAL"/>
|
|
|
+ <result property="sumRetailPremiums" column="sum_retail_premiums" jdbcType="DECIMAL"/>
|
|
|
+ </resultMap>
|
|
|
+ <select id="queryPayApplyUserReportList" resultMap="PayApplyUserReportListDataMap">
|
|
|
+ SELECT deptname,username,inscompany,policyno,riskcode,
|
|
|
+ CASE feetype WHEN '1' THEN totalfee ELSE 0 END AS sum_costs_premiums,
|
|
|
+ CASE feetype WHEN '1' THEN paidfee ELSE 0 END AS paid_costs_premiums,
|
|
|
+ CASE feetype WHEN '1' THEN totalfee-paidfee ELSE 0 END AS wait_pay_costs_premiums,
|
|
|
+ CASE feetype WHEN '2' THEN totalfee ELSE 0 END AS sum_retail_premiums,
|
|
|
+ CASE feetype WHEN '2' THEN paidfee ELSE 0 END AS paid_retail_premiums,
|
|
|
+ CASE feetype WHEN '2' THEN totalfee-paidfee ELSE 0 END AS wait_pay_retail_premiums
|
|
|
+ FROM report_payable_basedata p WHERE 1=1
|
|
|
+ <choose>
|
|
|
+ <!--条件中团队不为空时,直接拼接团队-->
|
|
|
+ <when test="reportReqVo.teamCode != null and reportReqVo.teamCode != ''">
|
|
|
+ and p.deptid = #{reportReqVo.teamCode}
|
|
|
+ </when>
|
|
|
+ <!--条件中团队为空时,使用机构模糊查询-->
|
|
|
+ <otherwise>
|
|
|
+ <if test="reportReqVo.deptId != null and reportReqVo.deptId != ''">
|
|
|
+ and p.deptid like #{reportReqVo.deptId}"%"
|
|
|
+ </if>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <if test="reportReqVo.userId != null and reportReqVo.userId != ''">
|
|
|
+ and p.userId = #{reportReqVo.userId}
|
|
|
+ </if>
|
|
|
+ <if test="reportReqVo.insCompany != null and reportReqVo.insCompany != ''">
|
|
|
+ and p.inscompany = #{reportReqVo.insCompany}
|
|
|
+ </if>
|
|
|
+ <if test="reportReqVo.quoteStartDate != null and reportReqVo.quoteEndDate != null">
|
|
|
+ and p.signdate between #{reportReqVo.quoteStartDate} AND #{reportReqVo.quoteEndDate}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <!--===========================================分割线=======报表管理费=================================================-->
|
|
|
+ <resultMap id="PayApplyDeptReportDataMap" type="com.ydtech.modules.report.model.vo.PayApplyDeptReportResVo">
|
|
|
+ <result property="institution" column="institution" jdbcType="VARCHAR"/>
|
|
|
+ <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
|
|
|
+ <result property="username" column="username" jdbcType="VARCHAR"/>
|
|
|
+ <result property="waitPayCostsPremiums" column="wait_pay_costs_premiums" jdbcType="DECIMAL"/>
|
|
|
+ <result property="paidCostsPremiums" column="paid_costs_premiums" jdbcType="DECIMAL"/>
|
|
|
+ <result property="sumCostsPremiums" column="sum_costs_premiums" jdbcType="DECIMAL"/>
|
|
|
+ <result property="waitPayRetailPremiums" column="wait_pay_retail_premiums" jdbcType="DECIMAL"/>
|
|
|
+ <result property="paidRetailPremiums" column="paid_retail_premiums" jdbcType="DECIMAL"/>
|
|
|
+ <result property="sumRetailPremiums" column="sum_retail_premiums" jdbcType="DECIMAL"/>
|
|
|
+ </resultMap>
|
|
|
+ <select id="queryPayApplyDeptReportData" resultMap="PayApplyDeptReportDataMap">
|
|
|
+ SELECT
|
|
|
+ count(distinct policyno) policy_count,
|
|
|
+ SUM(p.`sumpremium`) sumpremium,
|
|
|
+ SUM(p.`supervise_costs_premiums`) supervise_costs_premiums,
|
|
|
+ SUM(p.`other_costs_premiums`) other_costs_premiums,
|
|
|
+ SUM(p.`sum_costs_premiums`) sum_costs_premiums
|
|
|
+ FROM
|
|
|
+ report_payable_basedata p WHERE 1=1
|
|
|
+ </select>
|
|
|
+ <select id="queryPayApplyDeptReportDataCount" resultType="Long">
|
|
|
+ select
|
|
|
+ count(1)
|
|
|
+ from (
|
|
|
+ SELECT
|
|
|
+ count(distinct policyno) policy_count,
|
|
|
+ SUM(p.`sumpremium`) sumpremium,
|
|
|
+ SUM(p.`supervise_costs_premiums`) supervise_costs_premiums,
|
|
|
+ SUM(p.`other_costs_premiums`) other_costs_premiums,
|
|
|
+ SUM(p.`sum_costs_premiums`) sum_costs_premiums
|
|
|
+ FROM
|
|
|
+ report_payable_basedata p WHERE 1=1
|
|
|
+ ) as s
|
|
|
+ </select>
|
|
|
</mapper>
|