| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- <?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.inv.dao.InvSourceMapper">
- <resultMap id="BaseResultMap" type="com.ydtech.modules.inv.model.po.InvSource">
- <id property="insuranceId" column="insurance_id" jdbcType="BIGINT"/>
- <id property="id" column="id" jdbcType="BIGINT"/>
- <result property="insuranceName" column="insurance_name" jdbcType="VARCHAR"/>
- <result property="insuranceDept" column="insurance_dept" jdbcType="VARCHAR"/>
- <result property="insuranceDeptId" column="insurance_dept_id" jdbcType="BIGINT"/>
- <result property="risk" column="risk" jdbcType="VARCHAR"/>
- <result property="jqPolicyId" column="jq_policy_id" jdbcType="BIGINT"/>
- <result property="jqPremiumTax" column="jq_premium_tax" jdbcType="DECIMAL"/>
- <result property="jqPremium" column="jq_premium" jdbcType="DECIMAL"/>
- <result property="syPolicyId" column="sy_policy_id" jdbcType="BIGINT"/>
- <result property="syPremiumTax" column="sy_premium_tax" jdbcType="DECIMAL"/>
- <result property="syPremium" column="sy_premium" jdbcType="DECIMAL"/>
- <result property="nonCarPolicyId" column="non_car_policy_id" jdbcType="BIGINT"/>
- <result property="nonCarPremiumTax" column="non_car_premium_tax" jdbcType="DECIMAL"/>
- <result property="nonCarPremium" column="non_car_premium" jdbcType="DECIMAL"/>
- <result property="insuredName" column="insured_name" jdbcType="VARCHAR"/>
- <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
- <result property="signingTime" column="signing_time" jdbcType="TIMESTAMP"/>
- <result property="clearingTime" column="clearing_time" jdbcType="TIMESTAMP"/>
- <result property="taxamount" column="taxamount" jdbcType="DECIMAL"/>
- <result property="jqReceivableRatio" column="jq_receivable_ratio" jdbcType="INTEGER"/>
- <result property="jqPremiumRatio" column="jq_premium_ratio" jdbcType="INTEGER"/>
- <result property="jqNonCopyingRatio" column="jq_non_copying_ratio" jdbcType="INTEGER"/>
- <result property="syReceivableRatio" column="sy_receivable_ratio" jdbcType="INTEGER"/>
- <result property="syPremiumRatio" column="sy_premium_ratio" jdbcType="INTEGER"/>
- <result property="syNonCopyingRatio" column="sy_non_copying_ratio" jdbcType="INTEGER"/>
- <result property="nonCarReceivableRatio" column="non_car_receivable_ratio" jdbcType="INTEGER"/>
- <result property="nonCarPremiumRatio" column="non_car_premium_ratio" jdbcType="INTEGER"/>
- <result property="nonCarNonCopyingRatio" column="non_car_non_copying_ratio" jdbcType="INTEGER"/>
- <result property="premium" column="premium" jdbcType="DECIMAL"/>
- <result property="nonCopying" column="non_copying" jdbcType="DECIMAL"/>
- <result property="receivable" column="receivable" jdbcType="DECIMAL"/>
- <result property="maxJqReceivableRatio" column="max_jq_receivable_ratio" jdbcType="INTEGER"/>
- <result property="maxSyReceivableRatio" column="max_sy_receivable_ratio" jdbcType="INTEGER"/>
- <result property="maxNonCarReceivableRatio" column="max_non_car_receivable_ratio" jdbcType="INTEGER"/>
- <result property="maxReceivable" column="max_receivable" jdbcType="VARCHAR"/>
- <result property="clearingState" column="clearing_state" jdbcType="CHAR"/>
- </resultMap>
- <sql id="Base_Column_List">
- insurance_id,id,insurance_name,
- insurance_dept,insurance_dept_id,risk,
- jq_policy_id,jq_premium_tax,jq_premium,
- sy_policy_id,sy_premium_tax,sy_premium,
- non_car_policy_id,non_car_premium_tax,non_car_premium,
- insured_name,licenseno,signing_time,
- clearing_time,taxamount,jq_receivable_ratio,
- jq_premium_ratio,jq_non_copying_ratio,sy_receivable_ratio,
- sy_premium_ratio,sy_non_copying_ratio,non_car_receivable_ratio,
- non_car_premium_ratio,non_car_non_copying_ratio,premium,
- non_copying,receivable,max_jq_receivable_ratio,
- max_sy_receivable_ratio,max_non_car_receivable_ratio,max_receivable,
- clearing_state
- </sql>
- <update id="syncStatus">
- UPDATE inv_source ins
- JOIN inv_settlement_source iss ON ins.jq_policy_id = iss.jq_policy_id
- AND ins.sy_policy_id = iss.sy_policy_id
- AND ins.non_car_policy_id = iss.non_car_policy_id
- AND ins.licenseno = iss.licenseno
- SET ins.clearing_state = 1,
- ins.clearing_time = iss.agency_settlement_time;
- </update>
- <select id="dataMatching" resultType="HashMap">
- SELECT
- iss.licenseno
- FROM
- inv_settlement_source iss
- WHERE
- NOT EXISTS (
- SELECT
- ivs.licenseno
- FROM
- inv_source ivs
- WHERE
- ivs.licenseno = iss.licenseno
- )
- </select>
- <select id="getRecivablePage" resultType="com.ydtech.modules.inv.model.po.InvSource">
- select * from (select
- id,
- insurance_id,
- insurance_name,
- insurance_dept,
- insurance_dept_id,
- risk,
- jq_policy_id,
- jq_premium_tax,
- jq_premium,
- sy_policy_id,
- sy_premium_tax,
- sy_premium,
- non_car_policy_id,
- non_car_premium_tax,
- non_car_premium,
- insured_name,
- licenseno,
- signing_time,
- clearing_time,
- taxamount,
- jq_receivable_ratio,
- jq_premium_ratio,
- jq_non_copying_ratio,
- sy_receivable_ratio,
- sy_premium_ratio,
- sy_non_copying_ratio,
- non_car_receivable_ratio,
- non_car_premium_ratio,
- non_car_non_copying_ratio,
- premium,
- non_copying,
- receivable,
- subsidy_ratio,
- subsidy_amount,
- total_receivable_amount,
- max_jq_receivable_ratio,
- max_sy_receivable_ratio,
- max_non_car_receivable_ratio,
- max_receivable,
- CASE WHEN DATEDIFF(NOW(), signing_time) > 90 THEN 2 ELSE inv_source.clearing_state END as clearing_state,
- insurance_clearing_state
- from inv_source
- ) a
- where 1=1
- <if test="param.licenseno != null and param.licenseno != ''">
- and a.licenseno = #{param.licenseno}
- </if>
- <if test="param.jqPolicyId != null and param.jqPolicyId != ''">
- and a.jq_policy_id = #{param.jqPolicyId}
- </if>
- <if test="param.syPolicyId != null and param.syPolicyId != ''">
- and a.sy_policy_id = #{param.syPolicyId}
- </if>
- <if test="param.nonCarPolicyId != null and param.nonCarPolicyId != ''">
- and a.non_car_policy_id = #{param.nonCarPolicyId}
- </if>
- <if test="param.insuranceId != null and param.insuranceId != ''">
- and a.insurance_id = #{param.insuranceId}
- </if>
- <if test="param.risk != null and param.risk != ''">
- and a.risk = #{param.risk}
- </if>
- <if test="param.insuranceName != null and param.insuranceName != ''">
- and a.insurance_name = #{param.insuranceName}
- </if>
- <if test="param.clearingTimeStartTime != null and param.clearingTimeStartTime != ''">
- and a.clearing_time between #{param.clearingTimeStartTime} and #{param.clearingTimeEndTime]}
- </if>
- <if test="param.signingTimeStartTime != null and param.signingTimeStartTime != ''">
- and a.signing_time between #{param.signingTimeStartTime} and #{param.signingTimeEndTime}
- </if>
- <if test="param.insuranceDept != null and param.insuranceDept != ''">
- and a.insurance_dept = #{param.insuranceDept}
- </if>
- <if test="param.clearingState != null and param.clearingState != ''">
- and a.clearing_state = #{param.clearingState}
- </if>
- <if test="param.insuranceClearingState != null and param.insuranceClearingState != ''">
- and a.insurance_clearing_state = #{param.insuranceClearingState}
- </if>
- <if test="param.insuredName != null and param.insuredName != ''">
- and a.insured_name = #{insuredName}
- </if>
- </select>
- <select id="getRecivableList" resultType="com.ydtech.modules.inv.model.po.InvSource">
- select * from (select
- id,
- insurance_id,
- insurance_name,
- insurance_dept,
- insurance_dept_id,
- risk,
- jq_policy_id,
- jq_premium_tax,
- jq_premium,
- sy_policy_id,
- sy_premium_tax,
- sy_premium,
- non_car_policy_id,
- non_car_premium_tax,
- non_car_premium,
- insured_name,
- licenseno,
- signing_time,
- clearing_time,
- taxamount,
- jq_receivable_ratio,
- jq_premium_ratio,
- jq_non_copying_ratio,
- sy_receivable_ratio,
- sy_premium_ratio,
- sy_non_copying_ratio,
- non_car_receivable_ratio,
- non_car_premium_ratio,
- non_car_non_copying_ratio,
- premium,
- non_copying,
- receivable,
- subsidy_ratio,
- subsidy_amount,
- total_receivable_amount,
- max_jq_receivable_ratio,
- max_sy_receivable_ratio,
- max_non_car_receivable_ratio,
- max_receivable,
- CASE WHEN DATEDIFF(NOW(), signing_time) > 90 THEN 2 ELSE inv_source.clearing_state END as clearing_state,
- insurance_clearing_state
- from inv_source
- ) a
- where 1=1
- <if test="param.licenseno != null and param.licenseno != ''">
- and a.licenseno = #{param.licenseno}
- </if>
- <if test="param.jqPolicyId != null and param.jqPolicyId != ''">
- and a.jq_policy_id = #{param.jqPolicyId}
- </if>
- <if test="param.syPolicyId != null and param.syPolicyId != ''">
- and a.sy_policy_id = #{param.syPolicyId}
- </if>
- <if test="param.nonCarPolicyId != null and param.nonCarPolicyId != ''">
- and a.non_car_policy_id = #{param.nonCarPolicyId}
- </if>
- <if test="param.insuranceId != null and param.insuranceId != ''">
- and a.insurance_id = #{param.insuranceId}
- </if>
- <if test="param.risk != null and param.risk != ''">
- and a.risk = #{param.risk}
- </if>
- <if test="param.insuranceName != null and param.insuranceName != ''">
- and a.insurance_name = #{param.insuranceName}
- </if>
- <if test="param.clearingTimeStartTime != null and param.clearingTimeStartTime != ''">
- and a.clearing_time between #{param.clearingTimeStartTime} and #{param.clearingTimeEndTime]}
- </if>
- <if test="param.signingTimeStartTime != null and param.signingTimeStartTime != ''">
- and a.signing_time between #{param.signingTimeStartTime} and #{param.signingTimeEndTime}
- </if>
- <if test="param.insuranceDept != null and param.insuranceDept != ''">
- and a.insurance_dept = #{param.insuranceDept}
- </if>
- <if test="param.clearingState != null and param.clearingState != ''">
- and a.clearing_state = #{param.clearingState}
- </if>
- <if test="param.insuranceClearingState != null and param.insuranceClearingState != ''">
- and a.insurance_clearing_state = #{param.insuranceClearingState}
- </if>
- </select>
- </mapper>
|