去掉supermarket_material表

This commit is contained in:
sxu 2025-06-30 16:45:56 +08:00
parent 19007047c9
commit e2c35c5092
2 changed files with 47 additions and 19 deletions

View File

@ -92,25 +92,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectCookMaterialByMaterialId" parameterType="Long" resultMap="CookMaterialResult">
<include refid="selectCookMaterialVo"/>
where cm.goods_type = 1 and cm.material_id = #{materialId}
<where>
cm.material_id = #{materialId}
<if test="goodsType != null "> and cm.goods_type = #{goodsType}</if>
</where>
</select>
<select id="checkIsExistByCode" resultType="java.lang.Integer">
select count(1) from cook_material where cm.goods_type = 1 and material_code = #{materialCode}
select count(1) from cook_material
<where>
material_code = #{materialCode}
<if test="materialId != null and materialId != ''"> and material_id != #{materialId}</if>
<if test="goodsType != null "> and cm.goods_type = #{goodsType}</if>
</where>
</select>
<select id="checkIsExistByName" resultType="java.lang.Integer">
select count(1) from cook_material where cm.goods_type = 1 and material_name = #{materialName}
select count(1) from cook_material
<where>
material_name = #{materialName}
<if test="materialId != null and materialId != ''"> and material_id != #{materialId}</if>
<if test="goodsType != null "> and cm.goods_type = #{goodsType}</if>
</where>
</select>
<select id="checkIsUse" resultType="java.lang.Integer">
select count(1) from cook_dishes_material where cm.goods_type = 1 and material_id
in
select count(1) from cook_dishes_material
<where>
material_id in
<foreach item="materialId" collection="materialIds" open="(" separator="," close=")">
#{materialId}
</foreach>
<if test="goodsType != null "> and cm.goods_type = #{goodsType}</if>
</where>
</select>
<insert id="insertCookMaterial" parameterType="com.bonus.canteen.core.cook.domain.CookMaterial" useGeneratedKeys="true" keyProperty="materialId">

View File

@ -17,7 +17,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectCookMaterialTypeVo">
select material_type_id, material_type_name, parent_id, level, area_id, goods_type, create_by, create_time, update_by, update_time from cook_material_type
select material_type_id, material_type_name, parent_id, level, area_id, goods_type,
create_by, create_time, update_by, update_time
from cook_material_type
</sql>
<select id="selectCookMaterialTypeList" parameterType="com.bonus.canteen.core.cook.domain.CookMaterialType" resultMap="CookMaterialTypeResult">
@ -34,28 +36,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectCookMaterialTypeByMaterialTypeId" parameterType="Long" resultMap="CookMaterialTypeResult">
<include refid="selectCookMaterialTypeVo"/>
where goods_type = 1 and material_type_id = #{materialTypeId}
<where>
material_type_id = #{materialTypeId}
<if test="goodsType != null "> and goods_type = #{goodsType}</if>
</where>
</select>
<select id="selectCookMaterialTypeByMaterialTypeName"
resultType="com.bonus.canteen.core.cook.domain.CookMaterialType">
<include refid="selectCookMaterialTypeVo"/>
where goods_type = 1 and material_type_name = #{materialTypeName}
<where>
material_type_name = #{materialTypeName}
<if test="materialTypeId != null and materialTypeId != ''">and material_type_id != #{materialTypeId}</if>
<if test="goodsType != null "> and goods_type = #{goodsType}</if>
</where>
</select>
<select id="selectCookMaterialTypeByParentId" resultType="java.lang.Integer">
select count(1) from cook_material_type where goods_type = 1 and parent_id in
select count(1) from cook_material_type
<where>
parent_id in
<foreach item="materialTypeId" collection="materialTypeIds" open="(" separator="," close=")">
#{materialTypeId}
</foreach>
<if test="goodsType != null "> and goods_type = #{goodsType}</if>
</where>
</select>
<select id="getTree" resultType="com.bonus.canteen.core.cook.vo.CookMaterialTypeTreeVO">
select material_type_id as id, parent_id as parentId, material_type_name as categoryName,
goods_type as categoryType,area_id as areaId
from cook_material_type
where goods_type = 1
<where>
<if test="goodsType != null "> and goods_type = #{goodsType}</if>
</where>
</select>
<insert id="insertCookMaterialType" parameterType="com.bonus.canteen.core.cook.domain.CookMaterialType" useGeneratedKeys="true" keyProperty="materialTypeId">