超市数据权限

This commit is contained in:
zjf committed 2025-01-09 16:21:35 +08:00
1 parent 872ebe235f
commit 558be27bce
8 files changed
+43 -2

No files matched your search

@@ -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>