|
|
|
@@ -1,203 +0,0 @@ |
|
|
|
<?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.iformall.mapper.WxThirdPartyOrdersMapper"> |
|
|
|
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxThirdPartyOrders"> |
|
|
|
<id column="id" jdbcType="BIGINT" property="id"/> |
|
|
|
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> |
|
|
|
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> |
|
|
|
|
|
|
|
<result column="source_app_id" jdbcType="VARCHAR" property="sourceAppId"/> |
|
|
|
<result column="source_type" jdbcType="INTEGER" property="sourceType"/> |
|
|
|
|
|
|
|
<result column="notice_id" jdbcType="VARCHAR" property="noticeId" /> |
|
|
|
<result column="notice_create_time" jdbcType="TIMESTAMP" property="noticeCreateTime"/> |
|
|
|
<result column="notice_event_type" jdbcType="VARCHAR" property="noticeEventType" /> |
|
|
|
<result column="notice_resource_type" jdbcType="VARCHAR" property="noticeResourceType" /> |
|
|
|
<result column="summary" jdbcType="VARCHAR" property="summary" /> |
|
|
|
|
|
|
|
<result column="shop_name" jdbcType="VARCHAR" property="shopName" /> |
|
|
|
<result column="shop_number" jdbcType="VARCHAR" property="shopNumber" /> |
|
|
|
<result column="user_phone" jdbcType="VARCHAR" property="userPhone" /> |
|
|
|
<result column="user_number" jdbcType="VARCHAR" property="userNumber" /> |
|
|
|
|
|
|
|
|
|
|
|
<result column="time_end" jdbcType="TIMESTAMP" property="timeEnd"/> |
|
|
|
<result column="amount" jdbcType="INTEGER" property="amount"/> |
|
|
|
<result column="pay_amount" jdbcType="INTEGER" property="payAmount"/> |
|
|
|
<result column="transaction_id" jdbcType="VARCHAR" property="transactionId" /> |
|
|
|
|
|
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> |
|
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> |
|
|
|
|
|
|
|
<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> |
|
|
|
<result column="c_user_id" jdbcType="BIGINT" property="cUserId"/> |
|
|
|
|
|
|
|
<result column="earn_points" jdbcType="TINYINT" property="earnPoints"/> |
|
|
|
<result column="increased_points" jdbcType="INTEGER" property="increasedPoints"/> |
|
|
|
<result column="points_update_time" jdbcType="TIMESTAMP" property="pointsUpdateTime"/> |
|
|
|
|
|
|
|
|
|
|
|
<result column="is_refund" jdbcType="TINYINT" property="isRefund"/> |
|
|
|
<result column="refund_id" jdbcType="VARCHAR" property="refundId" /> |
|
|
|
<result column="refund_amount" jdbcType="INTEGER" property="refundAmount"/> |
|
|
|
|
|
|
|
</resultMap> |
|
|
|
|
|
|
|
|
|
|
|
<sql id="allColumns"> |
|
|
|
`id`, `tenant_id`, `parent_tenant_id`, `source_app_id`, `source_type`,`notice_id`, `notice_create_time`, `notice_event_type`, |
|
|
|
`notice_resource_type`, `summary`,`shop_name`, `shop_number`, `user_phone`, `user_number`, |
|
|
|
`time_end`, `amount`, `pay_amount`, `transaction_id`, `create_time`, `update_time`, |
|
|
|
`merchant_id`, `c_user_id`, `earn_points`, `increased_points`, `points_update_time`, |
|
|
|
`is_refund`, `refund_id`, `refund_amount` |
|
|
|
</sql> |
|
|
|
|
|
|
|
<sql id="dynamicWhereConditions"> |
|
|
|
where 1 = 1 |
|
|
|
|
|
|
|
<if test=" null != id "> |
|
|
|
and `id` = #{id} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != tenantId and '' != tenantId"> |
|
|
|
and `tenant_id` = #{tenantId} |
|
|
|
</if> |
|
|
|
<if test=" null != parentTenantId and '' != parentTenantId"> |
|
|
|
and `parent_tenant_id` = #{parentTenantId} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != sourceAppId and '' != sourceAppId"> |
|
|
|
and `source_app_id` = #{sourceAppId} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != sourceType and '' != sourceType"> |
|
|
|
and `source_type` = #{sourceType} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != shopName "> |
|
|
|
and `shop_name` like concat('%', #{shopName},'%') |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != shopNumber and '' != shopNumber"> |
|
|
|
and `shop_number` = #{shopNumber} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != userPhone and '' != userPhone"> |
|
|
|
and `user_phone` = #{userPhone} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != userNumber and '' != userNumber"> |
|
|
|
and `user_number` = #{userNumber} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != noticeId and '' != noticeId"> |
|
|
|
and `notice_id` = #{noticeId} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != startTime "> |
|
|
|
and `time_end` >= #{startTime} |
|
|
|
</if> |
|
|
|
<if test=" null != endTime"> |
|
|
|
and `time_end` < #{endTime} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != transactionId and '' != transactionId"> |
|
|
|
and `transaction_id` = #{transactionId} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != merchantId "> |
|
|
|
and `merchant_id` = #{merchantId} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != cUserId "> |
|
|
|
and `c_user_id` = #{cUserId} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != earnPoints "> |
|
|
|
and `earn_points` = #{earnPoints} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != isRefund "> |
|
|
|
and `is_refund` = #{isRefund} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != refundId and '' != refundId"> |
|
|
|
and `refund_id` = #{refundId} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != ids "> |
|
|
|
and `id` in |
|
|
|
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> |
|
|
|
#{idItem} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test=" null != sortColumns">order by ${sortColumns}</if> |
|
|
|
</sql> |
|
|
|
|
|
|
|
<select id="findList" parameterType="com.iformall.domain.po.WxThirdPartyOrders" resultMap="BaseResultMap"> |
|
|
|
select |
|
|
|
<include refid="allColumns"/> |
|
|
|
from wx_third_party_orders |
|
|
|
<include refid="dynamicWhereConditions"/> |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="getById" parameterType="com.iformall.domain.po.WxThirdPartyOrders" resultMap="BaseResultMap"> |
|
|
|
select |
|
|
|
<include refid="allColumns"/> |
|
|
|
from wx_third_party_orders |
|
|
|
where `id` = #{id} |
|
|
|
and tenant_id=#{tenantId} |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="getOrderByTransactionId" parameterType="com.iformall.domain.po.WxThirdPartyOrders" resultMap="BaseResultMap"> |
|
|
|
select |
|
|
|
<include refid="allColumns"/> |
|
|
|
from wx_third_party_orders |
|
|
|
where `is_refund` = 0 |
|
|
|
and tenant_id = #{tenantId} |
|
|
|
and `transaction_id` = #{transactionId} |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="getRefundOrderByTransactionId" parameterType="com.iformall.domain.po.WxThirdPartyOrders" resultMap="BaseResultMap"> |
|
|
|
select |
|
|
|
<include refid="allColumns"/> |
|
|
|
from wx_third_party_orders |
|
|
|
where `is_refund` = 1 |
|
|
|
and tenant_id = #{tenantId} |
|
|
|
and `transaction_id` = #{transactionId} |
|
|
|
</select> |
|
|
|
|
|
|
|
<insert id="insertNoticeOrder" parameterType="com.iformall.domain.po.WxThirdPartyOrders" > |
|
|
|
INSERT INTO wx_third_party_orders ( |
|
|
|
`id`, `tenant_id`, `parent_tenant_id`,`source_app_id`, `source_type`, `notice_id`, `notice_create_time`, `notice_event_type`, |
|
|
|
`notice_resource_type`, `summary`, `shop_name`, `shop_number`, `user_phone`, `user_number`,`time_end`, `amount`, `pay_amount`, `transaction_id`, `commit_tag`, `create_time`, `update_time`, |
|
|
|
`merchant_id`, `c_user_id`, `earn_points`, `is_refund` |
|
|
|
) |
|
|
|
VALUES( |
|
|
|
#{id},#{tenantId},#{parentTenantId},#{sourceAppId},#{sourceType},#{noticeId},#{noticeCreateTime},#{noticeEventType}, |
|
|
|
#{noticeResourceType},#{summary},#{shopName},#{shopNumber},#{userPhone},#{userNumber},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{commitTag},#{createTime},#{updateTime}, |
|
|
|
#{merchantId},#{cUserId},0,0 |
|
|
|
); |
|
|
|
</insert> |
|
|
|
|
|
|
|
<update id="updatePoints" parameterType="com.iformall.domain.po.WxThirdPartyOrders"> |
|
|
|
update wx_third_party_orders set |
|
|
|
`earn_points` = 1, `increased_points` = #{increasedPoints}, `points_update_time` = #{pointsUpdateTime}, |
|
|
|
`is_refund_points` = 0, `update_time` = #{updateTime} |
|
|
|
where `id` = #{id} and `tenant_id` = #{tenantId} |
|
|
|
</update> |
|
|
|
|
|
|
|
<insert id="insertRefundNoticeOrder" parameterType="com.iformall.domain.po.WxThirdPartyOrders" > |
|
|
|
INSERT INTO wx_third_party_orders ( |
|
|
|
`id`, `tenant_id`, `parent_tenant_id`,`source_app_id`, `source_type`, `notice_id`, `notice_create_time`, `notice_event_type`, |
|
|
|
`notice_resource_type`, `summary`,`shop_name`, `shop_number`, `user_phone`, `user_number`, `time_end`, `amount`,`pay_amount`, `transaction_id`, `commit_tag`, `create_time`, `update_time`, |
|
|
|
`merchant_id`, `c_user_id`, `earn_points`, `is_refund`, `refund_id`, `refund_amount` |
|
|
|
) |
|
|
|
VALUES( |
|
|
|
#{id},#{tenantId},#{parentTenantId},#{sourceAppId},#{sourceType},#{noticeId},#{noticeCreateTime},#{noticeEventType}, |
|
|
|
#{noticeResourceType},#{summary},#{shopName},#{shopNumber},#{userPhone},#{userNumber},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{commitTag},#{createTime},#{updateTime}, |
|
|
|
#{merchantId},#{cUserId},0,1,#{refundId},#{refundAmount} |
|
|
|
); |
|
|
|
</insert> |
|
|
|
|
|
|
|
</mapper> |