feat:菜品分类权限问题
This commit is contained in:
1 parent
32cac3558b
commit
8cd122a5d6
3 files changed
+52
-8
No files matched your search
+4
-8
@@ -69,28 +69,24 @@ public class CanteenOnlineCategoryController {
|
||||
|
||||
/**
|
||||
* 新增在线点餐分类
|
||||
* @param canteenOnlineCategory 在线点餐分类
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增在线点餐分类" , description = "新增在线点餐分类" )
|
||||
@SysLog("新增在线点餐分类" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineCategory_add')" )
|
||||
public R save(@RequestBody CanteenOnlineCategoryEntity canteenOnlineCategory) {
|
||||
return R.ok(canteenOnlineCategoryService.save(canteenOnlineCategory));
|
||||
public R save(@RequestBody CanteenOnlineCategoryEntity dto) {
|
||||
return R.ok(canteenOnlineCategoryService.create(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改在线点餐分类
|
||||
* @param canteenOnlineCategory 在线点餐分类
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改在线点餐分类" , description = "修改在线点餐分类" )
|
||||
@SysLog("修改在线点餐分类" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineCategory_edit')" )
|
||||
public R updateById(@RequestBody CanteenOnlineCategoryEntity canteenOnlineCategory) {
|
||||
return R.ok(canteenOnlineCategoryService.updateById(canteenOnlineCategory));
|
||||
public R updateById(@RequestBody CanteenOnlineCategoryEntity dto) {
|
||||
return R.ok(canteenOnlineCategoryService.edit(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+12
@@ -12,6 +12,7 @@ public interface CanteenOnlineCategoryService extends IService<CanteenOnlineCate
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page
|
||||
* @param wrapper
|
||||
* @return
|
||||
@@ -21,8 +22,19 @@ public interface CanteenOnlineCategoryService extends IService<CanteenOnlineCate
|
||||
|
||||
/**
|
||||
* 查询所有的分类,通过数据权限
|
||||
*
|
||||
* @param canteenOnlineCategoryEntityLambdaQueryWrapper
|
||||
* @return
|
||||
*/
|
||||
List<CanteenOnlineCategoryEntity> listScope(LambdaQueryWrapper<CanteenOnlineCategoryEntity> canteenOnlineCategoryEntityLambdaQueryWrapper);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
Long create(CanteenOnlineCategoryEntity dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
Long edit(CanteenOnlineCategoryEntity dto);
|
||||
}
|
||||
+36
@@ -1,5 +1,6 @@
|
||||
package com.bsd.pjcloud.canteen.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -7,6 +8,9 @@ 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 com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -18,7 +22,11 @@ import java.util.List;
|
||||
* @date 2024-12-17 13:03:14
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CanteenOnlineCategoryServiceImpl extends ServiceImpl<CanteenOnlineCategoryMapper, CanteenOnlineCategoryEntity> implements CanteenOnlineCategoryService {
|
||||
|
||||
private final RemoteMchService remoteMchService;
|
||||
|
||||
@Override
|
||||
public Object pageScope(Page page, LambdaQueryWrapper<CanteenOnlineCategoryEntity> wrapper) {
|
||||
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
|
||||
@@ -28,4 +36,32 @@ public class CanteenOnlineCategoryServiceImpl extends ServiceImpl<CanteenOnlineC
|
||||
public List<CanteenOnlineCategoryEntity> listScope(LambdaQueryWrapper<CanteenOnlineCategoryEntity> canteenOnlineCategoryEntityLambdaQueryWrapper) {
|
||||
return baseMapper.selectListByScope(canteenOnlineCategoryEntityLambdaQueryWrapper, DataScope.of());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@Override
|
||||
public Long create(CanteenOnlineCategoryEntity dto) {
|
||||
// 查询商户对应的部门id
|
||||
MchManageVo mchVo = remoteMchService.getById(dto.getMerchantId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchVo)) {
|
||||
dto.setDeptId(mchVo.getDeptId());
|
||||
}
|
||||
baseMapper.insert(dto);
|
||||
return dto.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
@Override
|
||||
public Long edit(CanteenOnlineCategoryEntity dto) {
|
||||
// 查询商户对应的部门id
|
||||
MchManageVo mchVo = remoteMchService.getById(dto.getMerchantId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchVo)) {
|
||||
dto.setDeptId(mchVo.getDeptId());
|
||||
}
|
||||
baseMapper.updateById(dto);
|
||||
return dto.getId();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user