| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <?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.ins.dao.InsSettleDetailMapper">
- <resultMap id="BaseResultMap" type="com.ydtech.modules.ins.model.InsSettleDetail">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="settleno" jdbcType="VARCHAR" property="settleno"/>
- <result column="policyno" jdbcType="VARCHAR" property="policyno"/>
- <result column="commission" jdbcType="DECIMAL" property="commission"/>
- <result column="checkflag" jdbcType="CHAR" property="checkflag"/>
- </resultMap>
- <sql id="Base_Column_List">
- id, settleno, policyno, commission, checkflag
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List"/>
- from ins_settle_detail
- where id = #{id,jdbcType=BIGINT}
- </select>
- <select id="selectSettleDetail" parameterType="com.ydtech.modules.ins.model.vo.InsSettleReqVo"
- resultType="com.ydtech.modules.ins.model.vo.PolicynoDetailResVo">
- SELECT
- b.id id,
- b.settleno settleno,
- b.policyno policyno,
- c.riskcode riskcode,
- c.riskname riskname,
- a.insurercode inscompany,
- e.name inscompanyname,
- c.comcode teamcode,
- f.name teamname,
- IF(SUBSTR(c.comcode, 1, 5) like '%D%',
- (select aa.name from sys_dept aa where aa.parent_id ='100' and aa.id=c.comcode),
- (select aa.name from sys_dept aa where aa.parent_id ='100' and aa.id=(SUBSTR(c.comcode, 1, 5)))) comname,
- IF(SUBSTR(c.comcode, 1, 5) like '%D%', c.comcode, SUBSTR(c.comcode, 1, 5)) comcode,
- c.updatedate updatedate,
- c.commissionrate commissionrate,
- b.commission commission,
- c.sumpremium sumpremium,
- c.notaxpremium notaxpremium,
- b.checkflag checkflag,
- c.operatedate operatedate,
- c.startdate startdate,
- c.applicode applicode,
- c.appliname appliname,
- c.insuredcode insuredcode,
- c.insuredname insuredname
- FROM
- ins_settle_detail b
- LEFT JOIN ins_settle a ON a.settleno = b.settleno
- LEFT JOIN ins_cmain c ON b.policyno = c.policyno
- LEFT JOIN esm_product d ON d.id = c.riskcode
- LEFT JOIN esm_ins_company e ON a.insurercode = e.id
- LEFT JOIN sys_dept f ON f.id=c.comcode
- WHERE
- 1 = 1
- <if test="settleno != null and settleno != ''">
- AND b.settleno = #{settleno,jdbcType=VARCHAR}
- </if>
- <if test="insurercode != null and insurercode != ''">
- AND a.insurercode = #{insurercode,jdbcType=VARCHAR}
- </if>
- <if test="createdate != null">
- AND DATE_FORMAT(a.createdate, '%Y-%m-%d') = DATE_FORMAT(#{createdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
- </if>
- <if test="createcode != null and createcode != ''">
- AND a.createcode = #{createcode,jdbcType=VARCHAR}
- </if>
- <if test="confirmdate != null">
- AND DATE_FORMAT(a.confirmdate, '%Y-%m-%d') = DATE_FORMAT(#{confirmdate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
- </if>
- <if test="confirmcode != null and confirmcode != ''">
- AND a.confirmcode = #{confirmcode,jdbcType=VARCHAR}
- </if>
- <if test="checkno != null and checkno != ''">
- AND a.checkno = #{checkno,jdbcType=VARCHAR}
- </if>
- <if test="status != null and status != ''">
- AND a.status = #{status,jdbcType=VARCHAR}
- </if>
- <if test="account != null and account != ''">
- AND a.account = #{account,jdbcType=VARCHAR}
- </if>
- <if test="origCommno != null and origCommno != ''">
- AND a.orig_commno = #{origCommno,jdbcType=VARCHAR}
- </if>
- <if test="updatedate != null">
- AND DATE_FORMAT(a.updatedate, '%Y-%m-%d') = DATE_FORMAT(#{updatedate,jdbcType=TIMESTAMP}, '%Y-%m-%d')
- </if>
- <if test="checkflag != null and checkflag != ''">
- AND b.checkflag = #{checkflag,jdbcType=CHAR}
- </if>
- ORDER BY b.id asc
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
- delete
- from ins_settle_detail
- where id = #{id,jdbcType=BIGINT}
- </delete>
- <insert id="insert" parameterType="com.ydtech.modules.ins.model.InsSettleDetail">
- insert into ins_settle_detail (id, settleno, policyno,
- commission, checkflag)
- values (#{id,jdbcType=BIGINT}, #{settleno,jdbcType=VARCHAR}, #{policyno,jdbcType=VARCHAR},
- #{commission,jdbcType=DECIMAL}, #{checkflag,jdbcType=CHAR})
- </insert>
- <insert id="insertSelective" parameterType="com.ydtech.modules.ins.model.InsSettleDetail">
- insert into ins_settle_detail
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="settleno != null">
- settleno,
- </if>
- <if test="policyno != null">
- policyno,
- </if>
- <if test="commission != null">
- commission,
- </if>
- <if test="checkflag != null">
- checkflag,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=BIGINT},
- </if>
- <if test="settleno != null">
- #{settleno,jdbcType=VARCHAR},
- </if>
- <if test="policyno != null">
- #{policyno,jdbcType=VARCHAR},
- </if>
- <if test="commission != null">
- #{commission,jdbcType=DECIMAL},
- </if>
- <if test="checkflag != null">
- #{checkflag,jdbcType=CHAR},
- </if>
- </trim>
- </insert>
- <insert id="batchInsert" parameterType="list">
- insert into ins_settle_detail (
- <include refid="Base_Column_List"/>
- )
- values
- <foreach collection="insSettleDetailList" item="item" separator=",">
- (#{item.id}, #{item.settleno}, #{item.policyno}, #{item.commission}, #{item.checkflag})
- </foreach>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.ydtech.modules.ins.model.InsSettleDetail">
- update ins_settle_detail
- <set>
- <if test="settleno != null">
- settleno = #{settleno,jdbcType=VARCHAR},
- </if>
- <if test="policyno != null">
- policyno = #{policyno,jdbcType=VARCHAR},
- </if>
- <if test="commission != null">
- commission = #{commission,jdbcType=DECIMAL},
- </if>
- <if test="checkflag != null">
- checkflag = #{checkflag,jdbcType=CHAR},
- </if>
- </set>
- where id = #{id,jdbcType=BIGINT}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.ydtech.modules.ins.model.InsSettleDetail">
- update ins_settle_detail
- set settleno = #{settleno,jdbcType=VARCHAR},
- policyno = #{policyno,jdbcType=VARCHAR},
- commission = #{commission,jdbcType=DECIMAL},
- checkflag = #{checkflag,jdbcType=CHAR}
- where id = #{id,jdbcType=BIGINT}
- </update>
- </mapper>
|