|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <?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.WxCouponCarMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCouponCar">
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
- <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
- <result column="park_id" jdbcType="BIGINT" property="parkId" />
- <result column="vendor_type" jdbcType="INTEGER" property="vendorType" />
- <result column="vendor_params" jdbcType="VARCHAR" property="vendorParams" />
- <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`,`park_id`,`vendor_type`,`vendor_params`,`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 != parkId ">
- and `park_id` = #{parkId}
-
- </if>
-
- <if test=" null != vendorType ">
- and `vendor_type` = #{vendorType}
-
- </if>
-
- <if test=" null != vendorParams ">
- and `vendor_params` like concat('%', #{vendorParams},'%')
-
- </if>
-
- <if test=" null != createDate ">
- and `create_date` = #{createDate}
-
- </if>
-
- <if test=" null != updateDate ">
- and `update_date` = #{updateDate}
-
- </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.WxCouponCar" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_coupon_car
- <include refid="dynamicWhereConditions" />
- </select>
-
- <select id="findTemplateAmtCount" parameterType="Long" resultType="Integer">
- select IFNULL(sum(c.inventory),0) as count
- from wx_coupon_car car, wx_coupon c
- where car.id = c.id
- and c.status = 0
- and json_extract(car.vendor_params,'$.id') = ${value}
- </select>
-
- <select id="findAmtCountForCouponOrderTakeOff" parameterType="Long" resultType="Integer">
- select count(co.id) as id_count
- from wx_coupon_order co, wx_coupon c, wx_coupon_car car
- where 1=1
- and c.id = co.coupon_id
- and (co.coupon_order_status = 0 or co.coupon_order_status = 1)
- and c.status = 1
- and car.id = c.id
- and json_extract(car.vendor_params,'$.id') = ${value}
- </select>
-
- <select id="findTemplateAvailCount" parameterType="Long" resultType="Integer">
- select IFNULL(sum(c.remain_inventory),0) as count
- from wx_coupon_car car, wx_coupon c
- where car.id = c.id
- and c.status = 0
- and json_extract(vendor_params,'$.id') = ${value}
- </select>
-
- <resultMap id="CouponCarMap" type="com.iformall.domain.vo.WxCouponCarVo">
- <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="type" jdbcType="INTEGER" property="type" />
- <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
- <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture" />
- <result column="title" jdbcType="VARCHAR" property="title" />
- <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
- <result column="sale_price" jdbcType="INTEGER" property="salePrice" />
- <result column="use_price" jdbcType="INTEGER" property="usePrice" />
- <result column="use_limit_rule" jdbcType="INTEGER" property="useLimitRule" />
- <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity" />
- <result column="send_type" jdbcType="INTEGER" property="sendType" />
- <result column="valid_type" jdbcType="INTEGER" property="validType" />
- <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" />
- <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate" />
- <result column="valid_days" jdbcType="INTEGER" property="validDays" />
- <result column="detail" jdbcType="VARCHAR" property="detail" />
- <result column="price" jdbcType="INTEGER" property="price" />
- <result column="unit" jdbcType="INTEGER" property="unit" />
- <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory" />
- <result column="inventory" jdbcType="INTEGER" property="inventory" />
- <result column="remark" jdbcType="VARCHAR" property="remark" />
- <result column="status" jdbcType="INTEGER" property="status" />
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
- <result column="business" jdbcType="VARCHAR" property="business" />
- <result column="credit_price" jdbcType="INTEGER" property="creditPrice" />
- <result column="content_type" jdbcType="INTEGER" property="contentType"/>
-
- <result column="vendor_type" jdbcType="INTEGER" property="vendorType" />
- <result column="vendor_params" jdbcType="VARCHAR" property="vendorParams" />
- </resultMap>
-
- <sql id="CouponCarColumns">
- c.id,c.tenant_id,c.parent_tenant_id,c.type,c.cover_img,c.cover_picture,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_rule,c.use_limit_quantity,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business,
- car.vendor_type, car.vendor_params,c.credit_price, c.`auto_refund`, c.content_type
- </sql>
- <select id="findVoDetail" parameterType="java.lang.Long" resultMap="CouponCarMap">
- select
- <include refid="CouponCarColumns"/>
- from
- wx_coupon c,wx_coupon_car car
- where c.id = car.id
- and c.id = #{id}
- </select>
-
-
- </mapper>
|