Files
gxtyzx-java/modules/shop/mapper/xml/OrderMapper.xml
T
2024-08-13 17:51:18 +08:00

170 lines
6.6 KiB
XML

<?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.gxwebsoft.shop.mapper.OrderMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*, b.username as nickname, b.truename as realName
FROM shop_order a
LEFT JOIN shop_users b ON a.uid = b.id
<where>
<if test="param.orderId != null">
AND a.order_id = #{param.orderId}
</if>
<if test="param.type != null">
AND a.type = #{param.type}
</if>
<if test="param.orderNo != null">
AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%')
</if>
<if test="param.channel != null">
AND a.channel = #{param.channel}
</if>
<if test="param.transactionId != null">
AND a.transaction_id LIKE CONCAT('%', #{param.transactionId}, '%')
</if>
<if test="param.refundOrder != null">
AND a.refund_order LIKE CONCAT('%', #{param.refundOrder}, '%')
</if>
<if test="param.merchantId != null">
AND a.merchant_id = #{param.merchantId}
</if>
<if test="param.merchantName != null">
AND a.merchant_name LIKE CONCAT('%', #{param.merchantName}, '%')
</if>
<if test="param.merchantCode != null">
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
</if>
<if test="param.uid != null">
AND a.uid = #{param.uid}
</if>
<if test="param.cid != null">
AND a.cid = #{param.cid}
</if>
<if test="param.vid != null">
AND a.vid = #{param.vid}
</if>
<if test="param.aid != null">
AND a.aid = #{param.aid}
</if>
<if test="param.adminId != null">
AND a.admin_id = #{param.adminId}
</if>
<if test="param.code != null">
AND a.code LIKE CONCAT('%', #{param.code}, '%')
</if>
<if test="param.name != null">
AND a.name LIKE CONCAT('%', #{param.name}, '%')
</if>
<if test="param.phone != null">
AND a.phone LIKE CONCAT('%', #{param.phone}, '%')
</if>
<if test="param.totalPrice != null">
AND a.total_price = #{param.totalPrice}
</if>
<if test="param.reducePrice != null">
AND a.reduce_price = #{param.reducePrice}
</if>
<if test="param.payPrice != null">
AND a.pay_price = #{param.payPrice}
</if>
<if test="param.price != null">
AND a.price = #{param.price}
</if>
<if test="param.money != null">
AND a.money = #{param.money}
</if>
<if test="param.refundMoney != null">
AND a.refund_money = #{param.refundMoney}
</if>
<if test="param.coachPrice != null">
AND a.coach_price = #{param.coachPrice}
</if>
<if test="param.coachId != null">
AND a.coach_id = #{param.coachId}
</if>
<if test="param.payType != null">
AND a.pay_type = #{param.payType}
</if>
<if test="param.payStatus != null">
AND a.pay_status = #{param.payStatus}
</if>
<if test="param.orderStatus != null">
AND a.order_status = #{param.orderStatus}
</if>
<if test="param.couponType != null">
AND a.coupon_type = #{param.couponType}
</if>
<if test="param.qrcode != null">
AND a.qrcode LIKE CONCAT('%', #{param.qrcode}, '%')
</if>
<if test="param.couponDesc != null">
AND a.coupon_desc LIKE CONCAT('%', #{param.couponDesc}, '%')
</if>
<if test="param.returnNum != null">
AND a.return_num = #{param.returnNum}
</if>
<if test="param.returnMoney != null">
AND a.return_money = #{param.returnMoney}
</if>
<if test="param.startTime != null">
AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%')
</if>
<if test="param.isInvoice != null">
AND a.is_invoice = #{param.isInvoice}
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.payTime != null">
AND a.pay_time = #{param.payTime}
</if>
<if test="param.refundTime != null">
AND a.refund_time = #{param.refundTime}
</if>
<if test="param.refundApplyTime != null">
AND a.refund_apply_time = #{param.refundApplyTime}
</if>
<if test="param.expirationTime != null">
AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%')
</if>
<if test="param.checkBill != null">
AND a.check_bill = #{param.checkBill}
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.deleted != null">
AND a.deleted = #{param.deleted}
</if>
<if test="param.deleted == null">
AND a.deleted = 0
</if>
<if test="param.keywords != null">
AND (a.order_no = #{param.keywords}
OR a.order_id = #{param.keywords}
OR a.phone = #{param.keywords}
OR a.user_id = #{param.keywords}
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.shop.entity.Order">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.shop.entity.Order">
<include refid="selectSql"></include>
</select>
</mapper>