|
- <?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="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="transaction_id" jdbcType="VARCHAR" property="transactionId" />
- <result column="summary" jdbcType="VARCHAR" property="summary" />
-
- <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_summary" jdbcType="VARCHAR" property="refundSummary" />
- <result column="refund_time" jdbcType="TIMESTAMP" property="refundTime"/>
- <result column="refund_amount" jdbcType="INTEGER" property="refundAmount"/>
- <result column="refund_id" jdbcType="VARCHAR" property="refundId" />
-
- <result column="is_refund_points" jdbcType="TINYINT" property="isRefundPoints"/>
- <result column="refund_points_time" jdbcType="TIMESTAMP" property="refundPointsTime"/>
-
- </resultMap>
-
-
- <sql id="allColumns">
- `id`, `tenant_id`, `parent_tenant_id`, `source_app_id`, `shop_name`, `shop_number`,
- `user_phone`, `user_number`, `time_end`, `amount`, `transaction_id`, `summary`,
- `create_time`, `update_time`, `merchant_id`, `c_user_id`,
- `earn_points`, `increased_points`, `points_update_time`,
- `is_refund`, `refund_summary`, `refund_time`, `refund_amount`, `refund_id`,
- `is_refund_points`, `refund_points_time`
- </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 != 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 != 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 != isRefundPoints">
- and `is_refund_points` = #{isRefundPoints}
- </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="getByTransactionId" parameterType="com.iformall.domain.po.WxThirdPartyOrders" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_third_party_orders
- where `transaction_id` = #{transactionId}
- and tenant_id=#{tenantId}
- </select>
-
- <insert id="insertNoticeOrder" parameterType="com.iformall.domain.po.WxThirdPartyOrders" >
- INSERT INTO wx_business_circle_order (
- `id`, `tenant_id`, `parent_tenant_id`, `source_app_id`,`shop_name`, `shop_number`,
- `user_phone`, `user_number`, `time_end`, `amount`, `transaction_id`, `summary`,
- `create_time`, `update_time`, `merchant_id`, `c_user_id`, `earn_points`, `is_refund`
- )
- VALUES(
- #{id},#{tenantId},#{parentTenantId},#{sourceAppId},#{shopName},#{shopNumber},
- #{userPhone},#{userNumber},#{timeEnd},#{amount},#{transactionId},#{summary},
- #{createTime},#{updateTime}, #{merchantId},#{cUserId},0,0
- );
- </insert>
-
- <update id="updateAddPoints" parameterType="com.iformall.domain.po.WxThirdPartyOrders">
- update wx_business_circle_order 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>
-
- <update id="updateRefundNoticeOrder" parameterType="com.iformall.domain.po.WxThirdPartyOrders">
- update wx_business_circle_order set
- `is_refund` = 1, `refund_summary` = #{refundSummary},
- `refund_time` = #{refundTime}, `refund_amount` = #{refundAmount}, `refund_id` = #{refundId},
- `update_time` = #{updateTime}
- where `id` = #{id} and `tenant_id` = #{tenantId}
- </update>
-
- <update id="updateRefundPoints" parameterType="com.iformall.domain.po.WxThirdPartyOrders">
- update wx_business_circle_order set
- `is_refund_points` = 1, `refund_points_time` = #{refundPointsTime}, `update_time` = #{updateTime}
- where `id` = #{id} and `tenant_id` = #{tenantId}
- </update>
-
- </mapper>
|