154 lines
7.3 KiB
XML
154 lines
7.3 KiB
XML
<?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.bms.price.mapper.PrcBillingTaskMapper">
|
|
|
|
<resultMap type="PrcBillingTask" id="PrcBillingTaskResult">
|
|
<id property="taskId" column="task_id" />
|
|
<result property="transferNo" column="transfer_no" />
|
|
<result property="trackingNo" column="tracking_no" />
|
|
<result property="orderNo" column="order_no" />
|
|
<result property="customerCode" column="customer_code" />
|
|
<result property="billType" column="bill_type" />
|
|
<result property="successStatus" column="success_status" />
|
|
<result property="billTime" column="bill_time" />
|
|
<result property="billId" column="bill_id" />
|
|
<result property="failCode" column="fail_code" />
|
|
<result property="errorMessage" column="error_message" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
</resultMap>
|
|
|
|
<sql id="selectPrcBillingTaskVo">
|
|
select task_id, transfer_no, tracking_no, order_no, customer_code, bill_type, success_status,
|
|
bill_time, bill_id, fail_code, error_message, create_by, create_time, update_by, update_time
|
|
from prc_billing_task
|
|
</sql>
|
|
|
|
<select id="selectPrcBillingTaskById" parameterType="Long" resultMap="PrcBillingTaskResult">
|
|
<include refid="selectPrcBillingTaskVo"/>
|
|
where task_id = #{taskId}
|
|
</select>
|
|
|
|
<select id="selectPrcBillingTaskList" parameterType="PrcBillingTask" resultMap="PrcBillingTaskResult">
|
|
<include refid="selectPrcBillingTaskVo"/>
|
|
<where>
|
|
<if test="transferNo != null and transferNo != ''">
|
|
AND transfer_no like concat('%', #{transferNo}, '%')
|
|
</if>
|
|
<if test="trackingNo != null and trackingNo != ''">
|
|
AND tracking_no like concat('%', #{trackingNo}, '%')
|
|
</if>
|
|
<if test="orderNo != null and orderNo != ''">
|
|
AND order_no like concat('%', #{orderNo}, '%')
|
|
</if>
|
|
<if test="customerCode != null and customerCode != ''">
|
|
AND customer_code like concat('%', #{customerCode}, '%')
|
|
</if>
|
|
<if test="billType != null and billType != ''">
|
|
AND bill_type = #{billType}
|
|
</if>
|
|
<if test="successStatus != null and successStatus != ''">
|
|
AND success_status = #{successStatus}
|
|
</if>
|
|
<if test="failCode != null and failCode != ''">
|
|
AND fail_code = #{failCode}
|
|
</if>
|
|
<if test="params.beginTime != null and params.beginTime != ''">
|
|
AND date_format(bill_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d')
|
|
</if>
|
|
<if test="params.endTime != null and params.endTime != ''">
|
|
AND date_format(bill_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d')
|
|
</if>
|
|
</where>
|
|
order by task_id desc
|
|
</select>
|
|
|
|
<select id="countTaskIdsByFilter" parameterType="PrcBillingTask" resultType="int">
|
|
select count(1) from prc_billing_task
|
|
<where>
|
|
<if test="customerCode != null and customerCode != ''">
|
|
AND customer_code = #{customerCode}
|
|
</if>
|
|
<if test="successStatus != null and successStatus != ''">
|
|
AND success_status = #{successStatus}
|
|
</if>
|
|
<if test="params.beginTime != null and params.beginTime != ''">
|
|
AND date_format(bill_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d')
|
|
</if>
|
|
<if test="params.endTime != null and params.endTime != ''">
|
|
AND date_format(bill_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d')
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectTaskIdsByFilter" resultType="long">
|
|
select task_id from prc_billing_task
|
|
<where>
|
|
<if test="query.customerCode != null and query.customerCode != ''">
|
|
AND customer_code = #{query.customerCode}
|
|
</if>
|
|
<if test="query.successStatus != null and query.successStatus != ''">
|
|
AND success_status = #{query.successStatus}
|
|
</if>
|
|
<if test="query.params != null and query.params.beginTime != null and query.params.beginTime != ''">
|
|
AND date_format(bill_time,'%Y%m%d') >= date_format(#{query.params.beginTime},'%Y%m%d')
|
|
</if>
|
|
<if test="query.params != null and query.params.endTime != null and query.params.endTime != ''">
|
|
AND date_format(bill_time,'%Y%m%d') <= date_format(#{query.params.endTime},'%Y%m%d')
|
|
</if>
|
|
<if test="lastTaskId != null">
|
|
AND task_id > #{lastTaskId}
|
|
</if>
|
|
</where>
|
|
order by task_id asc
|
|
limit #{limit}
|
|
</select>
|
|
|
|
<insert id="insertPrcBillingTask" parameterType="PrcBillingTask" useGeneratedKeys="true" keyProperty="taskId">
|
|
insert into prc_billing_task (
|
|
transfer_no, tracking_no, order_no, customer_code, bill_type, success_status,
|
|
bill_time, bill_id, fail_code, error_message, create_by, create_time
|
|
) values (
|
|
#{transferNo}, #{trackingNo}, #{orderNo}, #{customerCode}, #{billType}, #{successStatus},
|
|
#{billTime}, #{billId}, #{failCode}, #{errorMessage}, #{createBy}, sysdate()
|
|
)
|
|
</insert>
|
|
|
|
<update id="updatePrcBillingTask" parameterType="PrcBillingTask">
|
|
update prc_billing_task
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="transferNo != null">transfer_no = #{transferNo},</if>
|
|
<if test="trackingNo != null">tracking_no = #{trackingNo},</if>
|
|
<if test="orderNo != null">order_no = #{orderNo},</if>
|
|
<if test="customerCode != null">customer_code = #{customerCode},</if>
|
|
<if test="billType != null">bill_type = #{billType},</if>
|
|
<if test="successStatus != null">success_status = #{successStatus},</if>
|
|
<if test="billTime != null">bill_time = #{billTime},</if>
|
|
<if test="billId != null">bill_id = #{billId},</if>
|
|
<if test="failCode != null">fail_code = #{failCode},</if>
|
|
<if test="errorMessage != null">error_message = #{errorMessage},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
update_time = sysdate()
|
|
</trim>
|
|
where task_id = #{taskId}
|
|
</update>
|
|
|
|
<!-- Keep inbound identity keys/bill_time; write status + optional customer_code snapshot. -->
|
|
<update id="updateBillingResult" parameterType="PrcBillingTask">
|
|
update prc_billing_task
|
|
set success_status = #{successStatus},
|
|
bill_id = #{billId},
|
|
fail_code = #{failCode},
|
|
error_message = #{errorMessage},
|
|
<if test="customerCode != null">
|
|
customer_code = #{customerCode},
|
|
</if>
|
|
update_time = sysdate()
|
|
where task_id = #{taskId}
|
|
</update>
|
|
</mapper>
|