From efb6f9d656f72c3016d738f079c92de021b9f14f Mon Sep 17 00:00:00 2001 From: 陶杰 <1378534974@qq.com> Date: 星期三, 04 十二月 2024 10:04:41 +0800 Subject: [PATCH] 1.常规配置-基本配置 2.分类-修改分类名称批量修改商品名称 --- src/main/resources/mapper/flower/FlowerMapper.xml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 50 insertions(+), 6 deletions(-) diff --git a/src/main/resources/mapper/flower/FlowerMapper.xml b/src/main/resources/mapper/flower/FlowerMapper.xml index 8c60d42..e90238f 100644 --- a/src/main/resources/mapper/flower/FlowerMapper.xml +++ b/src/main/resources/mapper/flower/FlowerMapper.xml @@ -1,6 +1,13 @@ <?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.mzl.flower.mapper.flower.FlowerMapper"> + <delete id="deleteBatchPhysics"> + DELETE FROM t_flower + WHERE id IN + <foreach collection="list" item="id" open="(" separator="," close=")"> + #{id} + </foreach> + </delete> <select id="selectFlowerList" resultType="com.mzl.flower.dto.response.flower.FlowerListDTO"> SELECT f.*, s.name supplierName, st.name supplierType, fc.name categoryStr @@ -37,6 +44,12 @@ </if> <if test="condition.recommend != null and !condition.recommend"> AND (f.recommend = 0 or f.recommend is null) + </if> + <if test="condition.isLimited != null and condition.isLimited"> + AND f.limited > 0 + </if> + <if test="condition.isLimited != null and !condition.isLimited"> + AND (f.limited = 0 or f.limited is null) </if> <if test="condition.statusList != null and condition.statusList.size > 0"> and f.status in @@ -167,8 +180,11 @@ <choose> <when test="condition.column != null and condition.column != '' and (condition.recommend == null or condition.zoneId != null)"> <choose> - <when test="'f.sales'.equals(condition.column) or 'f.stock'.equals(condition.column)"> - order by ${condition.column} desc + <when test="'f.sales'.equals(condition.column)"> + order by ifnull(f.sales, 0) + ifnull(f.real_sales, 0) desc + </when> + <when test="'f.stock'.equals(condition.column)"> + order by f.stock desc </when> <otherwise> order by ${condition.column}, f.price @@ -319,8 +335,11 @@ <choose> <when test="condition.column != null and condition.column != ''"> <choose> - <when test="'f.sales'.equals(condition.column) or 'f.stock'.equals(condition.column)"> - order by ${condition.column} desc + <when test="'f.sales'.equals(condition.column)"> + order by ifnull(f.sales, 0) + ifnull(f.real_sales, 0) desc + </when> + <when test="'f.stock'.equals(condition.column)"> + order by f.stock desc </when> <otherwise> order by ${condition.column} asc @@ -328,7 +347,7 @@ </choose> </when> <otherwise> - order by c.create_time desc + order by c.update_time desc </otherwise> </choose> </select> @@ -386,10 +405,35 @@ FROM t_browse_his c left join t_flower f on c.flower_id = f.id WHERE f.deleted = 0 and c.deleted = 0 and f.status != 'UP' and c.user_id = #{userId} </select> + <select id="getDeletdFlowByIds" resultType="com.mzl.flower.entity.flower.Flower"> + select * from t_flower + WHERE id IN + <foreach collection="list" item="id" open="(" separator="," close=")"> + #{id} + </foreach> + </select> <update id="updateFlowerCategoryInfo"> update t_flower f, t_flower_category fc - set f.unit = fc.unit, f.color = fc.color + set f.unit = fc.unit, f.color = fc.color,f.name=fc.name where f.category = fc.id and fc.id = #{category} </update> + <update id="updateBatchTypeRank"> + <foreach collection="list" item="item" separator=";"> + UPDATE t_flower + SET type_rank = #{item.typeRank} + WHERE id = #{item.id} + </foreach> + </update> + + <update id="restoreFlowerBatch"> + update t_flower set deleted = 0 + WHERE id IN + <foreach collection="list" item="id" open="(" separator="," close=")"> + #{id} + </foreach> + </update> + <update id="updateTypeRankNull"> + update t_flower set type_rank=null where category=#{category} and level=#{level} + </update> </mapper> \ No newline at end of file -- Gitblit v1.9.3