| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510 |
- <?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.protocols.dao.InsFeeOrderNewMapper">
- <resultMap id="BaseResultMap" type="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
- <id column="id" property="id"/>
- <result column="ins_order_no" property="insOrderNo"/>
- <result column="agreement_id" property="agreementId"/>
- <result column="costs_id" property="costsId"/>
- <result column="dept_id" property="deptId"/>
- <result column="user_id" property="userId"/>
- <result column="jq_premium" property="jqPremium"/>
- <result column="sy_premium" property="syPremium"/>
- <result column="no_premium" property="noPremium"/>
- <result column="jq_no_tax_premium" property="jqNoTaxPremium"/>
- <result column="sy_no_tax_premium" property="syNoTaxPremium"/>
- <result column="no_no_tax_premium" property="noNoTaxPremium"/>
- <result column="jq_costs_proportion" property="jqCostsProportion"/>
- <result column="jq_costs_premiums" property="jqCostsPremiums"/>
- <result column="sy_costs_proportion" property="syCostsProportion"/>
- <result column="sy_costs_premiums" property="syCostsPremiums"/>
- <result column="no_costs_proportion" property="noCostsProportion"/>
- <result column="no_costs_premiums" property="noCostsPremiums"/>
- <result column="jq_supervise_costs_proportion" property="jqSuperviseCostsProportion"/>
- <result column="jq_supervise_costs_premiums" property="jqSuperviseCostsPremiums"/>
- <result column="sy_supervise_costs_proportion" property="sySuperviseCostsProportion"/>
- <result column="sy_supervise_costs_premiums" property="sySuperviseCostsPremiums"/>
- <result column="no_supervise_costs_proportion" property="noSuperviseCostsProportion"/>
- <result column="no_supervise_costs_premiums" property="noSuperviseCostsPremiums"/>
- <result column="jq_other_costs_proportion" property="jqOtherCostsProportion"/>
- <result column="jq_other_costs_premiums" property="jqOtherCostsPremiums"/>
- <result column="sy_other_costs_proportion" property="syOtherCostsProportion"/>
- <result column="sy_other_costs_premiums" property="syOtherCostsPremiums"/>
- <result column="no_other_costs_proportion" property="noOtherCostsProportion"/>
- <result column="no_other_costs_premiums" property="noOtherCostsPremiums"/>
- <result column="jq_investment_costs_proportion" property="jqInvestmentCostsProportion"/>
- <result column="jq_investment_costs_premiums" property="jqInvestmentCostsPremiums"/>
- <result column="sy_investment_costs_proportion" property="syInvestmentCostsProportion"/>
- <result column="sy_investment_costs_premiums" property="syInvestmentCostsPremiums"/>
- <result column="jq_dept_proportion_level_1" property="jqDeptProportionLevel1"/>
- <result column="jq_dept_premiums_level_1" property="jqDeptPremiumsLevel1"/>
- <result column="sy_dept_proportion_level_1" property="syDeptProportionLevel1"/>
- <result column="sy_dept_premiums_level_1" property="syDeptPremiumsLevel1"/>
- <result column="no_dept_proportion_level_1" property="noDeptProportionLevel1"/>
- <result column="no_dept_premiums_level_1" property="noDeptPremiumsLevel1"/>
- <result column="jq_dept_proportion_level_2" property="jqDeptProportionLevel2"/>
- <result column="jq_dept_premiums_level_2" property="jqDeptPremiumsLevel2"/>
- <result column="sy_dept_proportion_level_2" property="syDeptProportionLevel2"/>
- <result column="sy_dept_premiums_level_2" property="syDeptPremiumsLevel2"/>
- <result column="no_dept_proportion_level_2" property="noDeptProportionLevel2"/>
- <result column="no_dept_premiums_level_2" property="noDeptPremiumsLevel2"/>
- <result column="jq_dept_proportion_level_3" property="jqDeptProportionLevel3"/>
- <result column="jq_dept_premiums_level_3" property="jqDeptPremiumsLevel3"/>
- <result column="sy_dept_proportion_level_3" property="syDeptProportionLevel3"/>
- <result column="sy_dept_premiums_level_3" property="syDeptPremiumsLevel3"/>
- <result column="no_dept_proportion_level_3" property="noDeptProportionLevel3"/>
- <result column="no_dept_premiums_level_3" property="noDeptPremiumsLevel3"/>
- <result column="jq_dept_proportion_level_4" property="jqDeptProportionLevel4"/>
- <result column="jq_dept_premiums_level_4" property="jqDeptPremiumsLevel4"/>
- <result column="sy_dept_proportion_level_4" property="syDeptProportionLevel4"/>
- <result column="sy_dept_premiums_level_4" property="syDeptPremiumsLevel4"/>
- <result column="no_dept_proportion_level_4" property="noDeptProportionLevel4"/>
- <result column="no_dept_premiums_level_4" property="noDeptPremiumsLevel4"/>
- <result column="jq_dept_proportion_level_5" property="jqDeptProportionLevel5"/>
- <result column="jq_dept_premiums_level_5" property="jqDeptPremiumsLevel5"/>
- <result column="sy_dept_proportion_level_5" property="syDeptProportionLevel5"/>
- <result column="sy_dept_premiums_level_5" property="syDeptPremiumsLevel5"/>
- <result column="no_dept_proportion_level_5" property="noDeptProportionLevel5"/>
- <result column="no_dept_premiums_level_5" property="noDeptPremiumsLevel5"/>
- <result column="jq_costs_export_proportion" property="jqCostsExportProportion"/>
- <result column="sy_costs_export_proportion" property="syCostsExportProportion"/>
- <result column="no_costs_export_proportion" property="noCostsExportProportion"/>
- <result column="jq_export_investment_proportion" property="jqExportInvestmentProportion"/>
- <result column="jq_export_investment_premiums" property="jqExportInvestmentPremiums"/>
- <result column="sy_export_investment_proportion" property="syExportInvestmentProportion"/>
- <result column="sy_export_investment_premiums" property="syExportInvestmentPremiums"/>
- <result column="first_detail_proportion" property="firstDetailProportion"/>
- <result column="first_detail_premiums" property="firstDetailPremiums"/>
- <result column="second_detail_proportion" property="secondDetailProportion"/>
- <result column="second_detail_premiums" property="secondDetailPremiums"/>
- <result column="third_detail_proportion" property="thirdDetailProportion"/>
- <result column="third_detail_premiums" property="thirdDetailPremiums"/>
- <result column="create_time" property="createTime"/>
- <result column="first_level_user_id" property="firstLevelUserId"/>
- <result column="two_level_user_id" property="twoLevelUserId"/>
- <result column="three_level_user_id" property="threeLevelUserId"/>
- <result column="distribution_status" property="distributionStatus"/>
- <result column="dept_distribution" property="deptDistribution"/>
- </resultMap>
- <select id="getInsFeeOrderEntity" resultType="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
- select
- a.id as "id",
- a.ins_order_no as "insOrderNo",
- a.agreement_id as "agreementId",
- a.costs_id as "costsId",
- a.dept_id as "deptId",
- a.user_id as "userId",
- a.jq_premium as "jqPremium",
- a.sy_premium as "syPremium",
- a.no_premium as "noPremium",
- a.jq_no_tax_premium as "jqNoTaxPremium",
- a.sy_no_tax_premium as "syNoTaxPremium",
- a.no_no_tax_premium as "noNoTaxPremium",
- a.jq_costs_proportion as "jqCostsProportion",
- a.jq_costs_premiums as "jqCostsPremiums",
- a.sy_costs_proportion as "syCostsProportion",
- a.sy_costs_premiums as "syCostsPremiums",
- a.no_costs_proportion as "noCostsProportion",
- a.no_costs_premiums as "noCostsPremiums",
- a.jq_supervise_costs_proportion as "jqSuperviseCostsProportion",
- a.jq_supervise_costs_premiums as "jqSuperviseCostsPremiums",
- a.sy_supervise_costs_proportion as "sySuperviseCostsProportion",
- a.sy_supervise_costs_premiums as "sySuperviseCostsPremiums",
- a.no_supervise_costs_proportion as "noSuperviseCostsProportion",
- a.no_supervise_costs_premiums as "noSuperviseCostsPremiums",
- a.jq_other_costs_proportion as "jqOtherCostsProportion",
- a.jq_other_costs_premiums as "jqOtherCostsPremiums",
- a.sy_other_costs_proportion as "syOtherCostsProportion",
- a.sy_other_costs_premiums as "syOtherCostsPremiums",
- a.no_other_costs_proportion as "noOtherCostsProportion",
- a.no_other_costs_premiums as "noOtherCostsPremiums",
- a.jq_investment_costs_proportion as "jqInvestmentCostsProportion",
- a.jq_investment_costs_premiums as "jqInvestmentCostsPremiums",
- a.sy_investment_costs_proportion as "syInvestmentCostsProportion",
- a.sy_investment_costs_premiums as "syInvestmentCostsPremiums",
- a.jq_dept_proportion_level_1 as "jqDeptProportionLevel1",
- a.jq_dept_premiums_level_1 as "jqDeptPremiumsLevel1",
- a.sy_dept_proportion_level_1 as "syDeptProportionLevel1",
- a.sy_dept_premiums_level_1 as "syDeptPremiumsLevel1",
- a.no_dept_proportion_level_1 as "noDeptProportionLevel1",
- a.no_dept_premiums_level_1 as "noDeptPremiumsLevel1",
- a.jq_dept_proportion_level_2 as "jqDeptProportionLevel2",
- a.jq_dept_premiums_level_2 as "jqDeptPremiumsLevel2",
- a.sy_dept_proportion_level_2 as "syDeptProportionLevel2",
- a.sy_dept_premiums_level_2 as "syDeptPremiumsLevel2",
- a.no_dept_proportion_level_2 as "noDeptProportionLevel2",
- a.no_dept_premiums_level_2 as "noDeptPremiumsLevel2",
- a.jq_dept_proportion_level_3 as "jqDeptProportionLevel3",
- a.jq_dept_premiums_level_3 as "jqDeptPremiumsLevel3",
- a.sy_dept_proportion_level_3 as "syDeptProportionLevel3",
- a.sy_dept_premiums_level_3 as "syDeptPremiumsLevel3",
- a.no_dept_proportion_level_3 as "noDeptProportionLevel3",
- a.no_dept_premiums_level_3 as "noDeptPremiumsLevel3",
- a.jq_dept_proportion_level_4 as "jqDeptProportionLevel4",
- a.jq_dept_premiums_level_4 as "jqDeptPremiumsLevel4",
- a.sy_dept_proportion_level_4 as "syDeptProportionLevel4",
- a.sy_dept_premiums_level_4 as "syDeptPremiumsLevel4",
- a.no_dept_proportion_level_4 as "noDeptProportionLevel4",
- a.no_dept_premiums_level_4 as "noDeptPremiumsLevel4",
- a.jq_dept_proportion_level_5 as "jqDeptProportionLevel5",
- a.jq_dept_premiums_level_5 as "jqDeptPremiumsLevel5",
- a.sy_dept_proportion_level_5 as "syDeptProportionLevel5",
- a.sy_dept_premiums_level_5 as "syDeptPremiumsLevel5",
- a.no_dept_proportion_level_5 as "noDeptProportionLevel5",
- a.no_dept_premiums_level_5 as "noDeptPremiumsLevel5",
- a.jq_costs_export_proportion as "jqCostsExportProportion",
- a.sy_costs_export_proportion as "syCostsExportProportion",
- a.no_costs_export_proportion as "noCostsExportProportion",
- a.jq_export_investment_proportion as "jqExportInvestmentProportion",
- a.jq_export_investment_premiums as "jqExportInvestmentPremiums",
- a.sy_export_investment_proportion as "syExportInvestmentProportion",
- a.sy_export_investment_premiums as "syExportInvestmentPremiums",
- a.first_detail_proportion as "firstDetailProportion",
- a.first_detail_premiums as "firstDetailPremiums",
- a.second_detail_proportion as "secondDetailProportion",
- a.second_detail_premiums as "secondDetailPremiums",
- a.third_detail_proportion as "thirdDetailProportion",
- a.third_detail_premiums as "thirdDetailPremiums",
- a.create_time as "createTime",
- a.first_level_user_id as "firstLevelUserId",
- a.two_level_user_id as "twoLevelUserId",
- a.three_level_user_id as "threeLevelUserId",
- a.distribution_status as "distributionStatus",
- a.dept_distribution as "deptDistribution",
- iac.signing_time as "signingTime",
- io.licenseno as "licenseno"
- from ins_fee_order_new a
- LEFT JOIN ins_area_company iac on iac.id=a.ins_order_no
- LEFT JOIN ins_orders io on io.quoteno =iac.id
- <where>
- 1=1
- <if test="id !=null and id !=''">
- AND a.ins_order_no=#{id}
- </if>
- </where>
- </select>
- <select id="getByUserId" resultType="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
- select a.* from ins_fee_order_new a
- <where>
- <if test="userId !=null and userId !=''">
- a.user_id =#{userId}
- </if>
- </where>
- </select>
- <select id="getByUserIdAndOrderStatusAndNoCheck" resultType="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
- select a.* from
- ins_fee_order_new a left join ins_area_company ins on a.ins_order_no=ins.id
- WHERE
- a.user_id = #{userId}
- and ins.orderstatus ='3'
- and a.ins_order_no not in (select ins_order_no from ins_fee_audit)
- </select>
- <select id="getSumWillAmount" resultType="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
- select
- a.ins_order_no as "id",
- a.user_id as "userId",
- ins.signing_time as "signingTime",
- o.licenseno as "licenseno",
- a.jq_export_supervise_costs_premiums as "jqExportSuperviseCostsPremiums",
- a.sy_export_supervise_costs_premiums as "syExportSuperviseCostsPremiums",
- a.no_export_supervise_costs_premiums as "noExportSuperviseCostsPremiums",
- a.jq_export_other_costs_premiums as "jqExportOtherCostsPremiums",
- a.sy_export_other_costs_premiums as "syExportOtherCostsPremiums",
- a.no_export_other_costs_premiums as "noExportOtherCostsPremiums"
- from
- ins_fee_order_new a left join ins_area_company ins on a.ins_order_no=ins.id
- left join ins_orders o ON o.orderno=ins.orderno
- <where>
- <if test="userId !=null and userId !=''">
- a.user_id = #{userId}
- </if>
- and ins.orderstatus ='3'
- and a.ins_order_no not in (select ins_order_no from ins_fee_audit)
- <if test="timeFiltering!= null and timeFiltering !=''">
- AND DATE_FORMAT(ins.signing_time, '%Y-%m' ) = #{timeFiltering}
- </if>
- <if test="amountType !=null and amountType !='' and amountType == 3 ">
- and (a.first_level_user_id is not null or a.two_level_user_id is not null or a.three_level_user_id is not null )
- </if>
- </where>
- </select>
- <select id="getSumWillAmountGeneralization" resultType="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
- SELECT
- fee.id,
- fee.userId,
- fee.signingTime,
- fee.licenseno,
- fee.jqExportSuperviseCostsPremiums,
- fee.syExportSuperviseCostsPremiums,
- fee.noExportSuperviseCostsPremiums,
- fee.jqExportOtherCostsPremiums,
- fee.syExportOtherCostsPremiums,
- fee.noExportOtherCostsPremiums,
- fee.willAmount
- FROM
- (
- SELECT
- a.ins_order_no as "id",
- a.user_id as "userId",
- iac.signing_time as "signingTime",
- o.licenseno as "licenseno",
- a.jq_export_supervise_costs_premiums as "jqExportSuperviseCostsPremiums",
- a.sy_export_supervise_costs_premiums as "syExportSuperviseCostsPremiums",
- a.no_export_supervise_costs_premiums as "noExportSuperviseCostsPremiums",
- a.jq_export_other_costs_premiums as "jqExportOtherCostsPremiums",
- a.sy_export_other_costs_premiums as "syExportOtherCostsPremiums",
- a.no_export_other_costs_premiums as "noExportOtherCostsPremiums",
- a.first_detail_premiums as "willAmount"
- FROM
- ins_fee_order_new a
- LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
- left join ins_orders o ON o.orderno=iac.orderno
- <where>
- a.ins_order_no NOT IN ( SELECT ins_order_no FROM ins_fee_audit )
- and iac.orderstatus = '3'
- <if test="userId!=null and userId!= ''">
- AND a.first_level_user_id = #{userId}
- </if>
- </where>
- UNION
- SELECT
- a.ins_order_no as "id",
- a.user_id as "userId",
- iac.signing_time as "signingTime",
- o.licenseno as "licenseno",
- a.jq_export_supervise_costs_premiums as "jqExportSuperviseCostsPremiums",
- a.sy_export_supervise_costs_premiums as "syExportSuperviseCostsPremiums",
- a.no_export_supervise_costs_premiums as "noExportSuperviseCostsPremiums",
- a.jq_export_other_costs_premiums as "jqExportOtherCostsPremiums",
- a.sy_export_other_costs_premiums as "syExportOtherCostsPremiums",
- a.no_export_other_costs_premiums as "noExportOtherCostsPremiums",
- a.third_detail_premiums as "willAmount"
- FROM
- ins_fee_order_new a
- LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
- left join ins_orders o ON o.orderno=iac.orderno
- <where>
- a.ins_order_no NOT IN ( SELECT ins_order_no FROM ins_fee_audit )
- and iac.orderstatus = '3'
- <if test="userId!=null and userId!= ''">
- AND a.three_level_user_id = #{userId}
- </if>
- </where>
- UNION
- SELECT
- a.ins_order_no as "id",
- a.user_id as "userId",
- iac.signing_time as "signingTime",
- o.licenseno as "licenseno",
- a.jq_export_supervise_costs_premiums as "jqExportSuperviseCostsPremiums",
- a.sy_export_supervise_costs_premiums as "syExportSuperviseCostsPremiums",
- a.no_export_supervise_costs_premiums as "noExportSuperviseCostsPremiums",
- a.jq_export_other_costs_premiums as "jqExportOtherCostsPremiums",
- a.sy_export_other_costs_premiums as "syExportOtherCostsPremiums",
- a.no_export_other_costs_premiums as "noExportOtherCostsPremiums",
- a.second_detail_premiums as "willAmount"
- FROM
- ins_fee_order_new a
- LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
- left join ins_orders o ON o.orderno=iac.orderno
- <where>
- a.ins_order_no NOT IN ( SELECT ins_order_no FROM ins_fee_audit )
- and iac.orderstatus = '3'
- <if test="userId!=null and userId!= ''">
- AND a.two_level_user_id = #{userId}
- </if>
- </where>
- ) AS fee
- </select>
- <select id="getByUserIdAndOrderStatusAndNoCheckType"
- resultType="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
- select a.* from
- ins_fee_order_new a left join ins_area_company ins on a.ins_order_no=ins.id
- WHERE
- a.user_id = #{userId}
- and ins.orderstatus ='3'
- and a.ins_order_no
- <if test="type=='1'">
- not
- </if>
- in
- (select ins_order_no from ins_fee_audit)
- </select>
- <select id="getSumWillAmountGeneralizationNew"
- resultType="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
- SELECT
- fee.id,
- fee.userId,
- fee.signingTime,
- fee.licenseno,
- fee.jqExportSuperviseCostsPremiums,
- fee.syExportSuperviseCostsPremiums,
- fee.noExportSuperviseCostsPremiums,
- fee.jqExportOtherCostsPremiums,
- fee.syExportOtherCostsPremiums,
- fee.noExportOtherCostsPremiums,
- fee.willAmount
- FROM
- (
- SELECT
- a.ins_order_no as "id",
- a.user_id as "userId",
- iac.signing_time as "signingTime",
- o.licenseno as "licenseno",
- a.jq_export_supervise_costs_premiums as "jqExportSuperviseCostsPremiums",
- a.sy_export_supervise_costs_premiums as "syExportSuperviseCostsPremiums",
- a.no_export_supervise_costs_premiums as "noExportSuperviseCostsPremiums",
- a.jq_export_other_costs_premiums as "jqExportOtherCostsPremiums",
- a.sy_export_other_costs_premiums as "syExportOtherCostsPremiums",
- a.no_export_other_costs_premiums as "noExportOtherCostsPremiums",
- a.first_detail_premiums as "willAmount"
- FROM
- ins_fee_order_new a
- LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
- left join ins_orders o ON o.orderno=iac.orderno
- <where>
- <if test='type == "1"'>
- NOT
- </if>
- EXISTS (SELECT ins_order_no FROM ins_fee_audit fee where fee.ins_order_no =a.ins_order_no)
- and iac.orderstatus = '3'
- <if test="userId!=null and userId!= ''">
- AND a.first_level_user_id = #{userId}
- </if>
- <if test="timeFiltering!= null and timeFiltering !=''">
- <choose>
- <when test='type == "1"'>
- AND DATE_FORMAT(iac.signing_time, '%Y-%m' ) = #{timeFiltering}
- </when>
- <otherwise>
- AND DATE_FORMAT(iac.signing_time, '%Y-%m-%d' ) = #{timeFiltering}
- </otherwise>
- </choose>
- </if>
- </where>
- UNION
- SELECT
- a.ins_order_no as "id",
- a.user_id as "userId",
- iac.signing_time as "signingTime",
- o.licenseno as "licenseno",
- a.jq_export_supervise_costs_premiums as "jqExportSuperviseCostsPremiums",
- a.sy_export_supervise_costs_premiums as "syExportSuperviseCostsPremiums",
- a.no_export_supervise_costs_premiums as "noExportSuperviseCostsPremiums",
- a.jq_export_other_costs_premiums as "jqExportOtherCostsPremiums",
- a.sy_export_other_costs_premiums as "syExportOtherCostsPremiums",
- a.no_export_other_costs_premiums as "noExportOtherCostsPremiums",
- a.third_detail_premiums as "willAmount"
- FROM
- ins_fee_order_new a
- LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
- left join ins_orders o ON o.orderno=iac.orderno
- <where>
- <if test='type == "1"'>
- NOT
- </if>
- EXISTS (SELECT ins_order_no FROM ins_fee_audit fee where fee.ins_order_no =a.ins_order_no)
- and iac.orderstatus = '3'
- <if test="userId!=null and userId!= ''">
- AND a.three_level_user_id = #{userId}
- </if>
- <if test="timeFiltering!= null and timeFiltering !=''">
- <choose>
- <when test='type == "1"'>
- AND DATE_FORMAT(iac.signing_time, '%Y-%m' ) = #{timeFiltering}
- </when>
- <otherwise>
- AND DATE_FORMAT(iac.signing_time, '%Y-%m' ) = #{timeFiltering}
- </otherwise>
- </choose>
- </if>
- </where>
- UNION
- SELECT
- a.ins_order_no as "id",
- a.user_id as "userId",
- iac.signing_time as "signingTime",
- o.licenseno as "licenseno",
- a.jq_export_supervise_costs_premiums as "jqExportSuperviseCostsPremiums",
- a.sy_export_supervise_costs_premiums as "syExportSuperviseCostsPremiums",
- a.no_export_supervise_costs_premiums as "noExportSuperviseCostsPremiums",
- a.jq_export_other_costs_premiums as "jqExportOtherCostsPremiums",
- a.sy_export_other_costs_premiums as "syExportOtherCostsPremiums",
- a.no_export_other_costs_premiums as "noExportOtherCostsPremiums",
- a.second_detail_premiums as "willAmount"
- FROM
- ins_fee_order_new a
- LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
- left join ins_orders o ON o.orderno=iac.orderno
- <where>
- <if test='type == "1"'>
- NOT
- </if>
- EXISTS (SELECT ins_order_no FROM ins_fee_audit fee where fee.ins_order_no =a.ins_order_no)
- and iac.orderstatus = '3'
- <if test="userId!=null and userId!= ''">
- AND a.two_level_user_id = #{userId}
- </if>
- <if test="timeFiltering!= null and timeFiltering !=''">
- <choose>
- <when test='type == "1"'>
- AND DATE_FORMAT(iac.signing_time, '%Y-%m' ) = #{timeFiltering}
- </when>
- <otherwise>
- AND DATE_FORMAT(iac.signing_time, '%Y-%m' ) = #{timeFiltering}
- </otherwise>
- </choose>
- </if>
- </where>
- ) AS fee
- </select>
- <select id="getSumWillAmountNew" resultType="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
- select
- a.ins_order_no as "id",
- a.user_id as "userId",
- ins.signing_time as "signingTime",
- o.licenseno as "licenseno",
- a.jq_export_supervise_costs_premiums as "jqExportSuperviseCostsPremiums",
- a.sy_export_supervise_costs_premiums as "syExportSuperviseCostsPremiums",
- a.no_export_supervise_costs_premiums as "noExportSuperviseCostsPremiums",
- a.jq_export_other_costs_premiums as "jqExportOtherCostsPremiums",
- a.sy_export_other_costs_premiums as "syExportOtherCostsPremiums",
- a.no_export_other_costs_premiums as "noExportOtherCostsPremiums"
- from
- ins_fee_order_new a left join ins_area_company ins on a.ins_order_no=ins.id
- left join ins_orders o ON o.orderno=ins.orderno
- <where>
- <if test="userId !=null and userId !=''">
- a.user_id = #{userId}
- </if>
- and ins.orderstatus ='3'
- and
- <if test='type == "1"'>
- NOT
- </if>
- EXISTS (SELECT ins_order_no FROM ins_fee_audit fee where fee.ins_order_no =a.ins_order_no)
- <if test="timeFiltering!= null and timeFiltering !=''">
- <choose>
- <when test='type == "1"'>
- AND DATE_FORMAT(ins.signing_time, '%Y-%m' ) = #{timeFiltering}
- </when>
- <otherwise>
- AND DATE_FORMAT(ins.signing_time, '%Y-%m' ) = #{timeFiltering}
- </otherwise>
- </choose>
- </if>
- <if test="amountType !=null and amountType !='' and amountType == 3 ">
- and (a.first_level_user_id is not null or a.two_level_user_id is not null or a.three_level_user_id is not null )
- </if>
- </where>
- </select>
- </mapper>
|