Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4fe5bf5c20
|
|
@ -86,4 +86,10 @@ public interface CookNutritionTypeMapper {
|
|||
* @return 食材小类列表
|
||||
*/
|
||||
public List<NutritionTypeVO> selectLittleTypeList(String id);
|
||||
/**
|
||||
* 检查是否存在菜品使用了指定的营养类型
|
||||
* @param nutritionTypeIds 营养类型ID数组
|
||||
* @return 存在的数量
|
||||
*/
|
||||
int checkIsExistCook(@Param("nutritionTypeIds") Long[] nutritionTypeIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,6 +123,11 @@ public class CookNutritionTypeServiceImpl implements ICookNutritionTypeService {
|
|||
if (code > 0) {
|
||||
throw new ServiceException("删除失败,营养类型下存在子集");
|
||||
}
|
||||
// 检查是否有食材使用该营养类型
|
||||
int count = cookNutritionTypeMapper.checkIsExistCook(nutritionTypeIds);
|
||||
if (count > 0) {
|
||||
throw new ServiceException("删除失败,营养类型下存在食材");
|
||||
}
|
||||
return cookNutritionTypeMapper.deleteCookNutritionTypeByNutritionTypeIds(nutritionTypeIds);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class DataScreeningServiceImpl implements DataScreeningService {
|
|||
String currentDate = DateUtils.getDate();
|
||||
String yesterday = getLastDate(-1);
|
||||
//获取上一个有食堂订单的日期
|
||||
yesterday = getLastDate(lastDay, yesterday);
|
||||
// yesterday = getLastDate(lastDay, yesterday);
|
||||
// 查询各项数据
|
||||
addSingleItem("今日食堂营业额(元)", currentDate, yesterday, list, 11, TURNOVER);
|
||||
addSingleItem("今日食堂订单量(个)", currentDate, yesterday, list, 11, ORDER);
|
||||
|
|
@ -135,6 +135,9 @@ public class DataScreeningServiceImpl implements DataScreeningService {
|
|||
BigDecimal rate = todayNum.subtract(yesterdayNum)
|
||||
.divide(yesterdayNum, 4, RoundingMode.HALF_UP)
|
||||
.multiply(BigDecimal.valueOf(100));
|
||||
if (rate.compareTo(BigDecimal.valueOf(100)) > 0) {
|
||||
rate = BigDecimal.valueOf(100);
|
||||
}
|
||||
today.setRate(String.format("%.2f", rate));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,4 +99,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{nutritionTypeId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="checkIsExistCook" resultType="int">
|
||||
select count(1) from cook_nutrition where nutrition_type_id in
|
||||
<foreach item="nutritionTypeId" collection="nutritionTypeIds" open="(" separator="," close=")">
|
||||
#{nutritionTypeId}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue