From ac918503bb5e8fad007348e7e39ba7275b75f334 Mon Sep 17 00:00:00 2001 From: p-honggang.li <p-honggang.li@pcitc.com> Date: 星期一, 08 九月 2025 23:33:32 +0800 Subject: [PATCH] 修改取消订单,修改状态为已取消 --- src/main/resources/mapper/CartMapper.xml | 50 ++++++++++++++++++++++++++++++++++---------------- 1 files changed, 34 insertions(+), 16 deletions(-) diff --git a/src/main/resources/mapper/CartMapper.xml b/src/main/resources/mapper/CartMapper.xml index 086a599..1226da6 100644 --- a/src/main/resources/mapper/CartMapper.xml +++ b/src/main/resources/mapper/CartMapper.xml @@ -4,10 +4,10 @@ <resultMap id="BaseResultMap" type="com.webmanage.entity.Cart"> <id column="id" property="id" jdbcType="BIGINT"/> - <result column="user_id" property="userId" jdbcType="BIGINT"/> - <result column="unit_id" property="unitId" jdbcType="BIGINT"/> + <result column="user_id" property="userId" jdbcType="VARCHAR"/> + <result column="unit_id" property="unitId" jdbcType="VARCHAR"/> <result column="pricing_id" property="pricingId" jdbcType="BIGINT"/> - <result column="product_id" property="productId" jdbcType="BIGINT"/> + <result column="product_id" property="productId" jdbcType="VARCHAR"/> <result column="product_name" property="productName" jdbcType="VARCHAR"/> <result column="suite_name" property="suiteName" jdbcType="VARCHAR"/> <result column="sales_form" property="salesForm" jdbcType="VARCHAR"/> @@ -37,37 +37,55 @@ <select id="selectByUserIdAndUnitId" resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List"/> - FROM cart + FROM tb_cart WHERE deleted = 0 - AND user_id = #{userId} - AND unit_id = #{unitId} + AND user_id = #{userId} + <if test="unitId !=null and unitId != ''"> + AND unit_id = #{unitId} + </if> + <if test="productId !=null and productId != ''"> + AND product_id = #{productId} + </if> ORDER BY add_time DESC </select> <select id="selectByUserIdUnitIdAndPricingId" resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List"/> - FROM cart - WHERE deleted = 0 - AND user_id = #{userId} - AND unit_id = #{unitId} + FROM tb_cart + WHERE deleted = 0 + AND user_id = #{userId} + <if test="unitId != '' and unitId != null"> + AND unit_id = #{unitId} + </if> AND pricing_id = #{pricingId} + AND product_id = #{productId} LIMIT 1 </select> <select id="countByUserIdAndUnitId" resultType="java.lang.Integer"> SELECT COUNT(*) - FROM cart + FROM tb_cart WHERE deleted = 0 - AND user_id = #{userId} - AND unit_id = #{unitId} + AND user_id = #{userId} + <if test="unitId != '' and unitId != null"> + AND unit_id = #{unitId} + </if> + <if test="productId != '' and productId != null"> + AND product_id = #{productId} + </if> </select> <select id="sumTotalAmountByUserIdAndUnitId" resultType="java.math.BigDecimal"> SELECT COALESCE(SUM(total_price), 0) - FROM cart + FROM tb_cart WHERE deleted = 0 - AND user_id = #{userId} - AND unit_id = #{unitId} + AND user_id = #{userId} + <if test="unitId != '' and unitId != null"> + AND unit_id = #{unitId} + </if> </select> + <delete id="deleteByCustomerCondition"> + delete from tb_cart where id = #{id} + </delete> </mapper> -- Gitblit v1.8.0