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

136 lines
5.4 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.common.system.mapper.OrderMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM sys_order a
<where>
<if test="param.orderId != null">
AND a.order_id = #{param.orderId}
</if>
<if test="param.orderNo != null">
AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%')
</if>
<if test="param.type != null">
AND a.type = #{param.type}
</if>
<if test="param.money != null">
AND a.money = #{param.money}
</if>
<if test="param.payPrice != null">
AND a.pay_price = #{param.payPrice}
</if>
<if test="param.planId != null">
AND a.plan_id = #{param.planId}
</if>
<if test="param.priceId != null">
AND a.price_id = #{param.priceId}
</if>
<if test="param.gradeId != null">
AND a.grade_id = #{param.gradeId}
</if>
<if test="param.priceName != null">
AND a.price_name LIKE CONCAT('%', #{param.priceName}, '%')
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if>
<if test="param.memberId != null">
AND a.member_id = #{param.memberId}
</if>
<if test="param.realName != null">
AND a.real_name LIKE CONCAT('%', #{param.realName}, '%')
</if>
<if test="param.phone != null">
AND a.phone LIKE CONCAT('%', #{param.phone}, '%')
</if>
<if test="param.payTime != null">
AND a.pay_time LIKE CONCAT('%', #{param.payTime}, '%')
</if>
<if test="param.transactionId != null">
AND a.transaction_id LIKE CONCAT('%', #{param.transactionId}, '%')
</if>
<if test="param.payStatus != null">
AND a.pay_status = #{param.payStatus}
</if>
<if test="param.payMethod != null">
AND a.pay_method LIKE CONCAT('%', #{param.payMethod}, '%')
</if>
<if test="param.expirationTime != null">
AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%')
</if>
<if test="param.province != null">
AND a.province LIKE CONCAT('%', #{param.province}, '%')
</if>
<if test="param.city != null">
AND a.city LIKE CONCAT('%', #{param.city}, '%')
</if>
<if test="param.region != null">
AND a.region LIKE CONCAT('%', #{param.region}, '%')
</if>
<if test="param.area != null">
AND a.area LIKE CONCAT('%', #{param.area}, '%')
</if>
<if test="param.address != null">
AND a.address LIKE CONCAT('%', #{param.address}, '%')
</if>
<if test="param.refundImage != null">
AND a.refund_image LIKE CONCAT('%', #{param.refundImage}, '%')
</if>
<if test="param.refundContent != null">
AND a.refund_content LIKE CONCAT('%', #{param.refundContent}, '%')
</if>
<if test="param.isSettled != null">
AND a.is_settled = #{param.isSettled}
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.merchantId != null">
AND a.merchant_id = #{param.merchantId}
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</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.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.common.system.entity.Order">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.common.system.entity.Order">
<include refid="selectSql"></include>
</select>
<!-- 按OutTradeNo查询 -->
<select id="getByOutTradeNo" resultType="com.gxwebsoft.common.system.entity.Order">
<include refid="selectSql"></include>
</select>
<!-- 更新订单状态 -->
<select id="updateByOutTradeNo" resultType="com.gxwebsoft.common.system.entity.Order">
UPDATE sys_order SET pay_status = #{param.payStatus},pay_time = #{param.payTime},pay_price = #{param.payPrice},transaction_id = #{param.transactionId} WHERE order_no = #{param.orderNo}
</select>
</mapper>