|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <?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.WxCardTransferInfoMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCardTransferInfo">
- <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="coupon_order_id" jdbcType="BIGINT" property="couponOrderId" />
- <result column="title" jdbcType="VARCHAR" property="title" />
- <result column="amount" jdbcType="INTEGER" property="amount" />
- <result column="remain_amount" jdbcType="INTEGER" property="remainAmount" />
- <result column="from_user" jdbcType="BIGINT" property="fromUser" />
- <result column="to_user" jdbcType="BIGINT" property="toUser" />
- <result column="status" jdbcType="INTEGER" property="status" />
- <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
-
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`coupon_order_id`,`title`,`amount`,`remain_amount`,`from_user`,`to_user`,`status`,`expired_time`,
- `create_date`,`update_date`
- </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 != couponOrderId ">
- and `coupon_order_id` = #{couponOrderId}
- </if>
-
- <if test=" null != fromUser ">
- and `from_user` = #{fromUser}
- </if>
-
- <if test=" null != toUser ">
- and `to_user` = #{toUser}
- </if>
-
- <if test=" null != status ">
- and `status` = #{status}
- </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="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_card_transfer_info where id = #{id} and tenant_id=#{tenantId}
- </select>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxCardTransferInfo" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_card_transfer_info
- <include refid="dynamicWhereConditions" />
- </select>
-
-
- <resultMap id="CCardVoResultMap" type="com.iformall.domain.vo.WxCardCVo">
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
- <result column="parent_tenant_id" jdbcType="BIGINT" property="parentTenantId" />
- <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
- <result column="coupon_type" jdbcType="INTEGER" property="couponType" />
- <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
- <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
- <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
- <result column="title" jdbcType="VARCHAR" property="title" />
- <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
- <result column="detail" jdbcType="VARCHAR" property="detail" />
- <result column="unit" jdbcType="INTEGER" property="unit" />
- <result column="remark" jdbcType="VARCHAR" property="remark" />
- <result column="amount" jdbcType="INTEGER" property="amount" />
- <result column="remaining_amount" jdbcType="INTEGER" property="remainingAmount" />
- <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/>
- </resultMap>
- <select id="findCardListOfCUser" parameterType="com.iformall.domain.vo.WxCardCVo" resultMap="CCardVoResultMap">
- select id,tenant_id,parent_tenant_id,0 coupon_id,0 coupon_type,expired_time,`status`as coupon_order_status,create_date,update_date,
- '' cover_img,title,'' sub_title,'' detail,0 unit,'' remark,amount,remain_amount as remaining_amount,0 support_transfer
- from wx_card_transfer_info where from_user = #{ownerId} and `tenant_id` = #{tenantId}
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <choose>
- <when test="couponOrderStatus != null">
- and status = #{couponOrderStatus}
- </when>
- <otherwise>
- and status=8
- </otherwise>
- </choose>
- </select>
-
-
- <update id="cardDefer" parameterType="map">
- update wx_card_transfer_info set expired_time = #{expiredTime},update_date=now() where coupon_order_id in
- <foreach collection="couponOrderIds" index="index" item="sItem" open="(" separator="," close=")">
- #{sItem}
- </foreach>
- </update>
- </mapper>
|