食堂数据权限
This commit is contained in:
1 parent
558be27bce
commit
ad12098ca6
9 files changed
+85
-3
No files matched your search
+13
@@ -0,0 +1,13 @@
|
||||
package com.bsd.pjcloud.canteen.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "在线订餐分类下拉")
|
||||
public class CanteenOnlineCategorySimpleVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
}
|
||||
+17
-1
@@ -6,6 +6,8 @@ import cn.hutool.core.collection.CollUtil;
|
||||
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.vo.CanteenOnlineCategorySimpleVO;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenOnlineCategoryEntity;
|
||||
@@ -49,7 +51,7 @@ public class CanteenOnlineCategoryController {
|
||||
public R getCanteenOnlineCategoryPage(@ParameterObject Page page, @ParameterObject CanteenOnlineCategoryEntity canteenOnlineCategory) {
|
||||
LambdaQueryWrapper<CanteenOnlineCategoryEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StrUtil.isNotBlank(canteenOnlineCategory.getName()),CanteenOnlineCategoryEntity::getName,canteenOnlineCategory.getName());
|
||||
return R.ok(canteenOnlineCategoryService.page(page, wrapper));
|
||||
return R.ok(canteenOnlineCategoryService.pageScope(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
@@ -118,6 +120,20 @@ public class CanteenOnlineCategoryController {
|
||||
return canteenOnlineCategoryService.list(Wrappers.lambdaQuery(canteenOnlineCategory).in(ArrayUtil.isNotEmpty(ids), CanteenOnlineCategoryEntity::getId, ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台分类下拉查询
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "后台分类下拉查询" )
|
||||
@GetMapping("/selectAllSimple" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineCategory_view')" )
|
||||
public R getById() {
|
||||
LambdaQueryWrapper<CanteenOnlineCategoryEntity> canteenOnlineCategoryEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
canteenOnlineCategoryEntityLambdaQueryWrapper.eq(CanteenOnlineCategoryEntity::getStatus,"0");
|
||||
List<CanteenOnlineCategoryEntity> list = canteenOnlineCategoryService.listScope(canteenOnlineCategoryEntityLambdaQueryWrapper);
|
||||
List<CanteenOnlineCategorySimpleVO> bean = BeanUtils.toBean(list, CanteenOnlineCategorySimpleVO.class);
|
||||
return R.ok(bean);
|
||||
}
|
||||
|
||||
|
||||
// ---------------APP---------------------
|
||||
|
||||
+2
@@ -14,6 +14,7 @@ import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenOnlineSpuEntity;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenOnlineSpuService;
|
||||
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;
|
||||
@@ -81,6 +82,7 @@ public class CanteenOnlineSpuController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineSpu_add')" )
|
||||
public R save(@RequestBody CanteenOnlineSpuEntity canteenOnlineSpu) {
|
||||
canteenOnlineSpu.setDeptId(SecurityUtils.getUser().getDeptId());
|
||||
return R.ok(canteenOnlineSpuService.save(canteenOnlineSpu));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ public class CanteenSpuController {
|
||||
LambdaQueryWrapper<CanteenSpuEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StrUtil.isNotBlank(canteenSpu.getName()), CanteenSpuEntity::getName, canteenSpu.getName());
|
||||
wrapper.eq(Objects.nonNull(canteenSpu.getCategoryId()), CanteenSpuEntity::getCategoryId, canteenSpu.getCategoryId());
|
||||
return R.ok(canteenSpuService.page(page, wrapper));
|
||||
return R.ok(canteenSpuService.pageScope(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+20
@@ -1,8 +1,28 @@
|
||||
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.CanteenOnlineCategoryEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CanteenOnlineCategoryService extends IService<CanteenOnlineCategoryEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param wrapper
|
||||
* @return
|
||||
*/
|
||||
Object pageScope(Page page, LambdaQueryWrapper<CanteenOnlineCategoryEntity> wrapper);
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有的分类,通过数据权限
|
||||
* @param canteenOnlineCategoryEntityLambdaQueryWrapper
|
||||
* @return
|
||||
*/
|
||||
List<CanteenOnlineCategoryEntity> listScope(LambdaQueryWrapper<CanteenOnlineCategoryEntity> canteenOnlineCategoryEntityLambdaQueryWrapper);
|
||||
}
|
||||
+10
@@ -1,6 +1,7 @@
|
||||
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.dto.CanteenSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
|
||||
@@ -31,4 +32,13 @@ public interface CanteenSpuService extends IService<CanteenSpuEntity> {
|
||||
* @return
|
||||
*/
|
||||
R getCanteenSpuList(String categoryId);
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param wrapper
|
||||
* @return
|
||||
*/
|
||||
Object pageScope(Page page, LambdaQueryWrapper<CanteenSpuEntity> wrapper);
|
||||
}
|
||||
+1
-1
@@ -40,7 +40,7 @@ public class CanteenDailyMenuServiceImpl extends ServiceImpl<CanteenDailyMenuMap
|
||||
@Override
|
||||
public List<DailyMenuAll> selectTimeFood(String time, Long merchantId, Long categoryId) {
|
||||
List<DailyMenuAll> dailyMenuAllES = new ArrayList<>();
|
||||
List<DailyMenuVO> dailyMenuVOS = baseMapper.selectTimeFood(time, merchantId, categoryId, new DataScope());
|
||||
List<DailyMenuVO> dailyMenuVOS = baseMapper.selectTimeFood(time, merchantId, categoryId, DataScope.of());
|
||||
Map<Integer, List<DailyMenuVO>> collect = dailyMenuVOS.stream().collect(Collectors.groupingBy(DailyMenuVO::getHourType));
|
||||
collect.keySet().forEach(x -> {
|
||||
DailyMenuAll dailyMenuAll = new DailyMenuAll();
|
||||
|
||||
+15
@@ -1,10 +1,16 @@
|
||||
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.CanteenOnlineCategoryEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenOnlineCategoryMapper;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenOnlineCategoryService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 在线点餐分类
|
||||
*
|
||||
@@ -13,4 +19,13 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class CanteenOnlineCategoryServiceImpl extends ServiceImpl<CanteenOnlineCategoryMapper, CanteenOnlineCategoryEntity> implements CanteenOnlineCategoryService {
|
||||
@Override
|
||||
public Object pageScope(Page page, LambdaQueryWrapper<CanteenOnlineCategoryEntity> wrapper) {
|
||||
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CanteenOnlineCategoryEntity> listScope(LambdaQueryWrapper<CanteenOnlineCategoryEntity> canteenOnlineCategoryEntityLambdaQueryWrapper) {
|
||||
return baseMapper.selectListByScope(canteenOnlineCategoryEntityLambdaQueryWrapper, DataScope.of());
|
||||
}
|
||||
}
|
||||
+6
@@ -1,6 +1,7 @@
|
||||
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.dto.CanteenSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
|
||||
@@ -58,5 +59,10 @@ public class CanteenSpuServiceImpl extends ServiceImpl<CanteenSpuMapper, Canteen
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object pageScope(Page page, LambdaQueryWrapper<CanteenSpuEntity> wrapper) {
|
||||
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user