|
- <?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.WxOrderGroupMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxOrderGroup">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="order_id" jdbcType="BIGINT" property="orderId"/>
- <result column="coupon_id" jdbcType="BIGINT" property="couponId"/>
- <result column="remain_people" jdbcType="INTEGER" property="remainPeople"/>
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="expired_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="status" jdbcType="SMALLINT" property="status"/>
- <result column="user_id" jdbcType="BIGINT" property="userId"/>
-
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`order_id`,`coupon_id`,`remain_people`,`create_date`,`update_date`,`expired_date`,`status`,`user_id`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1 = 1
- <if test=" null != id ">
- and `id` = #{id}
- </if>
- <if test=" null != tenantId ">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != orderId ">
- and `order_id` = #{orderId}
- </if>
- <if test=" null != userId ">
- and `coupon_id` = #{couponId}
- </if>
- <if test=" null != pressValue ">
- and `remain_people` = #{remainPeople}
- </if>
- <if test=" null != createDate ">
- and `create_date` = #{createDate}
- </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.WxOrderGroup" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_order_group
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="queryRemainOne" parameterType="com.iformall.domain.po.WxOrderGroup" resultType="hashmap">
-
- select o.press_end_date expiredDate,o.order_group_id orderGroupId,c.nick_name nickName,
- c.avatar_url avatarUrl,o.id orderId,o.product_id couponId
- from wx_order o
- left join wx_c_user c on o.c_user_id=c.id
- where o.tenant_id=#{tenantId} and o.id=#{orderId}
-
- </select>
-
- <select id="queryOrderGroup" parameterType="com.iformall.domain.po.WxOrder" resultType="hashmap">
-
- select o.id orderId,o.order_status orderStatus,o.order_group_id orderGroupId,c.title,c.sub_title subTitle,
- c.sale_price salePrice,c.cover_img coverImg,g.remain_people remainPeople,c.id couponId,g.expired_date
- expiredDate,g.status,g.user_id firstUser,u.nick_name nickName,u.avatar_url avatarUrl,o.tenant_id tenantId,
- cc.id couponChannelId,c.press_limit_num pressLimitNum,c.status couponStatus
- from wx_order o
- left join wx_coupon c on o.product_id=c.id
- left join wx_order_group g on o.order_group_id=g.id
- left join wx_c_user u on o.c_user_id=u.id
- left join wx_coupon_channel cc on c.id=cc.coupon_id
- where o.tenant_id=#{tenantId}
- <if test=" null != cUserId ">
- and o.c_user_id=#{cUserId} and o.order_status not in(0,1,2,3)
- </if>
- <if test=" null != id ">
- and o.id=#{id}
- </if>
- <if test=" null != orderGroupId ">
- and o.order_group_id=#{orderGroupId}
- </if>
- and o.order_group_id!=0 and g.status in(10,11,12,13)
- order by o.id desc,o.order_status
-
- </select>
-
-
- </mapper>
|