| New file | 
|  |  |  | 
|---|
|  |  |  | <?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.dy.pipIrrGlobal.daoSe.SeVcRefundItemMapper"> | 
|---|
|  |  |  | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | <!--@Table se_vc_refund_item--> | 
|---|
|  |  |  | <id column="id" jdbcType="BIGINT" property="id" /> | 
|---|
|  |  |  | <result column="refund_id" jdbcType="BIGINT" property="refundId" /> | 
|---|
|  |  |  | <result column="order_number" jdbcType="VARCHAR" property="orderNumber" /> | 
|---|
|  |  |  | <result column="refund_number" jdbcType="VARCHAR" property="refundNumber" /> | 
|---|
|  |  |  | <result column="refund_amount" jdbcType="INTEGER" property="refundAmount" /> | 
|---|
|  |  |  | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | 
|---|
|  |  |  | <result column="refund_time" jdbcType="TIMESTAMP" property="refundTime" /> | 
|---|
|  |  |  | <result column="refund_status" jdbcType="TINYINT" property="refundStatus" /> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <sql id="Base_Column_List"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | id, refund_id, order_number, refund_number, refund_amount, create_time, refund_time, | 
|---|
|  |  |  | refund_status | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | <include refid="Base_Column_List" /> | 
|---|
|  |  |  | from se_vc_refund_item | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | delete from se_vc_refund_item | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into se_vc_refund_item (id, refund_id, order_number, | 
|---|
|  |  |  | refund_number, refund_amount, create_time, | 
|---|
|  |  |  | refund_time, refund_status) | 
|---|
|  |  |  | values (#{id,jdbcType=BIGINT}, #{refundId,jdbcType=BIGINT}, #{orderNumber,jdbcType=VARCHAR}, | 
|---|
|  |  |  | #{refundNumber,jdbcType=VARCHAR}, #{refundAmount,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | #{refundTime,jdbcType=TIMESTAMP}, #{refundStatus,jdbcType=TINYINT}) | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into se_vc_refund_item | 
|---|
|  |  |  | <trim prefix="(" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | id, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="refundId != null"> | 
|---|
|  |  |  | refund_id, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="orderNumber != null"> | 
|---|
|  |  |  | order_number, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="refundNumber != null"> | 
|---|
|  |  |  | refund_number, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="refundAmount != null"> | 
|---|
|  |  |  | refund_amount, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="createTime != null"> | 
|---|
|  |  |  | create_time, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="refundTime != null"> | 
|---|
|  |  |  | refund_time, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="refundStatus != null"> | 
|---|
|  |  |  | refund_status, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | #{id,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="refundId != null"> | 
|---|
|  |  |  | #{refundId,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="orderNumber != null"> | 
|---|
|  |  |  | #{orderNumber,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="refundNumber != null"> | 
|---|
|  |  |  | #{refundNumber,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="refundAmount != null"> | 
|---|
|  |  |  | #{refundAmount,jdbcType=INTEGER}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="createTime != null"> | 
|---|
|  |  |  | #{createTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="refundTime != null"> | 
|---|
|  |  |  | #{refundTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="refundStatus != null"> | 
|---|
|  |  |  | #{refundStatus,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | update se_vc_refund_item | 
|---|
|  |  |  | <set> | 
|---|
|  |  |  | <if test="refundId != null"> | 
|---|
|  |  |  | refund_id = #{refundId,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="orderNumber != null"> | 
|---|
|  |  |  | order_number = #{orderNumber,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="refundNumber != null"> | 
|---|
|  |  |  | refund_number = #{refundNumber,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="refundAmount != null"> | 
|---|
|  |  |  | refund_amount = #{refundAmount,jdbcType=INTEGER}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="createTime != null"> | 
|---|
|  |  |  | create_time = #{createTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="refundTime != null"> | 
|---|
|  |  |  | refund_time = #{refundTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="refundStatus != null"> | 
|---|
|  |  |  | refund_status = #{refundStatus,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </set> | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | update se_vc_refund_item | 
|---|
|  |  |  | set refund_id = #{refundId,jdbcType=BIGINT}, | 
|---|
|  |  |  | order_number = #{orderNumber,jdbcType=VARCHAR}, | 
|---|
|  |  |  | refund_number = #{refundNumber,jdbcType=VARCHAR}, | 
|---|
|  |  |  | refund_amount = #{refundAmount,jdbcType=INTEGER}, | 
|---|
|  |  |  | create_time = #{createTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | refund_time = #{refundTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | refund_status = #{refundStatus,jdbcType=TINYINT} | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据订单号获取最后一个退单号--> | 
|---|
|  |  |  | <select id="getLastRefundNumber" resultType="java.lang.String"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | refund_number AS refundNumber | 
|---|
|  |  |  | FROM se_vc_refund_item | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test = "orderNumber != null"> | 
|---|
|  |  |  | AND order_number = #{orderNumber} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | ORDER BY refund_number DESC | 
|---|
|  |  |  | LIMIT 0,1 | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据退款通知接口返回的退款单号反查退款ID,查询该退款ID下未退款记录数量--> | 
|---|
|  |  |  | <select id="getNoRefundedCount" resultType="java.lang.Integer"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | COUNT(*) AS recordCount | 
|---|
|  |  |  | FROM se_vc_refund_item | 
|---|
|  |  |  | WHERE refund_id = (SELECT refund_id FROM se_vc_refund_item WHERE refund_number = #{refundNumber}) AND refund_status = 1 | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据退款单号获取退款ID,退款通知后更新退款表所需--> | 
|---|
|  |  |  | <select id="getRefundIdByRefundNumber" resultType="java.lang.Long"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | refund_id AS refundId | 
|---|
|  |  |  | FROM se_vc_refund_item | 
|---|
|  |  |  | WHERE refund_number = #{refundNumber} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </mapper> | 
|---|