地址删除修改为逻辑删除,避免订单信息中的地址查找不到

This commit is contained in:
donqi 2022-09-20 23:00:35 +08:00
parent efcd5f274e
commit 4ee556fbd2
1 changed files with 6 additions and 2 deletions

View File

@ -29,6 +29,7 @@
<select id="getCustomerAddressList" resultMap="CustomerAddressResult"> <select id="getCustomerAddressList" resultMap="CustomerAddressResult">
<include refid="selectCustomerAddress" /> <include refid="selectCustomerAddress" />
<where> <where>
deleted = 0
<if test="customerId != null"> <if test="customerId != null">
AND customer_id = #{customerId} AND customer_id = #{customerId}
</if> </if>
@ -36,19 +37,20 @@
</select> </select>
<delete id="deleteByIds"> <delete id="deleteByIds">
DELETE FROM customer_address WHERE customer_address_id IN UPDATE customer_address SET deleted = 1 WHERE customer_address_id IN
<foreach collection="array" item="customerIds" open="(" separator="," close=")"> <foreach collection="array" item="customerIds" open="(" separator="," close=")">
#{customerAddressIds} #{customerAddressIds}
</foreach> </foreach>
</delete> </delete>
<delete id="deleteByCustomerAddressId" parameterType="Long"> <delete id="deleteByCustomerAddressId" parameterType="Long">
DELETE FROM customer_address WHERE customer_address_id = #{customerAddressId} UPDATE customer_address SET deleted = 1 WHERE customer_address_id = #{customerAddressId}
</delete> </delete>
<select id="selectByCustomerId" resultMap="CustomerAddressResult"> <select id="selectByCustomerId" resultMap="CustomerAddressResult">
<include refid="selectCustomerAddress"/> <include refid="selectCustomerAddress"/>
<where> <where>
deleted = 0
<if test="customerId != null and customerId != 0"> <if test="customerId != null and customerId != 0">
AND customer_id = #{customerId} AND customer_id = #{customerId}
</if> </if>
@ -77,6 +79,7 @@
<if test="isDefault != null">is_default,</if> <if test="isDefault != null">is_default,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if> <if test="remark != null and remark != ''">remark,</if>
deleted,
create_time create_time
)values( )values(
<if test="customerId != null and customerId != 0">#{customerId},</if> <if test="customerId != null and customerId != 0">#{customerId},</if>
@ -90,6 +93,7 @@
<if test="isDefault != null">#{isDefault},</if> <if test="isDefault != null">#{isDefault},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if> <if test="remark != null and remark != ''">#{remark},</if>
0,
sysdate() sysdate()
) )
</insert> </insert>