This commit is contained in:
dzc committed 2025-01-09 20:51:05 +08:00
commit c44bfe4151
17 files changed
+128 -5

No files matched your search

@@ -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;
}
@@ -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---------------------
@@ -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));
}
@@ -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));
}
@@ -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);
}
@@ -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);
}
@@ -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();
@@ -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());
}
}
@@ -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());
}
}
@@ -107,4 +107,7 @@ public class SupermarketBrandEntity extends Model<SupermarketBrandEntity> {
*/
@Schema(description="商户id")
private Long merchantId;
@Schema(description="部门id")
private Long deptId;
}
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.common.security.util.SecurityUtils;
import com.bsd.pjcloud.supermarket.entity.SupermarketBrandEntity;
import com.bsd.pjcloud.supermarket.service.SupermarketBrandService;
import com.bsd.pjcloud.supermarket.vo.SupermarketBrandSimpleVo;
@@ -51,7 +52,7 @@ public class SupermarketBrandController {
public R getSupermarketBrandPage(@ParameterObject Page page, @ParameterObject SupermarketBrandEntity supermarketBrand) {
LambdaQueryWrapper<SupermarketBrandEntity> wrapper = Wrappers.lambdaQuery();
wrapper.like(StrUtil.isNotBlank(supermarketBrand.getName()),SupermarketBrandEntity::getName,supermarketBrand.getName());
return R.ok(supermarketBrandService.page(page, wrapper));
return R.ok(supermarketBrandService.pagescope(page, wrapper));
}
@@ -77,6 +78,7 @@ public class SupermarketBrandController {
@PostMapping
@PreAuthorize("@pms.hasPermission('supermarket_supermarketBrand_add')" )
public R save(@RequestBody SupermarketBrandEntity supermarketBrand) {
supermarketBrand.setDeptId(SecurityUtils.getUser().getDeptId());
return R.ok(supermarketBrandService.save(supermarketBrand));
}
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.common.security.util.SecurityUtils;
import com.bsd.pjcloud.supermarket.entity.SupermarketCategoryEntity;
import com.bsd.pjcloud.supermarket.service.SupermarketCategoryService;
import com.bsd.pjcloud.supermarket.vo.SupermarketCategorySimpleVo;
@@ -51,7 +52,7 @@ public class SupermarketCategoryController {
public R getSupermarketCategoryPage(@ParameterObject Page page, @ParameterObject SupermarketCategoryEntity supermarketCategory) {
LambdaQueryWrapper<SupermarketCategoryEntity> wrapper = Wrappers.lambdaQuery();
wrapper.like(StrUtil.isNotBlank(supermarketCategory.getName()),SupermarketCategoryEntity::getName,supermarketCategory.getName());
return R.ok(supermarketCategoryService.page(page, wrapper));
return R.ok(supermarketCategoryService.pageScope(page, wrapper));
}
@@ -77,6 +78,7 @@ public class SupermarketCategoryController {
@PostMapping
@PreAuthorize("@pms.hasPermission('supermarket_supermarketCategory_add')" )
public R save(@RequestBody SupermarketCategoryEntity supermarketCategory) {
supermarketCategory.setDeptId(SecurityUtils.getUser().getDeptId());
return R.ok(supermarketCategoryService.save(supermarketCategory));
}
@@ -1,8 +1,18 @@
package com.bsd.pjcloud.supermarket.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.supermarket.entity.SupermarketBrandEntity;
public interface SupermarketBrandService extends IService<SupermarketBrandEntity> {
/**
* 品牌分页scpoe
* @param page
* @param wrapper
* @return
*/
Object pagescope(Page page, LambdaQueryWrapper<SupermarketBrandEntity> wrapper);
}
@@ -1,5 +1,7 @@
package com.bsd.pjcloud.supermarket.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.supermarket.entity.SupermarketCategoryEntity;
@@ -13,4 +15,12 @@ public interface SupermarketCategoryService extends IService<SupermarketCategory
* @return
*/
List<SupermarketCategoryEntity> listScope();
/**
* 分页查询
* @param page
* @param wrapper
* @return
*/
Object pageScope(Page page, LambdaQueryWrapper<SupermarketCategoryEntity> wrapper);
}
@@ -1,6 +1,9 @@
package com.bsd.pjcloud.supermarket.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.common.data.datascope.DataScope;
import com.bsd.pjcloud.supermarket.entity.SupermarketBrandEntity;
import com.bsd.pjcloud.supermarket.mapper.SupermarketBrandMapper;
import com.bsd.pjcloud.supermarket.service.SupermarketBrandService;
@@ -13,4 +16,8 @@ import org.springframework.stereotype.Service;
*/
@Service
public class SupermarketBrandServiceImpl extends ServiceImpl<SupermarketBrandMapper, SupermarketBrandEntity> implements SupermarketBrandService {
@Override
public Object pagescope(Page page, LambdaQueryWrapper<SupermarketBrandEntity> wrapper) {
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
}
}
@@ -1,6 +1,7 @@
package com.bsd.pjcloud.supermarket.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.common.data.datascope.DataScope;
import com.bsd.pjcloud.supermarket.entity.SupermarketCategoryEntity;
@@ -22,4 +23,9 @@ public class SupermarketCategoryServiceImpl extends ServiceImpl<SupermarketCateg
public List<SupermarketCategoryEntity> listScope() {
return baseMapper.selectListByScope(new LambdaQueryWrapper<SupermarketCategoryEntity>(), DataScope.of());
}
@Override
public Object pageScope(Page page, LambdaQueryWrapper<SupermarketCategoryEntity> wrapper) {
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
}
}
@@ -17,5 +17,6 @@
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
<result property="merchantId" column="merchant_id"/>
<result property="deptId" column="dept_id"/>
</resultMap>
</mapper>