| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ydtech.modules.fnc.dao.InsPlySettleMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.ydtech.modules.fnc.entity.InsPlySettle">
- <id column="settleno" property="settleno" />
- <result column="company_id" property="companyId" />
- <result column="company_name" property="companyName" />
- <result column="settle_month" property="settleMonth" />
- <result column="settle_batch" property="settleBatch" />
- <result column="commission_feevalue" property="commissionFeevalue" />
- <result column="other_feevalue" property="otherFeevalue" />
- <result column="all_fee_value" property="allFeeValue" />
- <result column="dept_id" property="deptId" />
- <result column="dept_name" property="deptName" />
- <result column="create_time" property="createTime" />
- <result column="operator" property="operator" />
- <result column="status" property="status" />
- </resultMap>
- <resultMap id="SettleReportDataMap" type="com.ydtech.modules.report.model.vo.InsPlySettleReportResVo">
- <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
- <result property="settleMonth" column="settle_month" jdbcType="VARCHAR"/>
- <result property="commissionFeevalue" column="commission_feevalue" jdbcType="DECIMAL"/>
- <result property="otherFeevalue" column="other_feevalue" jdbcType="DECIMAL"/>
- <result property="allFeeValue" column="all_fee_value" jdbcType="DECIMAL"/>
- <result property="status" column="status" jdbcType="VARCHAR"/>
- </resultMap>
- <select id="getInsPlySettleReport" resultMap="SettleReportDataMap">
- <foreach collection="reportReqVo.groupInsCompanyArr" item="id"
- separator=" union all " >
- SELECT
- #{id} company_id,
- settle_month,
- #{reportReqVo.status} status,
- SUM(p.`commission_feevalue`) commission_feevalue,
- SUM(p.`other_feevalue`) other_feevalue,
- SUM(p.`all_fee_value`) all_fee_value
- FROM
- ins_ply_settle p WHERE
- p.company_id in (select id from esm_ins_company where FIND_IN_SET(id,get_child_list(#{id})))
- <if test="reportReqVo.status != null and reportReqVo.status != ''">
- and p.status = #{reportReqVo.status}
- </if>
- <if test="reportReqVo.settleMonth != null and reportReqVo.settleMonth != ''">
- and p.settle_month = #{reportReqVo.settleMonth}
- </if>
- <if test="reportReqVo.quoteStartDate != null and reportReqVo.quoteEndDate != null">
- and p.create_time between #{reportReqVo.quoteStartDate} AND #{reportReqVo.quoteEndDate}
- </if>
- GROUP BY p.`settle_month`
- </foreach>
- </select>
- <select id="getInsPlySettleReportCount" resultType="Long">
- select
- count(1)
- from (
- <foreach collection="reportReqVo.groupInsCompanyArr" item="id"
- separator=" union all " >
- SELECT
- #{id} company_id,
- settle_month,
- #{reportReqVo.status} status,
- SUM(p.`commission_feevalue`) commission_feevalue,
- SUM(p.`other_feevalue`) other_feevalue,
- SUM(p.`all_fee_value`) all_fee_value
- FROM
- ins_ply_settle p WHERE
- p.company_id in (select id from esm_ins_company where FIND_IN_SET(id,get_child_list(#{id})))
- <if test="reportReqVo.status != null and reportReqVo.status != ''">
- and p.status = #{reportReqVo.status}
- </if>
- <if test="reportReqVo.settleMonth != null and reportReqVo.settleMonth != ''">
- and p.settle_month = #{reportReqVo.settleMonth}
- </if>
- <if test="reportReqVo.quoteStartDate != null and reportReqVo.quoteEndDate != null">
- and p.create_time between #{reportReqVo.quoteStartDate} AND #{reportReqVo.quoteEndDate}
- </if>
- GROUP BY p.`settle_month`
- </foreach>
- ) as s
- </select>
- <resultMap id="InsPlySettleStatisticsListResMap" type="com.ydtech.modules.report.model.vo.InsPlySettleStatisticsListResVo">
- <id column="settleno" property="settleno" />
- <result column="company_name" property="companyName" />
- <result column="settle_month" property="settleMonth" />
- <result column="settle_batch" property="settleBatch" />
- <result column="commission_feevalue" property="commissionFeevalue" />
- <result column="other_feevalue" property="otherFeevalue" />
- <result column="all_fee_value" property="allFeeValue" />
- <result column="create_time" property="createTime" />
- <result column="operator" property="operator" />
- <result column="status" property="status" />
- </resultMap>
- <select id="getInsPlySettleReportList" resultMap="InsPlySettleStatisticsListResMap">
- SELECT
- p.settleno,
- (select name from esm_ins_company where id = p.company_id)company_name,
- p.settle_month,
- p.settle_batch,
- p.`commission_feevalue`,
- p.`other_feevalue`,
- p.`all_fee_value`,
- p.create_time,
- p.operator,
- p.status
- FROM
- ins_ply_settle p WHERE 1=1
- <if test="reportReqVo.companyId != null and reportReqVo.companyId != ''">
- and p.company_id = #{reportReqVo.companyId}
- </if>
- <if test="reportReqVo.status != null and reportReqVo.status != ''">
- and p.status = #{reportReqVo.status}
- </if>
- <if test="reportReqVo.settleMonth != null and reportReqVo.settleMonth != ''">
- and p.settle_month = #{reportReqVo.settleMonth}
- </if>
- <if test="reportReqVo.quoteStartDate != null and reportReqVo.quoteEndDate != null">
- and p.create_time between #{reportReqVo.quoteStartDate} AND #{reportReqVo.quoteEndDate}
- </if>
- </select>
- </mapper>
|