183 lines
8.3 KiB
XML
Raw Normal View History

<?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.tmerclub.cloud.cuerecycle.mapper.CueOrderMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap id="cueOrderVOMap" type="com.tmerclub.cloud.cuerecycle.model.vo.CueOrderVO">
<result property="orderId" column="order_id"/>
<result property="userId" column="user_id"/>
2025-04-16 01:15:18 +08:00
<result property="productId" column="product_id"/>
<result property="productName" column="product_name"/>
<result property="productPrice" column="product_price"/>
<result property="userName" column="user_name"/>
<result property="userPhone" column="user_phone"/>
<result property="orderType" column="order_type"/>
<result property="orderStatus" column="order_status"/>
<result property="flawImgUrl" column="flaw_img_url"/>
<result property="evidenceOfPayment" column="evidence_of_payment"/>
<result property="orderRemark" column="order_remark"/>
<result property="estimatedAmount" column="estimated_amount"/>
<result property="actualAmount" column="actual_amount"/>
<result property="voucherAmount" column="voucher_amount"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="isPayed" column="is_payed"/>
<result property="payType" column="pay_type"/>
<result property="payTime" column="pay_time"/>
<result property="deliveryTime" column="delivery_time"/>
<result property="finallyTime" column="finally_time"/>
2025-04-16 01:15:18 +08:00
<result property="finallyTime" column="finally_time"/>
</resultMap>
<sql id="Vo_Column_List">
2025-04-16 01:15:18 +08:00
order_id,product_id,product_name,product_price,user_id,user_name,user_phone,order_type,order_status,flaw_img_url,evidence_of_payment,order_remark,estimated_amount,actual_amount,voucher_amount,deleted,create_time,update_time,is_payed,pay_type,pay_time,delivery_time,finally_time
</sql>
<select id="list" resultMap="cueOrderVOMap">
SELECT
<include refid="Vo_Column_List" />
FROM
cue_order
<where>
deleted = 0
<if test="dto.userName != null and dto.userName != ''">
AND user_name LIKE CONCAT('%', #{dto.userName}, '%')
</if>
2025-04-16 01:15:18 +08:00
<if test="dto.userPhone != null and dto.userPhone != ''">
AND user_phone LIKE CONCAT('%', #{dto.userPhone}, '%')
</if>
2025-04-16 01:15:18 +08:00
<if test="dto.orderType != null">
AND order_type = #{dto.orderType}
</if>
2025-04-16 01:15:18 +08:00
<if test="dto.orderStatus != null">
AND order_status = #{dto.orderStatus}
</if>
2025-04-16 01:15:18 +08:00
<if test="dto.isPayed != null">
AND is_payed = #{dto.isPayed}
</if>
2025-04-16 01:15:18 +08:00
<if test="dto.payType != null">
AND pay_type = #{dto.payType}
</if>
</where>
ORDER BY
order_id DESC
</select>
<select id="getById" resultMap="cueOrderVOMap">
SELECT
<include refid="Vo_Column_List" />
FROM
cue_order
WHERE
order_id = #{orderId}
</select>
<insert id="save" useGeneratedKeys="true" keyProperty="orderId">
INSERT INTO cue_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
2025-04-16 01:15:18 +08:00
<if test="productId != null">product_id,</if>
<if test="productName != null and productName != ''">product_name,</if>
<if test="productPrice != null">product_price,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="userPhone != null and userPhone != ''">user_phone,</if>
<if test="orderType != null">order_type,</if>
<if test="orderStatus != null">order_status,</if>
<if test="flawImgUrl != null and flawImgUrl != ''">flaw_img_url,</if>
2025-04-16 01:15:18 +08:00
<if test="evidenceOfPayment != null and evidenceOfPayment != ''">evidence_of_payment,</if>
<if test="orderRemark != null and orderRemark != ''">order_remark,</if>
2025-04-16 01:15:18 +08:00
<if test="estimatedAmount != null">estimated_amount,</if>
<if test="actualAmount != null">actual_amount,</if>
<if test="voucherAmount != null">voucher_amount,</if>
<if test="createTime != null">create_time,</if>
<if test="isPayed != null">is_payed,</if>
<if test="payType != null">pay_type,</if>
<if test="payTime != null">pay_time,</if>
<if test="deliveryTime != null">delivery_time,</if>
<if test="finallyTime != null">finally_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
2025-04-16 01:15:18 +08:00
<if test="productId != null">#{productId},</if>
<if test="productName != null and productName != ''">#{productName},</if>
<if test="productPrice != null">#{productPrice},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="userPhone != null and userPhone != ''">#{userPhone},</if>
<if test="orderType != null">#{orderType},</if>
<if test="orderStatus != null">#{orderStatus},</if>
<if test="flawImgUrl != null and flawImgUrl != ''">#{flawImgUrl},</if>
<if test="evidenceOfPayment != null and evidenceOfPayment != ''">#{evidenceOfPayment},</if>
<if test="orderRemark != null and orderRemark != ''">#{orderRemark},</if>
<if test="estimatedAmount != null">#{estimatedAmount},</if>
<if test="actualAmount != null">#{actualAmount},</if>
<if test="voucherAmount != null">#{voucherAmount},</if>
<if test="createTime != null">#{createTime},</if>
<if test="isPayed != null">#{isPayed},</if>
<if test="payType != null">#{payType},</if>
<if test="payTime != null">#{payTime},</if>
<if test="deliveryTime != null">#{deliveryTime},</if>
<if test="finallyTime != null">#{finallyTime},</if>
</trim>
</insert>
<update id="update">
UPDATE cue_order
<set>
<if test="userName != null and userName != ''">
user_name = #{userName},
</if>
<if test="userPhone != null and userPhone != ''">
user_phone = #{userPhone},
</if>
<if test="orderType != null">
order_type = #{orderType},
</if>
<if test="orderStatus != null">
order_status = #{orderStatus},
</if>
<if test="flawImgUrl != null and flawImgUrl != ''">
flaw_img_url = #{flawImgUrl},
</if>
<if test="evidenceOfPayment != null and evidenceOfPayment != ''">
evidence_of_payment = #{evidenceOfPayment},
</if>
<if test="orderRemark != null and orderRemark != ''">
order_remark = #{orderRemark},
</if>
<if test="estimatedAmount != null">
estimated_amount = #{estimatedAmount},
</if>
<if test="actualAmount != null">
actual_amount = #{actualAmount},
</if>
<if test="voucherAmount != null">
voucher_amount = #{voucherAmount},
</if>
<if test="deleted != null">
deleted = #{deleted},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="isPayed != null">
is_payed = #{isPayed},
</if>
<if test="payType != null">
pay_type = #{payType},
</if>
<if test="payTime != null">
pay_time = #{payTime},
</if>
<if test="deliveryTime != null">
delivery_time = #{deliveryTime},
</if>
<if test="finallyTime != null">
finally_time = #{finallyTime},
</if>
2025-04-16 01:15:18 +08:00
<if test="mallOrderId != null">mall_order_id = #{mallOrderId},</if>
</set>
where
order_id = #{orderId}
</update>
</mapper>