商品上架

This commit is contained in:
sxu 2025-06-05 17:14:04 +08:00
parent 49c1d2b427
commit a745172a60
2 changed files with 27 additions and 15 deletions

View File

@ -1,6 +1,7 @@
package com.bonus.canteen.core.supermarket.domain; package com.bonus.canteen.core.supermarket.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.bonus.canteen.core.common.utils.FileUrlUtil;
import com.bonus.common.core.annotation.Excel; import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -73,5 +74,11 @@ public class SupermarketProduct extends BaseEntity {
@ApiModelProperty(value = "库存数") @ApiModelProperty(value = "库存数")
private BigDecimal inventoryNum; private BigDecimal inventoryNum;
private String materialName;
private String unitName;
public String getImgUrl() {
return FileUrlUtil.getFileUrl(this.imgUrl);
}
} }

View File

@ -19,38 +19,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="materialName" column="material_name" />
<result property="unitName" column="unit_name" />
</resultMap> </resultMap>
<sql id="selectSupermarketProductVo"> <sql id="selectSupermarketProductVo">
select product_id, supermarket_id, material_id, putaway_state, if_online, sale_price, pref_price, select sp.product_id, sp.supermarket_id, sp.material_id, sp.putaway_state, sp.if_online, sp.sale_price,
person_limit, one_day_limit, img_url, inventory_num, create_by, create_time, update_by, update_time sp.pref_price, sp.person_limit, sp.one_day_limit, sp.img_url, sp.inventory_num, sp.create_by,
from supermarket_product sp.create_time, sp.update_by, sp.update_time, sm.material_name, spu.unit_name
from supermarket_product sp
left join supermarket_material sm on sm.material_id = sp.material_id
left join supply_product_unit spu on spu.unit_id = sm.unit_id
</sql> </sql>
<select id="selectSupermarketProductList" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketProduct" resultMap="SupermarketProductResult"> <select id="selectSupermarketProductList" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketProduct" resultMap="SupermarketProductResult">
<include refid="selectSupermarketProductVo"/> <include refid="selectSupermarketProductVo"/>
<where> <where>
<if test="supermarketId != null "> and supermarket_id = #{supermarketId}</if> <if test="supermarketId != null "> and sp.supermarket_id = #{supermarketId}</if>
<if test="materialId != null "> and material_id = #{materialId}</if> <if test="materialId != null "> and sp.material_id = #{materialId}</if>
<if test="putawayState != null "> and putaway_state = #{putawayState}</if> <if test="putawayState != null "> and sp.putaway_state = #{putawayState}</if>
<if test="ifOnline != null "> and if_online = #{ifOnline}</if> <if test="ifOnline != null "> and sp.if_online = #{ifOnline}</if>
<if test="salePrice != null "> and sale_price = #{salePrice}</if> <if test="salePrice != null "> and sp.sale_price = #{salePrice}</if>
<if test="prefPrice != null "> and pref_price = #{prefPrice}</if> <if test="prefPrice != null "> and sp.pref_price = #{prefPrice}</if>
<if test="personLimit != null "> and person_limit = #{personLimit}</if> <if test="personLimit != null "> and sp.person_limit = #{personLimit}</if>
<if test="oneDayLimit != null "> and one_day_limit = #{oneDayLimit}</if> <if test="oneDayLimit != null "> and sp.one_day_limit = #{oneDayLimit}</if>
<if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if> <if test="imgUrl != null and imgUrl != ''"> and sp.img_url = #{imgUrl}</if>
<if test="inventoryNum != null "> and inventory_num = #{inventoryNum}</if> <if test="inventoryNum != null "> and sp.inventory_num = #{inventoryNum}</if>
</where> </where>
</select> </select>
<select id="selectSupermarketProductByProductId" parameterType="Long" resultMap="SupermarketProductResult"> <select id="selectSupermarketProductByProductId" parameterType="Long" resultMap="SupermarketProductResult">
<include refid="selectSupermarketProductVo"/> <include refid="selectSupermarketProductVo"/>
where product_id = #{productId} where sp.product_id = #{productId}
</select> </select>
<select id="selectSupermarketProductByMaterialIds" parameterType="String" resultMap="SupermarketProductResult"> <select id="selectSupermarketProductByMaterialIds" parameterType="String" resultMap="SupermarketProductResult">
<include refid="selectSupermarketProductVo"/> <include refid="selectSupermarketProductVo"/>
where material_id in where sp.material_id in
<foreach item="materialId" collection="array" open="(" separator="," close=")"> <foreach item="materialId" collection="array" open="(" separator="," close=")">
#{materialId} #{materialId}
</foreach> </foreach>