|
- <?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.WxOrderMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxOrder">
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="order_number" jdbcType="BIGINT" property="orderNumber" />
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
- <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
- <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
- <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
- <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
- <result column="payment_type" jdbcType="INTEGER" property="paymentType" />
- <result column="payment" jdbcType="INTEGER" property="payment" />
- <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime" />
- <result column="order_status" jdbcType="INTEGER" property="orderStatus" />
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
- <result column="detail" jdbcType="VARCHAR" property="detail" />
- </resultMap>
-
- <sql id="allColumns">
- `id`,`order_number`,`tenant_id`,`c_user_id`,`merchant_id`,`b_user_id`,`payment_type`,`payment`,`payment_time`,`order_status`,`create_date`,`update_date`,`detail`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1 = 1
-
- <if test=" null != id ">
- and `id` = #{id}
-
- </if>
-
- <if test=" null != orderNumber ">
- and `order_number` = #{orderNumber}
-
- </if>
-
- <if test=" null != tenantId ">
- and `tenant_id` = #{tenantId}
-
- </if>
-
- <if test=" null != cUserId ">
- and `c_user_id` = #{cUserId}
-
- </if>
-
- <if test=" null != merchantId ">
- and `merchant_id` = #{merchantId}
-
- </if>
-
- <if test=" null != bUserId ">
- and `b_user_id` = #{bUserId}
-
- </if>
-
- <if test=" null != couponId ">
- and `coupon_id` = #{couponId}
-
- </if>
-
- <if test=" null != paymentType ">
- and `payment_type` = #{paymentType}
-
- </if>
-
- <if test=" null != payment ">
- and `payment` = #{payment}
-
- </if>
-
- <if test=" null != paymentTime ">
- and `payment_time` = #{paymentTime}
-
- </if>
-
- <if test=" null != orderStatus ">
- and `order_status` = #{orderStatus}
-
- </if>
-
- <if test=" null != createDate ">
- and `create_date` = #{createDate}
-
- </if>
-
- <if test=" null != updateDate ">
- and `update_date` = #{updateDate}
-
- </if>
-
- <if test=" null != detail ">
- and `detail` like concat('%', #{detail},'%')
-
- </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.WxOrder" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_order
- <include refid="dynamicWhereConditions" />
- </select>
-
- <select id="countList" parameterType="com.iformall.domain.po.WxOrder" resultType="java.lang.Integer">
- select count(*) from wx_order
- <include refid="dynamicWhereConditions" />
- </select>
-
- <select id="dayCountList" parameterType="com.iformall.domain.po.WxOrder" resultType="java.lang.Integer">
- select count(*) from wx_order
- where 1=1
- <if test=" null != tenantId ">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != cUserId ">
- and `c_user_id` = #{cUserId}
- </if>
- <if test=" null != couponId ">
- and `coupon_id` = #{couponId}
- </if>
- <if test=" null != orderStatus ">
- and `order_status` = #{orderStatus}
- </if>
- and `create_date` between date_sub(now(),interval 1 day) and now()
- </select>
-
- <select id="findListOfUnpaidOrderByDate" parameterType="map" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_order
- where order_status = '0'
- <if test="startDate != null">
- AND create_date > #{startDate,jdbcType=TIMESTAMP}
- </if>
- <if test="endDate != null">
- AND create_date < #{endDate,jdbcType=TIMESTAMP}
- </if>
- </select>
-
-
- <sql id="allCUserOrderListColumns">
- o.id,o.order_number,o.tenant_id,o.c_user_id,o.merchant_id,o.b_user_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date,
- co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,
- m.name
- </sql>
-
- <sql id="allCUserOrderDetailColumns">
- o.id,o.order_number,o.tenant_id,o.c_user_id,o.merchant_id,o.b_user_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date,
- co.type,co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,co.detail,co.remark,
- m.img_url,m.name,m.link_phone,m.status,
- s.addr,s.shop_number,s.baidu_poi,
- mb.building_name,mf.floor_name,
- c.id as coupon_order_id,c.coupon_order_status
- </sql>
-
- <resultMap id="CVoResultMap" type="com.iformall.domain.vo.WxOrderCVo">
-
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="order_number" jdbcType="BIGINT" property="orderNumber" />
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
- <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
- <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
- <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
- <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
- <result column="payment_type" jdbcType="INTEGER" property="paymentType" />
- <result column="payment" jdbcType="INTEGER" property="payment" />
- <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime" />
- <result column="order_status" jdbcType="INTEGER" property="orderStatus" />
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
-
- <result column="type" jdbcType="INTEGER" property="type" />
- <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="sale_price" jdbcType="INTEGER" property="salePrice" />
- <result column="use_price" jdbcType="INTEGER" property="usePrice" />
- <result column="detail" jdbcType="VARCHAR" property="detail" />
- <result column="price" jdbcType="INTEGER" property="price" />
- <result column="remark" jdbcType="VARCHAR" property="remark" />
-
- <result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId" />
- <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
-
- <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl" />
- <result column="name" jdbcType="VARCHAR" property="merchantName" />
- <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone" />
- <result column="status" jdbcType="VARCHAR" property="merchantStatus" />
-
- <result column="addr" jdbcType="VARCHAR" property="addr"/>
- <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
- <result column="building_name" jdbcType="VARCHAR" property="buildingName" />
- <result column="floor_name" jdbcType="VARCHAR" property="floorName" />
- <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
- </resultMap>
-
-
- <select id="findListOfCUser" parameterType="com.iformall.domain.po.WxOrder" resultMap="CVoResultMap">
- select <include refid="allCUserOrderListColumns" />
- from wx_order o,wx_coupon co,wx_merchant m
- where o.coupon_id = co.id
- and co.merchant_id = m.id
- <if test="cUserId != null">
- and o.c_user_id = #{cUserId}
- </if>
- <if test="tenantId != null">
- and o.tenant_id = #{tenantId}
- </if>
- <if test="orderStatus != null">
- AND o.order_status = #{orderStatus}
- </if>
- <if test=" null != sortColumns"> order by ${sortColumns} </if>
- </select>
-
- <select id="selectDetailOfCUser" parameterType="com.iformall.domain.po.WxOrder" resultMap="CVoResultMap">
- select <include refid="allCUserOrderDetailColumns" />
- from (wx_order o,wx_coupon co,wx_merchant m)
- left join wx_coupon_order c on o.id = c.order_id
- left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0
- left join wx_shop s on ms.shop_id = s.id
- left join wx_mall_building mb on s.building = mb.id
- left join wx_mall_floor mf on s.floor = mf.id
- where o.coupon_id = co.id
- and co.merchant_id = m.id
- <if test="cUserId != null">
- and o.c_user_id = #{cUserId}
- </if>
- <if test="tenantId != null">
- and o.tenant_id = #{tenantId}
- </if>
- <if test="id != null">
- and o.id = #{id}
- </if>
-
- </select>
-
-
- </mapper>
|