去掉supermarket_material_type表
This commit is contained in:
parent
40d400107f
commit
603537b983
|
|
@ -42,5 +42,8 @@ public class SupermarketMaterialType extends BaseEntity {
|
|||
@ApiModelProperty(value = "区域id")
|
||||
private Long areaId;
|
||||
|
||||
|
||||
/** 商品类型(1原料2商品) */
|
||||
@Excel(name = "商品类型(1原料2商品)")
|
||||
@ApiModelProperty(value = "商品类型(1原料2商品)")
|
||||
private Long goodsType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,23 +34,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectCookMaterialTypeByMaterialTypeId" parameterType="Long" resultMap="CookMaterialTypeResult">
|
||||
<include refid="selectCookMaterialTypeVo"/>
|
||||
where material_type_id = #{materialTypeId}
|
||||
where goods_type = 1 and material_type_id = #{materialTypeId}
|
||||
</select>
|
||||
|
||||
<select id="selectCookMaterialTypeByMaterialTypeName"
|
||||
resultType="com.bonus.canteen.core.cook.domain.CookMaterialType">
|
||||
<include refid="selectCookMaterialTypeVo"/>
|
||||
where material_type_name = #{materialTypeName}
|
||||
where goods_type = 1 and material_type_name = #{materialTypeName}
|
||||
<if test="materialTypeId != null and materialTypeId != ''">and material_type_id != #{materialTypeId}</if>
|
||||
</select>
|
||||
|
||||
<select id="selectCookMaterialTypeByParentId" resultType="java.lang.Integer">
|
||||
select count(1) from cook_material_type where parent_id in
|
||||
select count(1) from cook_material_type where goods_type = 1 and parent_id in
|
||||
<foreach item="materialTypeId" collection="materialTypeIds" open="(" separator="," close=")">
|
||||
#{materialTypeId}
|
||||
</foreach>
|
||||
</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
|
||||
goods_type as categoryType,area_id as areaId
|
||||
from cook_material_type
|
||||
where goods_type = 1
|
||||
</select>
|
||||
|
||||
<insert id="insertCookMaterialType" parameterType="com.bonus.canteen.core.cook.domain.CookMaterialType" useGeneratedKeys="true" keyProperty="materialTypeId">
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ba.area_name, smt.material_type_name, iu.unit_name
|
||||
from cook_material sm
|
||||
left join basic_area ba on ba.area_id = sm.area_id
|
||||
left join supermarket_material_type smt on smt.material_type_id = sm.material_type_id
|
||||
left join cook_material_type smt on smt.material_type_id = sm.material_type_id
|
||||
left join ims_unit iu on iu.unit_id = sm.unit_id
|
||||
</sql>
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="parentId" column="parent_id" />
|
||||
<result property="level" column="level" />
|
||||
<result property="areaId" column="area_id" />
|
||||
<result property="goodsType" column="goods_type" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
|
|
@ -16,13 +17,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectSupermarketMaterialTypeVo">
|
||||
select material_type_id, material_type_name, parent_id, level, area_id, create_by, create_time, update_by, update_time
|
||||
from supermarket_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="selectSupermarketMaterialTypeList" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketMaterialType" resultMap="SupermarketMaterialTypeResult">
|
||||
<include refid="selectSupermarketMaterialTypeVo"/>
|
||||
<where>
|
||||
goods_type = 2
|
||||
<if test="materialTypeName != null and materialTypeName != ''"> and material_type_name like concat('%', #{materialTypeName}, '%')</if>
|
||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||
<if test="level != null "> and level = #{level}</if>
|
||||
|
|
@ -32,21 +34,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectSupermarketMaterialTypeByMaterialTypeId" parameterType="Long" resultMap="SupermarketMaterialTypeResult">
|
||||
<include refid="selectSupermarketMaterialTypeVo"/>
|
||||
where material_type_id = #{materialTypeId}
|
||||
where goods_type = 2 and material_type_id = #{materialTypeId}
|
||||
</select>
|
||||
|
||||
<select id="selectSupermarketMaterialTypeByMaterialTypeName" resultMap="SupermarketMaterialTypeResult">
|
||||
<include refid="selectSupermarketMaterialTypeVo"/>
|
||||
where material_type_name = #{materialTypeName}
|
||||
where goods_type = 2 and material_type_name = #{materialTypeName}
|
||||
</select>
|
||||
|
||||
<insert id="insertSupermarketMaterialType" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketMaterialType" useGeneratedKeys="true" keyProperty="materialTypeId">
|
||||
insert into supermarket_material_type
|
||||
insert into cook_material_type
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="materialTypeName != null and materialTypeName != ''">material_type_name,</if>
|
||||
<if test="parentId != null">parent_id,</if>
|
||||
<if test="level != null">level,</if>
|
||||
<if test="areaId != null">area_id,</if>
|
||||
<if test="goodsType != null">goods_type,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
|
|
@ -57,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="parentId != null">#{parentId},</if>
|
||||
<if test="level != null">#{level},</if>
|
||||
<if test="areaId != null">#{areaId},</if>
|
||||
<if test="goodsType != null">#{goodsType},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
|
|
@ -65,12 +69,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</insert>
|
||||
|
||||
<update id="updateSupermarketMaterialType" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketMaterialType">
|
||||
update supermarket_material_type
|
||||
update cook_material_type
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="materialTypeName != null and materialTypeName != ''">material_type_name = #{materialTypeName},</if>
|
||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||
<if test="level != null">level = #{level},</if>
|
||||
<if test="areaId != null">area_id = #{areaId},</if>
|
||||
<if test="goodsType != null">goods_type = #{goodsType},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
|
|
@ -80,11 +85,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<delete id="deleteSupermarketMaterialTypeByMaterialTypeId" parameterType="Long">
|
||||
delete from supermarket_material_type where material_type_id = #{materialTypeId}
|
||||
delete from cook_material_type where material_type_id = #{materialTypeId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSupermarketMaterialTypeByMaterialTypeIds" parameterType="String">
|
||||
delete from supermarket_material_type where material_type_id in
|
||||
delete from cook_material_type where material_type_id in
|
||||
<foreach item="materialTypeId" collection="array" open="(" separator="," close=")">
|
||||
#{materialTypeId}
|
||||
</foreach>
|
||||
|
|
@ -92,8 +97,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getSupermarketMaterialTypeChildCountByMaterialTypes" resultType="Integer">
|
||||
select count(1)
|
||||
from supermarket_material_type
|
||||
where parent_id in
|
||||
from cook_material_type
|
||||
where goods_type = 2 and parent_id in
|
||||
<foreach item="materialTypeId" collection="array" open="(" separator="," close=")">
|
||||
#{materialTypeId}
|
||||
</foreach>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
from supermarket_product sp
|
||||
left join cook_material sm on sm.material_id = sp.material_id
|
||||
left join ims_unit iu on iu.unit_id = sm.unit_id
|
||||
left join supermarket_material_type smt on smt.material_type_id = sm.material_type_id
|
||||
left join cook_material_type smt on smt.material_type_id = sm.material_type_id
|
||||
</sql>
|
||||
|
||||
<select id="selectSupermarketProductList" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketProduct" resultMap="SupermarketProductResult">
|
||||
|
|
@ -62,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ba.area_name, smt.material_type_name, iu.unit_name
|
||||
from cook_material sm
|
||||
left join basic_area ba on ba.area_id = sm.area_id
|
||||
left join supermarket_material_type smt on smt.material_type_id = sm.material_type_id
|
||||
left join cook_material_type smt on smt.material_type_id = sm.material_type_id
|
||||
left join ims_unit iu on iu.unit_id = sm.unit_id
|
||||
left join supermarket_product sp on sm.material_id=sp.material_id
|
||||
where sm.goods_type = 2 and sp.material_id is null
|
||||
|
|
|
|||
Loading…
Reference in New Issue