2025-04-03 15:06:05 +08:00
|
|
|
<?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">
|
2025-04-05 19:12:26 +08:00
|
|
|
<mapper namespace="com.bonus.canteen.core.menu.mapper.MenuMaterialMapper">
|
|
|
|
|
<resultMap type="com.bonus.canteen.core.menu.domain.MenuMaterial" id="MenuMaterialResult">
|
2025-04-03 15:06:05 +08:00
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="areaId" column="area_id" />
|
|
|
|
|
<result property="materialId" column="material_id" />
|
|
|
|
|
<result property="materialName" column="material_name" />
|
|
|
|
|
<result property="materialCode" column="material_code" />
|
|
|
|
|
<result property="pinyinInitials" column="pinyin_initials" />
|
|
|
|
|
<result property="pinyinFull" column="pinyin_full" />
|
|
|
|
|
<result property="imageUrl" column="image_url" />
|
|
|
|
|
<result property="nutritionId" column="nutrition_id" />
|
|
|
|
|
<result property="categoryId" column="category_id" />
|
|
|
|
|
<result property="materialType" column="material_type" />
|
|
|
|
|
<result property="barCode" column="bar_code" />
|
|
|
|
|
<result property="unitId" column="unit_id" />
|
|
|
|
|
<result property="salePrice" column="sale_price" />
|
|
|
|
|
<result property="unitPrice" column="unit_price" />
|
|
|
|
|
<result property="salesMode" column="sales_mode" />
|
|
|
|
|
<result property="reserveRate" column="reserve_rate" />
|
|
|
|
|
<result property="shelfLifeType" column="shelf_life_type" />
|
|
|
|
|
<result property="shelfLifeDays" column="shelf_life_days" />
|
|
|
|
|
<result property="synopsis" column="synopsis" />
|
|
|
|
|
<result property="revision" column="revision" />
|
|
|
|
|
<result property="purPriceCeiling" column="pur_price_ceiling" />
|
|
|
|
|
<result property="certId" column="cert_id" />
|
|
|
|
|
<result property="bigCategoryId" column="big_category_id" />
|
|
|
|
|
<result property="size" column="size" />
|
|
|
|
|
<result property="taxRate" column="tax_rate" />
|
|
|
|
|
<result property="disableStatus" column="disable_status" />
|
|
|
|
|
<result property="convertGrams" column="convert_grams" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectMenuMaterialVo">
|
|
|
|
|
select id, area_id, material_id, material_name, material_code, pinyin_initials, pinyin_full, image_url, nutrition_id, category_id, material_type, bar_code, unit_id, sale_price, unit_price, sales_mode, reserve_rate, shelf_life_type, shelf_life_days, synopsis, revision, pur_price_ceiling, cert_id, big_category_id, size, tax_rate, disable_status, convert_grams from menu_material
|
|
|
|
|
</sql>
|
|
|
|
|
|
2025-04-05 19:12:26 +08:00
|
|
|
<select id="selectMenuMaterialList" parameterType="com.bonus.canteen.core.menu.domain.MenuMaterial" resultMap="MenuMaterialResult">
|
2025-04-03 15:06:05 +08:00
|
|
|
<include refid="selectMenuMaterialVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="areaId != null "> and area_id = #{areaId}</if>
|
|
|
|
|
<if test="materialId != null "> and material_id = #{materialId}</if>
|
|
|
|
|
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
|
|
|
|
|
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
|
|
|
|
|
<if test="pinyinInitials != null and pinyinInitials != ''"> and pinyin_initials = #{pinyinInitials}</if>
|
|
|
|
|
<if test="pinyinFull != null and pinyinFull != ''"> and pinyin_full = #{pinyinFull}</if>
|
|
|
|
|
<if test="imageUrl != null and imageUrl != ''"> and image_url = #{imageUrl}</if>
|
|
|
|
|
<if test="nutritionId != null "> and nutrition_id = #{nutritionId}</if>
|
|
|
|
|
<if test="categoryId != null "> and category_id = #{categoryId}</if>
|
|
|
|
|
<if test="materialType != null "> and material_type = #{materialType}</if>
|
|
|
|
|
<if test="barCode != null and barCode != ''"> and bar_code = #{barCode}</if>
|
|
|
|
|
<if test="unitId != null "> and unit_id = #{unitId}</if>
|
|
|
|
|
<if test="salePrice != null "> and sale_price = #{salePrice}</if>
|
|
|
|
|
<if test="unitPrice != null "> and unit_price = #{unitPrice}</if>
|
|
|
|
|
<if test="salesMode != null "> and sales_mode = #{salesMode}</if>
|
|
|
|
|
<if test="reserveRate != null "> and reserve_rate = #{reserveRate}</if>
|
|
|
|
|
<if test="shelfLifeType != null "> and shelf_life_type = #{shelfLifeType}</if>
|
|
|
|
|
<if test="shelfLifeDays != null "> and shelf_life_days = #{shelfLifeDays}</if>
|
|
|
|
|
<if test="synopsis != null and synopsis != ''"> and synopsis = #{synopsis}</if>
|
|
|
|
|
<if test="revision != null "> and revision = #{revision}</if>
|
|
|
|
|
<if test="purPriceCeiling != null "> and pur_price_ceiling = #{purPriceCeiling}</if>
|
|
|
|
|
<if test="certId != null "> and cert_id = #{certId}</if>
|
|
|
|
|
<if test="bigCategoryId != null "> and big_category_id = #{bigCategoryId}</if>
|
|
|
|
|
<if test="size != null and size != ''"> and size = #{size}</if>
|
|
|
|
|
<if test="taxRate != null "> and tax_rate = #{taxRate}</if>
|
|
|
|
|
<if test="disableStatus != null "> and disable_status = #{disableStatus}</if>
|
|
|
|
|
<if test="convertGrams != null "> and convert_grams = #{convertGrams}</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectMenuMaterialById" parameterType="Long" resultMap="MenuMaterialResult">
|
|
|
|
|
<include refid="selectMenuMaterialVo"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
2025-04-05 19:12:26 +08:00
|
|
|
<insert id="insertMenuMaterial" parameterType="com.bonus.canteen.core.menu.domain.MenuMaterial" useGeneratedKeys="true" keyProperty="id">
|
2025-04-03 15:06:05 +08:00
|
|
|
insert into menu_material
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="areaId != null">area_id,</if>
|
|
|
|
|
<if test="materialId != null">material_id,</if>
|
|
|
|
|
<if test="materialName != null and materialName != ''">material_name,</if>
|
|
|
|
|
<if test="materialCode != null and materialCode != ''">material_code,</if>
|
|
|
|
|
<if test="pinyinInitials != null and pinyinInitials != ''">pinyin_initials,</if>
|
|
|
|
|
<if test="pinyinFull != null and pinyinFull != ''">pinyin_full,</if>
|
|
|
|
|
<if test="imageUrl != null and imageUrl != ''">image_url,</if>
|
|
|
|
|
<if test="nutritionId != null">nutrition_id,</if>
|
|
|
|
|
<if test="categoryId != null">category_id,</if>
|
|
|
|
|
<if test="materialType != null">material_type,</if>
|
|
|
|
|
<if test="barCode != null">bar_code,</if>
|
|
|
|
|
<if test="unitId != null">unit_id,</if>
|
|
|
|
|
<if test="salePrice != null">sale_price,</if>
|
|
|
|
|
<if test="unitPrice != null">unit_price,</if>
|
|
|
|
|
<if test="salesMode != null">sales_mode,</if>
|
|
|
|
|
<if test="reserveRate != null">reserve_rate,</if>
|
|
|
|
|
<if test="shelfLifeType != null">shelf_life_type,</if>
|
|
|
|
|
<if test="shelfLifeDays != null">shelf_life_days,</if>
|
|
|
|
|
<if test="synopsis != null">synopsis,</if>
|
|
|
|
|
<if test="revision != null">revision,</if>
|
|
|
|
|
<if test="purPriceCeiling != null">pur_price_ceiling,</if>
|
|
|
|
|
<if test="certId != null">cert_id,</if>
|
|
|
|
|
<if test="bigCategoryId != null">big_category_id,</if>
|
|
|
|
|
<if test="size != null">size,</if>
|
|
|
|
|
<if test="taxRate != null">tax_rate,</if>
|
|
|
|
|
<if test="disableStatus != null">disable_status,</if>
|
|
|
|
|
<if test="convertGrams != null">convert_grams,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="areaId != null">#{areaId},</if>
|
|
|
|
|
<if test="materialId != null">#{materialId},</if>
|
|
|
|
|
<if test="materialName != null and materialName != ''">#{materialName},</if>
|
|
|
|
|
<if test="materialCode != null and materialCode != ''">#{materialCode},</if>
|
|
|
|
|
<if test="pinyinInitials != null and pinyinInitials != ''">#{pinyinInitials},</if>
|
|
|
|
|
<if test="pinyinFull != null and pinyinFull != ''">#{pinyinFull},</if>
|
|
|
|
|
<if test="imageUrl != null and imageUrl != ''">#{imageUrl},</if>
|
|
|
|
|
<if test="nutritionId != null">#{nutritionId},</if>
|
|
|
|
|
<if test="categoryId != null">#{categoryId},</if>
|
|
|
|
|
<if test="materialType != null">#{materialType},</if>
|
|
|
|
|
<if test="barCode != null">#{barCode},</if>
|
|
|
|
|
<if test="unitId != null">#{unitId},</if>
|
|
|
|
|
<if test="salePrice != null">#{salePrice},</if>
|
|
|
|
|
<if test="unitPrice != null">#{unitPrice},</if>
|
|
|
|
|
<if test="salesMode != null">#{salesMode},</if>
|
|
|
|
|
<if test="reserveRate != null">#{reserveRate},</if>
|
|
|
|
|
<if test="shelfLifeType != null">#{shelfLifeType},</if>
|
|
|
|
|
<if test="shelfLifeDays != null">#{shelfLifeDays},</if>
|
|
|
|
|
<if test="synopsis != null">#{synopsis},</if>
|
|
|
|
|
<if test="revision != null">#{revision},</if>
|
|
|
|
|
<if test="purPriceCeiling != null">#{purPriceCeiling},</if>
|
|
|
|
|
<if test="certId != null">#{certId},</if>
|
|
|
|
|
<if test="bigCategoryId != null">#{bigCategoryId},</if>
|
|
|
|
|
<if test="size != null">#{size},</if>
|
|
|
|
|
<if test="taxRate != null">#{taxRate},</if>
|
|
|
|
|
<if test="disableStatus != null">#{disableStatus},</if>
|
|
|
|
|
<if test="convertGrams != null">#{convertGrams},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
2025-04-05 19:12:26 +08:00
|
|
|
<update id="updateMenuMaterial" parameterType="com.bonus.canteen.core.menu.domain.MenuMaterial">
|
2025-04-03 15:06:05 +08:00
|
|
|
update menu_material
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="areaId != null">area_id = #{areaId},</if>
|
|
|
|
|
<if test="materialId != null">material_id = #{materialId},</if>
|
|
|
|
|
<if test="materialName != null and materialName != ''">material_name = #{materialName},</if>
|
|
|
|
|
<if test="materialCode != null and materialCode != ''">material_code = #{materialCode},</if>
|
|
|
|
|
<if test="pinyinInitials != null and pinyinInitials != ''">pinyin_initials = #{pinyinInitials},</if>
|
|
|
|
|
<if test="pinyinFull != null and pinyinFull != ''">pinyin_full = #{pinyinFull},</if>
|
|
|
|
|
<if test="imageUrl != null and imageUrl != ''">image_url = #{imageUrl},</if>
|
|
|
|
|
<if test="nutritionId != null">nutrition_id = #{nutritionId},</if>
|
|
|
|
|
<if test="categoryId != null">category_id = #{categoryId},</if>
|
|
|
|
|
<if test="materialType != null">material_type = #{materialType},</if>
|
|
|
|
|
<if test="barCode != null">bar_code = #{barCode},</if>
|
|
|
|
|
<if test="unitId != null">unit_id = #{unitId},</if>
|
|
|
|
|
<if test="salePrice != null">sale_price = #{salePrice},</if>
|
|
|
|
|
<if test="unitPrice != null">unit_price = #{unitPrice},</if>
|
|
|
|
|
<if test="salesMode != null">sales_mode = #{salesMode},</if>
|
|
|
|
|
<if test="reserveRate != null">reserve_rate = #{reserveRate},</if>
|
|
|
|
|
<if test="shelfLifeType != null">shelf_life_type = #{shelfLifeType},</if>
|
|
|
|
|
<if test="shelfLifeDays != null">shelf_life_days = #{shelfLifeDays},</if>
|
|
|
|
|
<if test="synopsis != null">synopsis = #{synopsis},</if>
|
|
|
|
|
<if test="revision != null">revision = #{revision},</if>
|
|
|
|
|
<if test="purPriceCeiling != null">pur_price_ceiling = #{purPriceCeiling},</if>
|
|
|
|
|
<if test="certId != null">cert_id = #{certId},</if>
|
|
|
|
|
<if test="bigCategoryId != null">big_category_id = #{bigCategoryId},</if>
|
|
|
|
|
<if test="size != null">size = #{size},</if>
|
|
|
|
|
<if test="taxRate != null">tax_rate = #{taxRate},</if>
|
|
|
|
|
<if test="disableStatus != null">disable_status = #{disableStatus},</if>
|
|
|
|
|
<if test="convertGrams != null">convert_grams = #{convertGrams},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteMenuMaterialById" parameterType="Long">
|
|
|
|
|
delete from menu_material where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteMenuMaterialByIds" parameterType="String">
|
|
|
|
|
delete from menu_material where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
</mapper>
|