包厢添加部门数据过滤

This commit is contained in:
zjf committed 2024-12-16 22:49:59 +08:00
1 parent aef34aea58
commit b03c4439fc
5 files changed
+24 -1

No files matched your search

@@ -10,6 +10,7 @@ import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.canteen.entity.BoxesInfoEntity;
import com.bsd.pjcloud.canteen.service.BoxesInfoService;
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;
@@ -50,7 +51,7 @@ public class BoxesInfoController {
public R getBoxesInfoPage(@ParameterObject Page page, @ParameterObject BoxesInfoEntity boxesInfo) {
LambdaQueryWrapper<BoxesInfoEntity> wrapper = Wrappers.lambdaQuery();
wrapper.eq(StrUtil.isNotBlank(boxesInfo.getName()),BoxesInfoEntity::getName,boxesInfo.getName());
return R.ok(boxesInfoService.page(page, wrapper));
return R.ok(boxesInfoService.pageScope(page, wrapper));
}
@@ -76,6 +77,7 @@ public class BoxesInfoController {
@PostMapping
@PreAuthorize("@pms.hasPermission('canteen_boxesInfo_add')" )
public R save(@RequestBody BoxesInfoEntity boxesInfo) {
boxesInfo.setDeptId(SecurityUtils.getUser().getDeptId());
return R.ok(boxesInfoService.save(boxesInfo));
}
@@ -110,4 +110,7 @@ public class BoxesInfoEntity extends Model<BoxesInfoEntity> {
@TableField(fill = FieldFill.INSERT)
@Schema(description="是否删除")
private String delFlag;
@Schema(description="部门id")
private Long deptId;
}
@@ -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.BoxesInfoEntity;
public interface BoxesInfoService extends IService<BoxesInfoEntity> {
/**
* 分页查询当前商户的包厢数据
* @param page
* @param wrapper
* @return
*/
Object pageScope(Page page, LambdaQueryWrapper<BoxesInfoEntity> wrapper);
}
@@ -1,9 +1,12 @@
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.BoxesInfoEntity;
import com.bsd.pjcloud.canteen.mapper.BoxesInfoMapper;
import com.bsd.pjcloud.canteen.service.BoxesInfoService;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import org.springframework.stereotype.Service;
/**
* 包厢信息
@@ -13,4 +16,8 @@ import org.springframework.stereotype.Service;
*/
@Service
public class BoxesInfoServiceImpl extends ServiceImpl<BoxesInfoMapper, BoxesInfoEntity> implements BoxesInfoService {
@Override
public Object pageScope(Page page, LambdaQueryWrapper<BoxesInfoEntity> wrapper) {
return baseMapper.selectPageByScope(page,wrapper, DataScope.of());
}
}
@@ -18,5 +18,6 @@
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="deptId" column="dept_id"/>
</resultMap>
</mapper>