|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- <?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.TtOrderMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.tt.TtOrder">
- <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="c_user_id" jdbcType="BIGINT" property="cUserId"/>
- <result column="product_id" jdbcType="BIGINT" property="productId"/>
- <result column="product_title" jdbcType="VARCHAR" property="productTitle"/>
- <result column="product_pic" jdbcType="VARCHAR" property="productPic"/>
- <result column="product_sale_price" jdbcType="INTEGER" property="productSalePrice"/>
- <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
-
- <result column="type" jdbcType="TINYINT" property="type"/>
- <result column="way" jdbcType="TINYINT" property="way"/>
- <result column="payment_type" jdbcType="INTEGER" property="paymentType"/>
- <result column="payment" jdbcType="INTEGER" property="payment"/>
- <result column="payment_time" jdbcType="VARCHAR" 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="is_recorded" jdbcType="INTEGER" property="isRecorded"/>
- <result column="recorded_date" jdbcType="TIMESTAMP" property="recordedDate"/>
-
-
- <result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
- <result column="phone" jdbcType="VARCHAR" property="phone"/>
- <result column="author" jdbcType="VARCHAR" property="author"/>
- <result column="author_pic" jdbcType="VARCHAR" property="authorPic"/>
- </resultMap>
-
- <sql id="allColumns">
- o.`id`,o.`tenant_id`,o.`parent_tenant_id`,o.`c_user_id`,o.`product_id`,o.`type`,o.`way`,o.`payment_type`,o.`payment`,
- o.`payment_time`,o.`order_status`,o.`create_date`,o.`update_date`,o.`is_recorded`,o.`recorded_date`,
- u.`nick_name`,u.`phone`,
- o.`product_title`,o.`product_pic`,o.`product_sale_price`,
- m.`name` author,m.`img_url` author_pic
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1 = 1
-
- <if test=" null != id ">
- and o.`id` = #{id}
- </if>
-
- <if test=" null != tenantId and '' != tenantId">
- and o.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and o.`parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != cUserId ">
- and o.`c_user_id` = #{cUserId}
- </if>
-
- <if test=" null != productId ">
- and o.`product_id` = #{productId}
- </if>
-
- <if test=" null != type ">
- and o.`type` = #{type}
- </if>
-
- <if test=" null != way ">
- and o.`way` = #{way}
- </if>
-
- <if test=" null != paymentType ">
- and o.`payment_type` = #{paymentType}
- </if>
-
- <if test="startdate != null">
- and o.`create_date` >= #{startdate}
- </if>
- <if test="enddate != null">
- and o.`create_date` <= #{enddate}
- </if>
-
- <if test=" null != orderStatus ">
- and o.`order_status` = #{orderStatus}
- </if>
-
- <if test=" null != isRecorded ">
- and o.`is_recorded` = #{isRecorded}
- </if>
-
- <if test=" null != nickName ">
- and u.`nick_name` like concat('%', #{nickName},'%')
- </if>
-
- <if test=" null != phone ">
- and u.`phone` like concat('%', #{phone},'%')
- </if>
-
- <if test=" null != productTitle ">
- and o.`product_title` like concat('%', #{productTitle},'%')
- </if>
-
- <if test=" null != merchantId ">
- and o.merchant_id = #{merchantId}
- </if>
-
- <if test=" null != author ">
- and m.`name` like concat('%', #{author},'%')
- </if>
-
- <if test=" null != statusS ">
- and o.`order_status` in
- <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")">
- #{sItem}
- </foreach>
- </if>
-
- <if test=" null != ids ">
- and o.`id` in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- order by o.`update_date` desc
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.tt.TtOrder" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from tt_order o
- left join tt_c_user u on o.c_user_id = u.id
- left join wx_merchant m on o.merchant_id = m.id
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="findCList" parameterType="com.iformall.domain.po.tt.TtOrder" resultMap="BaseResultMap">
- select
- <include refid="allColumnsC"/>
- from tt_order o
- left join wx_merchant m on o.merchant_id = m.id
- <include refid="dynamicWhereConditionsC"/>
- </select>
-
- <sql id="allColumnsC">
- o.`id`,o.`tenant_id`,o.`parent_tenant_id`,o.`c_user_id`,o.`product_id`,o.`type`,o.`way`,o.`payment_type`,o.`payment`,
- o.`payment_time`,o.`order_status`,o.`create_date`,o.`update_date`,
- o.`product_title`,o.`product_pic`,o.`product_sale_price`,
- m.`name` author,m.`img_url` author_pic
- </sql>
-
- <sql id="dynamicWhereConditionsC">
- where 1 = 1
-
- <if test=" null != id ">
- and o.`id` = #{id}
- </if>
-
- <if test=" null != tenantId and '' != tenantId">
- and o.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and o.`parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != cUserId ">
- and o.`c_user_id` = #{cUserId}
- </if>
-
- <if test=" null != productId ">
- and o.`product_id` = #{productId}
- </if>
-
- <if test=" null != productTitle ">
- and o.`product_title` like concat('%', #{productTitle},'%')
- </if>
-
- <if test=" null != type ">
- and o.`type` = #{type}
- </if>
-
- <if test=" null != way ">
- and o.`way` = #{way}
- </if>
-
- <if test=" null != paymentType ">
- and o.`payment_type` = #{paymentType}
- </if>
-
- <if test="startdate != null">
- and o.`create_date` >= #{startdate}
- </if>
- <if test="enddate != null">
- and o.`create_date` <= #{enddate}
- </if>
-
- <if test=" null != orderStatus ">
- and o.`order_status` = #{orderStatus}
- </if>
-
- <if test=" null != merchantId ">
- and o.merchant_id = #{merchantId}
- </if>
-
- <if test=" null != author ">
- and m.`name` like concat('%', #{author},'%')
- </if>
-
- <if test=" null != statusS ">
- and o.`order_status` in
- <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")">
- #{sItem}
- </foreach>
- </if>
-
- <if test=" null != ids ">
- and o.`id` in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- order by o.`update_date` desc
- </sql>
-
- <select id="findListCount" parameterType="com.iformall.domain.po.tt.TtOrder" resultType="Integer">
- select count(1)
- from tt_order
- where 1 = 1
- <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 != cUserId ">
- and `c_user_id` = #{cUserId}
- </if>
-
- <if test=" null != productId ">
- and `product_id` = #{productId}
- </if>
-
- <if test=" null != orderStatus ">
- and `order_status` = #{orderStatus}
- </if>
-
- <if test=" null != statusS ">
- and `order_status` in
- <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")">
- #{sItem}
- </foreach>
- </if>
- </select>
-
- <select id="findExpireIdList" parameterType="java.util.HashMap" resultType="com.iformall.domain.po.tt.TtOrder">
- select `id`,`tenant_id`,`parent_tenant_id`,order_status,create_date
- from tt_order
- where order_status=#{orderStatus} and create_date <= #{beforeDate}
- </select>
-
- <select id="findBeforeIdList" parameterType="java.util.HashMap" resultType="Long">
- select id
- from tt_order
- where order_status=#{orderStatus} and create_date <= #{beforeDate}
- <if test=" null != isRecorded ">
- and `is_recorded` = #{isRecorded}
- </if>
- </select>
-
- <update id="updateIsRecorded" parameterType="java.util.HashMap">
- update tt_order set `is_recorded` = #{isRecorded},recorded_date = now() where id = #{id}
- </update>
-
- </mapper>
|