菜品收藏优化

This commit is contained in:
sxu 2025-04-26 15:02:30 +08:00
parent c53ef6bbbe
commit 091e6cc46b
2 changed files with 31 additions and 6 deletions

View File

@ -1,11 +1,14 @@
package com.bonus.canteen.core.menu.domain;
import com.bonus.canteen.core.common.utils.FileUrlUtil;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
import java.math.BigDecimal;
/**
* 菜品收藏对象 menu_collection_dishes
*
@ -37,6 +40,12 @@ public class MenuCollectionDishes extends BaseEntity {
@ApiModelProperty(value = "菜品id")
private Long dishesId;
@ApiModelProperty(value = "菜品名称")
private String dishesName;
@ApiModelProperty(value = "图片地址")
private String imageUrl;
/** 乐观锁 */
@Excel(name = "乐观锁")
@ApiModelProperty(value = "乐观锁")
@ -45,5 +54,13 @@ public class MenuCollectionDishes extends BaseEntity {
/** 删除标识(0:正常 2:删除) */
private Long delFlag;
@ApiModelProperty(value = "价格")
private BigDecimal price;
@ApiModelProperty(value = "售出数量")
private Integer saleNum;
public String getImageUrl() {
return FileUrlUtil.getFileUrl(this.imageUrl);
}
}

View File

@ -14,25 +14,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="dishesName" column="dishes_name" />
<result property="imageUrl" column="image_url" />
<result property="price" column="price" />
<result property="saleNum" column="sale_num" />
</resultMap>
<sql id="selectMenuCollectionDishesVo">
select id, user_id, shopstall_id, dishes_id, revision, del_flag, create_by, create_time, update_by, update_time from menu_collection_dishes
select mcd.id, mcd.user_id, mcd.shopstall_id, mcd.dishes_id, mcd.revision, mcd.del_flag, mcd.create_by,
mcd.create_time, mcd.update_by, mcd.update_time, md.dishes_name, md.image_url, md.price, mdsr.sale_num
from menu_collection_dishes mcd
left join menu_dishes md on md.dishes_id = mcd.dishes_id
left join menu_dishes_sale_record mdsr on mcd.dishes_id = mdsr.dishes_id
</sql>
<select id="selectMenuCollectionDishesList" parameterType="com.bonus.canteen.core.menu.domain.MenuCollectionDishes" resultMap="MenuCollectionDishesResult">
<include refid="selectMenuCollectionDishesVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="shopstallId != null "> and shopstall_id = #{shopstallId}</if>
<if test="dishesId != null "> and dishes_id = #{dishesId}</if>
<if test="revision != null "> and revision = #{revision}</if>
<if test="userId != null "> and mcd.user_id = #{userId}</if>
<if test="shopstallId != null "> and mcd.shopstall_id = #{shopstallId}</if>
<if test="dishesId != null "> and mcd.dishes_id = #{dishesId}</if>
<if test="revision != null "> and mcd.revision = #{revision}</if>
</where>
</select>
<select id="selectMenuCollectionDishesById" parameterType="Long" resultMap="MenuCollectionDishesResult">
<include refid="selectMenuCollectionDishesVo"/>
where id = #{id}
where mcd.id = #{id}
</select>
<insert id="insertMenuCollectionDishes" parameterType="com.bonus.canteen.core.menu.domain.MenuCollectionDishes" useGeneratedKeys="true" keyProperty="id">