暂存
This commit is contained in:
@ -0,0 +1,83 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.stdiet.common.annotation.Excel;
|
||||
import com.stdiet.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 菜品对象 sys_dishes
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2020-12-28
|
||||
*/
|
||||
public class SysDishes extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
private Long id;
|
||||
|
||||
/** 菜品名称 */
|
||||
@Excel(name = "菜品名称")
|
||||
private String name;
|
||||
|
||||
/** 菜品类型 */
|
||||
@Excel(name = "菜品类型")
|
||||
private String type;
|
||||
|
||||
/** 做法 */
|
||||
@Excel(name = "做法")
|
||||
private String methods;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
public void setMethods(String methods)
|
||||
{
|
||||
this.methods = methods;
|
||||
}
|
||||
|
||||
public String getMethods()
|
||||
{
|
||||
return methods;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("type", getType())
|
||||
.append("methods", getMethods())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.stdiet.custom.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysDishes;
|
||||
|
||||
/**
|
||||
* 菜品Mapper接口
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2020-12-28
|
||||
*/
|
||||
public interface SysDishesMapper
|
||||
{
|
||||
/**
|
||||
* 查询菜品
|
||||
*
|
||||
* @param id 菜品ID
|
||||
* @return 菜品
|
||||
*/
|
||||
public SysDishes selectSysDishesById(Long id);
|
||||
|
||||
/**
|
||||
* 查询菜品列表
|
||||
*
|
||||
* @param sysDishes 菜品
|
||||
* @return 菜品集合
|
||||
*/
|
||||
public List<SysDishes> selectSysDishesList(SysDishes sysDishes);
|
||||
|
||||
/**
|
||||
* 新增菜品
|
||||
*
|
||||
* @param sysDishes 菜品
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysDishes(SysDishes sysDishes);
|
||||
|
||||
/**
|
||||
* 修改菜品
|
||||
*
|
||||
* @param sysDishes 菜品
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysDishes(SysDishes sysDishes);
|
||||
|
||||
/**
|
||||
* 删除菜品
|
||||
*
|
||||
* @param id 菜品ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysDishesById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除菜品
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysDishesByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.stdiet.custom.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysDishes;
|
||||
|
||||
/**
|
||||
* 菜品Service接口
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2020-12-28
|
||||
*/
|
||||
public interface ISysDishesService
|
||||
{
|
||||
/**
|
||||
* 查询菜品
|
||||
*
|
||||
* @param id 菜品ID
|
||||
* @return 菜品
|
||||
*/
|
||||
public SysDishes selectSysDishesById(Long id);
|
||||
|
||||
/**
|
||||
* 查询菜品列表
|
||||
*
|
||||
* @param sysDishes 菜品
|
||||
* @return 菜品集合
|
||||
*/
|
||||
public List<SysDishes> selectSysDishesList(SysDishes sysDishes);
|
||||
|
||||
/**
|
||||
* 新增菜品
|
||||
*
|
||||
* @param sysDishes 菜品
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysDishes(SysDishes sysDishes);
|
||||
|
||||
/**
|
||||
* 修改菜品
|
||||
*
|
||||
* @param sysDishes 菜品
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysDishes(SysDishes sysDishes);
|
||||
|
||||
/**
|
||||
* 批量删除菜品
|
||||
*
|
||||
* @param ids 需要删除的菜品ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysDishesByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除菜品信息
|
||||
*
|
||||
* @param id 菜品ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysDishesById(Long id);
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.stdiet.custom.mapper.SysDishesMapper;
|
||||
import com.stdiet.custom.domain.SysDishes;
|
||||
import com.stdiet.custom.service.ISysDishesService;
|
||||
|
||||
/**
|
||||
* 菜品Service业务层处理
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2020-12-28
|
||||
*/
|
||||
@Service
|
||||
public class SysDishesServiceImpl implements ISysDishesService
|
||||
{
|
||||
@Autowired
|
||||
private SysDishesMapper sysDishesMapper;
|
||||
|
||||
/**
|
||||
* 查询菜品
|
||||
*
|
||||
* @param id 菜品ID
|
||||
* @return 菜品
|
||||
*/
|
||||
@Override
|
||||
public SysDishes selectSysDishesById(Long id)
|
||||
{
|
||||
return sysDishesMapper.selectSysDishesById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜品列表
|
||||
*
|
||||
* @param sysDishes 菜品
|
||||
* @return 菜品
|
||||
*/
|
||||
@Override
|
||||
public List<SysDishes> selectSysDishesList(SysDishes sysDishes)
|
||||
{
|
||||
return sysDishesMapper.selectSysDishesList(sysDishes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜品
|
||||
*
|
||||
* @param sysDishes 菜品
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysDishes(SysDishes sysDishes)
|
||||
{
|
||||
sysDishes.setCreateTime(DateUtils.getNowDate());
|
||||
return sysDishesMapper.insertSysDishes(sysDishes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜品
|
||||
*
|
||||
* @param sysDishes 菜品
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysDishes(SysDishes sysDishes)
|
||||
{
|
||||
sysDishes.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysDishesMapper.updateSysDishes(sysDishes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除菜品
|
||||
*
|
||||
* @param ids 需要删除的菜品ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysDishesByIds(Long[] ids)
|
||||
{
|
||||
return sysDishesMapper.deleteSysDishesByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜品信息
|
||||
*
|
||||
* @param id 菜品ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysDishesById(Long id)
|
||||
{
|
||||
return sysDishesMapper.deleteSysDishesById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
<?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">
|
||||
<mapper namespace="com.stdiet.custom.mapper.SysDishesMapper">
|
||||
|
||||
<resultMap type="SysDishes" id="SysDishesResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="type" column="type" />
|
||||
<result property="methods" column="methods" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysDishesVo">
|
||||
select id, name, type, methods, create_by, create_time, update_by, update_time from sys_dishes
|
||||
</sql>
|
||||
|
||||
<select id="selectSysDishesList" parameterType="SysDishes" resultMap="SysDishesResult">
|
||||
<include refid="selectSysDishesVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysDishesById" parameterType="Long" resultMap="SysDishesResult">
|
||||
<include refid="selectSysDishesVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysDishes" parameterType="SysDishes" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_dishes
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="methods != null">methods,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="methods != null">#{methods},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysDishes" parameterType="SysDishes">
|
||||
update sys_dishes
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="methods != null">methods = #{methods},</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>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysDishesById" parameterType="Long">
|
||||
delete from sys_dishes where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysDishesByIds" parameterType="String">
|
||||
delete from sys_dishes where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -22,26 +22,79 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysIngredientVo">
|
||||
-- select id, name, type, protein_ratio, fat_ratio, carbon_ratio, area, remark, create_by, create_time, update_by, update_time from sys_ingredient
|
||||
SELECT * FROM sys_ingredient igd
|
||||
LEFT JOIN (
|
||||
LEFT JOIN (
|
||||
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') not_rec FROM(
|
||||
SELECT physical_signs_id as id, ingredient_id
|
||||
FROM sys_ingredient_not_rec
|
||||
SELECT physical_signs_id as id, ingredient_id
|
||||
FROM sys_ingredient_not_rec
|
||||
) notRec JOIN sys_physical_signs phy USING(id)
|
||||
GROUP BY id
|
||||
) notRecT USING(id)
|
||||
LEFT JOIN (
|
||||
) notRecT USING(id)
|
||||
LEFT JOIN (
|
||||
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') rec FROM(
|
||||
SELECT physical_signs_id as id, ingredient_id
|
||||
FROM sys_ingredient_rec
|
||||
SELECT physical_signs_id as id, ingredient_id
|
||||
FROM sys_ingredient_rec
|
||||
) rec JOIN sys_physical_signs phy USING(id)
|
||||
GROUP BY id) recT
|
||||
USING(id)
|
||||
GROUP BY id
|
||||
) recT USING(id)
|
||||
</sql>
|
||||
|
||||
<sql id="selectSysIngredientByPhyVo">
|
||||
SELECT * FROM sys_ingredient igd
|
||||
RIGHT JOIN(
|
||||
SELECT * FROM(
|
||||
SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_rec
|
||||
<where>
|
||||
<if test="recIds != null">
|
||||
physical_signs_id in
|
||||
<foreach collection="recIds" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
) recId
|
||||
LEFT JOIN (
|
||||
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') rec FROM(
|
||||
SELECT physical_signs_id as id, ingredient_id
|
||||
FROM sys_ingredient_rec
|
||||
) rec JOIN sys_physical_signs phy USING(id)
|
||||
GROUP BY id
|
||||
) recM USING(id)
|
||||
INNER JOIN (
|
||||
SELECT * FROM(
|
||||
SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_not_rec
|
||||
<where>
|
||||
<if test="notRecIds != null">
|
||||
physical_signs_id in
|
||||
<foreach collection="notRecIds" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
) notRecId
|
||||
LEFT JOIN (
|
||||
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') not_rec FROM(
|
||||
SELECT physical_signs_id as id, ingredient_id
|
||||
FROM sys_ingredient_not_rec
|
||||
) notRec JOIN sys_physical_signs phy USING(id)
|
||||
GROUP BY id
|
||||
) notRecM USING(id)
|
||||
) notRecT USING(id)
|
||||
) recT USING(id)
|
||||
</sql>
|
||||
|
||||
<select id="selectSysIngredientList" parameterType="SysIngredient" resultMap="SysIngredientResult">
|
||||
<include refid="selectSysIngredientVo"/>
|
||||
<choose>
|
||||
<when test="recIds == null and notRecIds == null">
|
||||
<include refid="selectSysIngredientVo"/>
|
||||
</when>
|
||||
<otherwise>
|
||||
<include refid="selectSysIngredientByPhyVo">
|
||||
<property name="recIds" value="#{recIds}"/>
|
||||
<property name="notRecIds" value="#{notRecIds}"/>
|
||||
</include>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
|
Reference in New Issue
Block a user