| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634 |
- <?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.goafanti.common.dao.JtOrderMapper">
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.JtOrder">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jul 18 08:33:51 CST 2018.
- -->
- <id column="order_no" jdbcType="VARCHAR" property="orderNo" />
- <result column="order_time" jdbcType="TIMESTAMP" property="orderTime" />
- <result column="aid" jdbcType="VARCHAR" property="aid" />
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
- <result column="buyer_id" jdbcType="VARCHAR" property="buyerId" />
- <result column="seller_id" jdbcType="VARCHAR" property="sellerId" />
- <result column="order_amount" jdbcType="DECIMAL" property="orderAmount" />
- <result column="pay_amount" jdbcType="DECIMAL" property="payAmount" />
- <result column="refund_amount" jdbcType="DECIMAL" property="refundAmount" />
- <result column="pay_type" jdbcType="INTEGER" property="payType" />
- <result column="order_status" jdbcType="INTEGER" property="orderStatus" />
- <result column="order_channel" jdbcType="INTEGER" property="orderChannel" />
- <result column="order_remarks" jdbcType="VARCHAR" property="orderRemarks" />
- <result column="delete_sign" jdbcType="INTEGER" property="deleteSign" />
- </resultMap>
- <sql id="Example_Where_Clause">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jul 18 08:33:51 CST 2018.
- -->
- <where>
- <foreach collection="oredCriteria" item="criteria" separator="or">
- <if test="criteria.valid">
- <trim prefix="(" prefixOverrides="and" suffix=")">
- <foreach collection="criteria.criteria" item="criterion">
- <choose>
- <when test="criterion.noValue">
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue">
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue">
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue">
- and ${criterion.condition}
- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Update_By_Example_Where_Clause">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jul 18 08:33:51 CST 2018.
- -->
- <where>
- <foreach collection="example.oredCriteria" item="criteria" separator="or">
- <if test="criteria.valid">
- <trim prefix="(" prefixOverrides="and" suffix=")">
- <foreach collection="criteria.criteria" item="criterion">
- <choose>
- <when test="criterion.noValue">
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue">
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue">
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue">
- and ${criterion.condition}
- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Base_Column_List">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jul 18 08:33:51 CST 2018.
- -->
- order_no, order_time, aid, update_time, buyer_id, seller_id, order_amount, pay_amount,
- refund_amount, pay_type, order_status, order_channel, order_remarks, delete_sign
- </sql>
- <select id="selectByExample" parameterType="com.goafanti.common.model.JtOrderExample" resultMap="BaseResultMap">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jul 18 08:33:51 CST 2018.
- -->
- select
- <if test="distinct">
- distinct
- </if>
- <include refid="Base_Column_List" />
- from jt_order
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- <if test="orderByClause != null">
- order by ${orderByClause}
- </if>
- </select>
- <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jul 18 08:33:51 CST 2018.
- -->
- select
- <include refid="Base_Column_List" />
- from jt_order
- where order_no = #{orderNo,jdbcType=VARCHAR}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jul 18 08:33:51 CST 2018.
- -->
- delete from jt_order
- where order_no = #{orderNo,jdbcType=VARCHAR}
- </delete>
- <delete id="deleteByExample" parameterType="com.goafanti.common.model.JtOrderExample">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jul 18 08:33:51 CST 2018.
- -->
- delete from jt_order
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- </delete>
- <insert id="insert" parameterType="com.goafanti.common.model.JtOrder">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jul 18 08:33:51 CST 2018.
- -->
- insert into jt_order (order_no, order_time, aid,
- update_time, buyer_id, seller_id,
- order_amount, pay_amount, refund_amount,
- pay_type, order_status, order_channel,
- order_remarks, delete_sign)
- values (#{orderNo,jdbcType=VARCHAR}, #{orderTime,jdbcType=TIMESTAMP}, #{aid,jdbcType=VARCHAR},
- #{updateTime,jdbcType=TIMESTAMP}, #{buyerId,jdbcType=VARCHAR}, #{sellerId,jdbcType=VARCHAR},
- #{orderAmount,jdbcType=DECIMAL}, #{payAmount,jdbcType=DECIMAL}, #{refundAmount,jdbcType=DECIMAL},
- #{payType,jdbcType=INTEGER}, #{orderStatus,jdbcType=INTEGER}, #{orderChannel,jdbcType=INTEGER},
- #{orderRemarks,jdbcType=VARCHAR}, #{deleteSign,jdbcType=INTEGER})
- </insert>
- <insert id="insertSelective" parameterType="com.goafanti.common.model.JtOrder">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jul 18 08:33:51 CST 2018.
- -->
- insert into jt_order
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="orderNo != null">
- order_no,
- </if>
- <if test="orderTime != null">
- order_time,
- </if>
- <if test="aid != null">
- aid,
- </if>
- <if test="updateTime != null">
- update_time,
- </if>
- <if test="buyerId != null">
- buyer_id,
- </if>
- <if test="sellerId != null">
- seller_id,
- </if>
- <if test="orderAmount != null">
- order_amount,
- </if>
- <if test="payAmount != null">
- pay_amount,
- </if>
- <if test="refundAmount != null">
- refund_amount,
- </if>
- <if test="payType != null">
- pay_type,
- </if>
- <if test="orderStatus != null">
- order_status,
- </if>
- <if test="orderChannel != null">
- order_channel,
- </if>
- <if test="orderRemarks != null">
- order_remarks,
- </if>
- <if test="deleteSign != null">
- delete_sign,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="orderNo != null">
- #{orderNo,jdbcType=VARCHAR},
- </if>
- <if test="orderTime != null">
- #{orderTime,jdbcType=TIMESTAMP},
- </if>
- <if test="aid != null">
- #{aid,jdbcType=VARCHAR},
- </if>
- <if test="updateTime != null">
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="buyerId != null">
- #{buyerId,jdbcType=VARCHAR},
- </if>
- <if test="sellerId != null">
- #{sellerId,jdbcType=VARCHAR},
- </if>
- <if test="orderAmount != null">
- #{orderAmount,jdbcType=DECIMAL},
- </if>
- <if test="payAmount != null">
- #{payAmount,jdbcType=DECIMAL},
- </if>
- <if test="refundAmount != null">
- #{refundAmount,jdbcType=DECIMAL},
- </if>
- <if test="payType != null">
- #{payType,jdbcType=INTEGER},
- </if>
- <if test="orderStatus != null">
- #{orderStatus,jdbcType=INTEGER},
- </if>
- <if test="orderChannel != null">
- #{orderChannel,jdbcType=INTEGER},
- </if>
- <if test="orderRemarks != null">
- #{orderRemarks,jdbcType=VARCHAR},
- </if>
- <if test="deleteSign != null">
- #{deleteSign,jdbcType=INTEGER},
- </if>
- </trim>
- </insert>
- <select id="countByExample" parameterType="com.goafanti.common.model.JtOrderExample" resultType="java.lang.Long">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jul 18 08:33:51 CST 2018.
- -->
- select count(*) from jt_order
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- </select>
- <update id="updateByExampleSelective" parameterType="map">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jul 18 08:33:51 CST 2018.
- -->
- update jt_order
- <set>
- <if test="record.orderNo != null">
- order_no = #{record.orderNo,jdbcType=VARCHAR},
- </if>
- <if test="record.orderTime != null">
- order_time = #{record.orderTime,jdbcType=TIMESTAMP},
- </if>
- <if test="record.aid != null">
- aid = #{record.aid,jdbcType=VARCHAR},
- </if>
- <if test="record.updateTime != null">
- update_time = #{record.updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="record.buyerId != null">
- buyer_id = #{record.buyerId,jdbcType=VARCHAR},
- </if>
- <if test="record.sellerId != null">
- seller_id = #{record.sellerId,jdbcType=VARCHAR},
- </if>
- <if test="record.orderAmount != null">
- order_amount = #{record.orderAmount,jdbcType=DECIMAL},
- </if>
- <if test="record.payAmount != null">
- pay_amount = #{record.payAmount,jdbcType=DECIMAL},
- </if>
- <if test="record.refundAmount != null">
- refund_amount = #{record.refundAmount,jdbcType=DECIMAL},
- </if>
- <if test="record.payType != null">
- pay_type = #{record.payType,jdbcType=INTEGER},
- </if>
- <if test="record.orderStatus != null">
- order_status = #{record.orderStatus,jdbcType=INTEGER},
- </if>
- <if test="record.orderChannel != null">
- order_channel = #{record.orderChannel,jdbcType=INTEGER},
- </if>
- <if test="record.orderRemarks != null">
- order_remarks = #{record.orderRemarks,jdbcType=VARCHAR},
- </if>
- <if test="record.deleteSign != null">
- delete_sign = #{record.deleteSign,jdbcType=INTEGER},
- </if>
- </set>
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByExample" parameterType="map">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jul 18 08:33:51 CST 2018.
- -->
- update jt_order
- set order_no = #{record.orderNo,jdbcType=VARCHAR},
- order_time = #{record.orderTime,jdbcType=TIMESTAMP},
- aid = #{record.aid,jdbcType=VARCHAR},
- update_time = #{record.updateTime,jdbcType=TIMESTAMP},
- buyer_id = #{record.buyerId,jdbcType=VARCHAR},
- seller_id = #{record.sellerId,jdbcType=VARCHAR},
- order_amount = #{record.orderAmount,jdbcType=DECIMAL},
- pay_amount = #{record.payAmount,jdbcType=DECIMAL},
- refund_amount = #{record.refundAmount,jdbcType=DECIMAL},
- pay_type = #{record.payType,jdbcType=INTEGER},
- order_status = #{record.orderStatus,jdbcType=INTEGER},
- order_channel = #{record.orderChannel,jdbcType=INTEGER},
- order_remarks = #{record.orderRemarks,jdbcType=VARCHAR},
- delete_sign = #{record.deleteSign,jdbcType=INTEGER}
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.JtOrder">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jul 18 08:33:51 CST 2018.
- -->
- update jt_order
- <set>
- <if test="orderTime != null">
- order_time = #{orderTime,jdbcType=TIMESTAMP},
- </if>
- <if test="aid != null">
- aid = #{aid,jdbcType=VARCHAR},
- </if>
- <if test="updateTime != null">
- update_time = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="buyerId != null">
- buyer_id = #{buyerId,jdbcType=VARCHAR},
- </if>
- <if test="sellerId != null">
- seller_id = #{sellerId,jdbcType=VARCHAR},
- </if>
- <if test="orderAmount != null">
- order_amount = #{orderAmount,jdbcType=DECIMAL},
- </if>
- <if test="payAmount != null">
- pay_amount = #{payAmount,jdbcType=DECIMAL},
- </if>
- <if test="refundAmount != null">
- refund_amount = #{refundAmount,jdbcType=DECIMAL},
- </if>
- <if test="payType != null">
- pay_type = #{payType,jdbcType=INTEGER},
- </if>
- <if test="orderStatus != null">
- order_status = #{orderStatus,jdbcType=INTEGER},
- </if>
- <if test="orderChannel != null">
- order_channel = #{orderChannel,jdbcType=INTEGER},
- </if>
- <if test="orderRemarks != null">
- order_remarks = #{orderRemarks,jdbcType=VARCHAR},
- </if>
- <if test="deleteSign != null">
- delete_sign = #{deleteSign,jdbcType=INTEGER},
- </if>
- </set>
- where order_no = #{orderNo,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.JtOrder">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jul 18 08:33:51 CST 2018.
- -->
- update jt_order
- set order_time = #{orderTime,jdbcType=TIMESTAMP},
- aid = #{aid,jdbcType=VARCHAR},
- update_time = #{updateTime,jdbcType=TIMESTAMP},
- buyer_id = #{buyerId,jdbcType=VARCHAR},
- seller_id = #{sellerId,jdbcType=VARCHAR},
- order_amount = #{orderAmount,jdbcType=DECIMAL},
- pay_amount = #{payAmount,jdbcType=DECIMAL},
- refund_amount = #{refundAmount,jdbcType=DECIMAL},
- pay_type = #{payType,jdbcType=INTEGER},
- order_status = #{orderStatus,jdbcType=INTEGER},
- order_channel = #{orderChannel,jdbcType=INTEGER},
- order_remarks = #{orderRemarks,jdbcType=VARCHAR},
- delete_sign = #{deleteSign,jdbcType=INTEGER}
- where order_no = #{orderNo,jdbcType=VARCHAR}
- </update>
- <select id="searchJtOrderList" resultType="com.goafanti.order.bo.JtOrderResultDetail">
- select
- jto.order_no as orderNo,
- jtod.commodity_type as commodityType,
- jto.order_time as createTime,
- jto.order_amount as orderAmount,
- jtod.commodity_quantity as commodityQuantity,
- jtod.commodity_name as commodityName,
- jto.seller_id as sellerId,
- jto.buyer_id as buyerId,
- seller.identify_name as sellerName,
- buyer.identify_name as buyerName,
- seller.mobile as sellerMobile,
- jtod.commodity_id as commodityId,
- buyer.mobile as buyerMobile
- from jt_order jto
- left join jt_order_detail jtod on jtod.order_no=jto.order_no
- left join user seller on seller.id = jto.seller_id
- left join user buyer on buyer.id=jto.buyer_id
- where 1=1
- <if test="sellerId!=null">
- and jto.seller_id=#{sellerId,jdbcType=VARCHAR}
- </if>
- <if test="buyerId!=null">
- and jto.buyer_id=#{buyerId,jdbcType=VARCHAR}
- </if>
- <if test="sellerName!=null">
- and ((seller.identify_name is not null and seller.identify_name like concat("%",#{sellerName,jdbcType=VARCHAR},"%")) or (seller.identify_name is null and #{sellerName,jdbcType=VARCHAR}=''))
- </if>
- <if test="buyerName!=null">
- and (( buyer.identify_name is not null and buyer.identify_name like concat("%",#{buyerName,jdbcType=VARCHAR},"%")) or (buyer.identify_name is null and #{buyerName,jdbcType=VARCHAR}=''))
- </if>
- <if test="orderNo!=null">
- and jto.order_no like concat("%",#{orderNo,jdbcType=VARCHAR},"%")
- </if>
- <if test="commodityName!=null">
- and jtod.commodity_name like concat("%",#{commodityName,jdbcType=VARCHAR},"%")
- </if>
- <if test="startCreateDate!=null">
- and jto.order_time <![CDATA[ >= ]]> #{startCreateDate,jdbcType=TIMESTAMP}
- </if>
- <if test="endCreateDate!=null">
- and jto.order_time <![CDATA[ <= ]]> #{endCreateDate,jdbcType=TIMESTAMP}
- </if>
- <if test="orderType!=null ">
- and (jtod.commodity_type=#{orderType,jdbcType=INTEGER} or (#{orderType,jdbcType=INTEGER}=10 and (jtod.commodity_type=1 or jtod.commodity_type=0)))
- </if>
- order by jto.order_time desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
-
- <select id="searchJtOrderListCount" resultType="java.lang.Integer">
- select
- count(0)
- from jt_order jto
- left join jt_order_detail jtod on jtod.order_no=jto.order_no
- left join user seller on seller.id = jto.seller_id
- left join user buyer on buyer.id=jto.buyer_id
- where 1=1
- <if test="sellerId!=null">
- and jto.seller_id=#{sellerId,jdbcType=VARCHAR}
- </if>
- <if test="buyerId!=null">
- and jto.buyer_id=#{buyerId,jdbcType=VARCHAR}
- </if>
- <if test="sellerName!=null">
- and ((seller.identify_name is not null and seller.identify_name like concat("%",#{sellerName,jdbcType=VARCHAR},"%")) or (seller.identify_name is null and #{sellerName,jdbcType=VARCHAR}=''))
- </if>
- <if test="buyerName!=null">
- and (( buyer.identify_name is not null and buyer.identify_name like concat("%",#{buyerName,jdbcType=VARCHAR},"%")) or (buyer.identify_name is null and #{buyerName,jdbcType=VARCHAR}=''))
- </if>
- <if test="orderNo!=null">
- and jto.order_no like concat("%",#{orderNo,jdbcType=VARCHAR},"%")
- </if>
- <if test="commodityName!=null">
- and jtod.commodity_name like concat("%",#{commodityName,jdbcType=VARCHAR},"%")
- </if>
- <if test="startCreateDate!=null">
- and jto.order_time <![CDATA[ >= ]]> #{startCreateDate,jdbcType=TIMESTAMP}
- </if>
- <if test="endCreateDate!=null">
- and jto.order_time <![CDATA[ <= ]]> #{endCreateDate,jdbcType=TIMESTAMP}
- </if>
- <if test="orderType!=null ">
- and (jtod.commodity_type=#{orderType,jdbcType=INTEGER} or (#{orderType,jdbcType=INTEGER}=10 and (jtod.commodity_type=1 or jtod.commodity_type=0)))
- </if>
- <!-- order by x.createTime desc -->
- <!-- <if test="page_sql!=null">
- ${page_sql}
- </if> -->
- </select>
- <select id="appSearchJtOrderList" resultType="com.goafanti.order.bo.JtOrderResultDetail">
- select x.* from
- (select jto.order_no as orderNo,
- jtod.commodity_type as commodityType,
- jto.order_time as createTime,
- jto.order_amount as orderAmount,
- jtod.commodity_quantity as commodityQuantity,
- jtod.commodity_name as commodityName,
- jto.seller_id as sellerId,
- jto.buyer_id as buyerId,
- seller.nickname as sellerName,
- buyer.nickname as buyerName,
- seller.mobile as sellerMobile,
- jtod.commodity_id as commodityId,
- buyer.mobile as buyerMobile from jt_order jto
- left join jt_order_detail jtod on jtod.order_no=jto.order_no
- left join user seller on seller.id = jto.seller_id
- left join user buyer on buyer.id=jto.buyer_id
- where 1=1
- <if test="sellerId!=null">
- and jto.seller_id=#{sellerId,jdbcType=VARCHAR}
- </if>
- <if test="buyerId!=null">
- and jto.buyer_id=#{buyerId,jdbcType=VARCHAR}
- </if>
- UNION all
- select jco.order_no as orderNo ,
- (case when jco.consult_type = 0 then 6 when jco.consult_type = 1 then 5 end) as commodityType,
- jco.order_time as createTime,
- jco.order_amount as orderAmount,
- 1 as commodityQuantity,
- (case when jco.consult_type = 0 then '专家咨询' when jco.consult_type = 1 then '顾问咨询' end) as commodityName,
- jco.seller_id as sellerId,
- jco.buyer_id as buyerId,
- seller.nickname as sellerName,
- buyer.nickname as buyerName,
- seller.mobile as sellerMobile,
- jco.seller_id as commodityId,
- buyer.mobile as buyerMobile
- from jt_consult_order jco
- left join user seller on seller.id = jco.seller_id
- left join user buyer on buyer.id=jco.buyer_id
- where 1=1
- <if test="sellerId!=null">
- and jco.seller_id=#{sellerId,jdbcType=VARCHAR}
- </if>
- <if test="buyerId!=null">
- and jco.buyer_id=#{buyerId,jdbcType=VARCHAR}
- </if>
- ) x
- where 1=1
- <if test="orderType!=null ">
- and (x.commodityType=#{orderType,jdbcType=INTEGER} or (#{orderType,jdbcType=INTEGER}=10 and (x.commodityType=1 or x.commodityType=0)))
- </if>
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="appSearchJtOrderListCount" resultType="java.lang.Integer">
- select count(x.commodityType) from
- (select jto.order_no as orderNo,
- jtod.commodity_type as commodityType,
- jto.order_time as createTime,
- jto.order_amount as orderAmount,
- jtod.commodity_quantity as commodityQuantity,
- jtod.commodity_name as commodityName,
- jto.seller_id as sellerId,
- jto.buyer_id as buyerId,
- seller.identify_name as sellerName,
- buyer.identify_name as buyerName,
- seller.mobile as sellerMobile,
- jtod.commodity_id as commodityId,
- buyer.mobile as buyerMobile from jt_order jto
- left join jt_order_detail jtod on jtod.order_no=jto.order_no
- left join user seller on seller.id = jto.seller_id
- left join user buyer on buyer.id=jto.buyer_id
- where 1=1
- <if test="sellerId!=null">
- and jto.seller_id=#{sellerId,jdbcType=VARCHAR}
- </if>
- <if test="buyerId!=null">
- and jto.buyer_id=#{buyerId,jdbcType=VARCHAR}
- </if>
- UNION all
- select jco.order_no as orderNo ,
- (case when jco.consult_type = 0 then 6 when jco.consult_type = 1 then 5 end) as commodityType,
- jco.order_time as createTime,
- jco.order_amount as orderAmount,
- 1 as commodityQuantity,
- (case when jco.consult_type = 0 then '专家咨询' when jco.consult_type = 1 then '顾问咨询' end) as commodityName,
- jco.seller_id as sellerId,
- jco.buyer_id as buyerId,
- seller.identify_name as sellerName,
- buyer.identify_name as buyerName,
- seller.mobile as sellerMobile,
- jco.seller_id as commodityId,
- buyer.mobile as buyerMobile
- from jt_consult_order jco
- left join user seller on seller.id = jco.seller_id
- left join user buyer on buyer.id=jco.buyer_id
- where 1=1
- <if test="sellerId!=null">
- and jco.seller_id=#{sellerId,jdbcType=VARCHAR}
- </if>
- <if test="buyerId!=null">
- and jco.buyer_id=#{buyerId,jdbcType=VARCHAR}
- </if>
- ) x
- where 1=1
- <if test="orderType!=null ">
- and (x.commodityType=#{orderType,jdbcType=INTEGER} or (#{orderType,jdbcType=INTEGER}=10 and (x.commodityType=1 or x.commodityType=0)))
- </if>
- </select>
- </mapper>
|