每日菜谱接口重写
This commit is contained in:
1 parent
e42d890504
commit
423bfdac08
10 files changed
+127
-1
No files matched your search
+24
@@ -0,0 +1,24 @@
|
||||
package com.bsd.pjcloud.canteen.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ml
|
||||
* 菜品下拉框主页展示
|
||||
*/
|
||||
@Data
|
||||
public class DailyMenuAll {
|
||||
|
||||
/**
|
||||
* 时间类型
|
||||
*/
|
||||
private Integer hourType;
|
||||
|
||||
/**
|
||||
* 菜品信息
|
||||
*/
|
||||
private List<DailyMenuVO> dailyMenuVOS;
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.bsd.pjcloud.canteen.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author ml
|
||||
* 菜品下拉框
|
||||
*/
|
||||
@Data
|
||||
public class DailyMenuVO {
|
||||
|
||||
/**
|
||||
* 菜品id
|
||||
*/
|
||||
private Long id ;
|
||||
|
||||
/**
|
||||
* 每日id
|
||||
*/
|
||||
private Long tid ;
|
||||
|
||||
/**
|
||||
* 菜品名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 菜品封面图
|
||||
*/
|
||||
private String picUrl;
|
||||
|
||||
/**
|
||||
* 时间类型
|
||||
*/
|
||||
private Integer hourType;
|
||||
}
|
||||
+3
-1
@@ -11,6 +11,7 @@ import com.bsd.pjcloud.canteen.service.CanteenCategoryService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
@@ -50,7 +51,7 @@ public class CanteenCategoryController {
|
||||
public R getCanteenCategoryPage(@ParameterObject Page page, @ParameterObject CanteenCategoryEntity canteenCategory) {
|
||||
LambdaQueryWrapper<CanteenCategoryEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StrUtil.isNotBlank(canteenCategory.getName()),CanteenCategoryEntity::getName,canteenCategory.getName());
|
||||
return R.ok(canteenCategoryService.page(page, wrapper));
|
||||
return R.ok(canteenCategoryService.selectPageByScope(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +77,7 @@ public class CanteenCategoryController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_add')" )
|
||||
public R save(@RequestBody CanteenCategoryEntity canteenCategory) {
|
||||
canteenCategory.setDeptId(SecurityUtils.getUser().getDeptId());
|
||||
return R.ok(canteenCategoryService.save(canteenCategory));
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -3,13 +3,16 @@ package com.bsd.pjcloud.canteen.controller;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.excel.util.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenDailyMenuEntity;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenSpuService;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
@@ -77,6 +80,7 @@ public class CanteenSpuController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_add')" )
|
||||
public R save(@RequestBody CanteenSpuEntity canteenSpu) {
|
||||
canteenSpu.setDeptId(SecurityUtils.getUser().getDeptId());
|
||||
return R.ok(canteenSpuService.save(canteenSpu));
|
||||
}
|
||||
|
||||
@@ -119,4 +123,6 @@ public class CanteenSpuController {
|
||||
public List<CanteenSpuEntity> export(CanteenSpuEntity canteenSpu,Long[] ids) {
|
||||
return canteenSpuService.list(Wrappers.lambdaQuery(canteenSpu).in(ArrayUtil.isNotEmpty(ids), CanteenSpuEntity::getId, ids));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+7
@@ -1,11 +1,18 @@
|
||||
package com.bsd.pjcloud.canteen.mapper;
|
||||
|
||||
import com.bsd.pjcloud.canteen.dto.DailyMenuAll;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CanteenSpuMapper extends PjcloudBaseMapper<CanteenSpuEntity> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+10
@@ -1,8 +1,18 @@
|
||||
package com.bsd.pjcloud.canteen.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
|
||||
|
||||
public interface CanteenCategoryService extends IService<CanteenCategoryEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 分页获取菜品分类
|
||||
* @param page
|
||||
* @param wrapper
|
||||
* @return
|
||||
*/
|
||||
Page<CanteenCategoryEntity> selectPageByScope(Page page, LambdaQueryWrapper<CanteenCategoryEntity> wrapper);
|
||||
}
|
||||
+13
@@ -1,8 +1,21 @@
|
||||
package com.bsd.pjcloud.canteen.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.canteen.dto.DailyMenuAll;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CanteenSpuService extends IService<CanteenSpuEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 菜品下拉列表
|
||||
* @param wrapper
|
||||
* @return
|
||||
*/
|
||||
Object selectFoodList(LambdaQueryWrapper<CanteenSpuEntity> wrapper);
|
||||
|
||||
|
||||
}
|
||||
+13
@@ -1,10 +1,17 @@
|
||||
package com.bsd.pjcloud.canteen.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenCategoryMapper;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenCategoryService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜品分类
|
||||
*
|
||||
@@ -13,4 +20,10 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class CanteenCategoryServiceImpl extends ServiceImpl<CanteenCategoryMapper, CanteenCategoryEntity> implements CanteenCategoryService {
|
||||
@Override
|
||||
public Page<CanteenCategoryEntity> selectPageByScope(Page page, LambdaQueryWrapper<CanteenCategoryEntity> wrapper) {
|
||||
|
||||
|
||||
return baseMapper.selectPageByScope(page,wrapper,DataScope.of());
|
||||
}
|
||||
}
|
||||
+14
@@ -1,10 +1,18 @@
|
||||
package com.bsd.pjcloud.canteen.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.canteen.dto.DailyMenuAll;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenSpuMapper;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenSpuService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜品spu
|
||||
*
|
||||
@@ -13,4 +21,10 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class CanteenSpuServiceImpl extends ServiceImpl<CanteenSpuMapper, CanteenSpuEntity> implements CanteenSpuService {
|
||||
@Override
|
||||
public Object selectFoodList(LambdaQueryWrapper<CanteenSpuEntity> wrapper) {
|
||||
return baseMapper.selectListByScope(wrapper, DataScope.of());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -32,4 +32,5 @@
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
Reference in new issue
Block a user