This commit is contained in:
dzc committed 2025-05-13 10:38:23 +08:00
commit b80cdede7b
4 files changed
+84 -2

No files matched your search

@@ -0,0 +1,23 @@
package com.bsd.pjcloud.canteen.vo.erp;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "货商下拉")
public class CanteenSupplierSimpleVo {
/**
* id
*/
@Schema(description="id")
private Long supplierId;
/**
* 货商类别名称
*/
@Schema(description="货商名称")
private String supplierName;
}
@@ -6,10 +6,13 @@ 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.erp.CanteenSupplierSimpleVo;
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.CanteenSupplierEntity;
import com.bsd.pjcloud.canteen.service.CanteenSupplierService;
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;
@@ -21,7 +24,6 @@ import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 货商信息
@@ -51,7 +53,7 @@ public class CanteenSupplierController {
LambdaQueryWrapper<CanteenSupplierEntity> wrapper = Wrappers.lambdaQuery();
wrapper.like(StrUtil.isNotBlank(canteenSupplier.getSupplierName()),CanteenSupplierEntity::getSupplierName,canteenSupplier.getSupplierName());
wrapper.eq(StrUtil.isNotBlank(canteenSupplier.getPhone()),CanteenSupplierEntity::getPhone,canteenSupplier.getPhone());
return R.ok(canteenSupplierService.page(page, wrapper));
return R.ok(canteenSupplierService.pageScope(page, wrapper));
}
@@ -77,6 +79,7 @@ public class CanteenSupplierController {
@PostMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenSupplier_add')" )
public R save(@RequestBody CanteenSupplierEntity canteenSupplier) {
canteenSupplier.setDeptId(SecurityUtils.getUser().getDeptId());
return R.ok(canteenSupplierService.save(canteenSupplier));
}
@@ -119,4 +122,17 @@ public class CanteenSupplierController {
public List<CanteenSupplierEntity> export(CanteenSupplierEntity canteenSupplier,Long[] ids) {
return canteenSupplierService.list(Wrappers.lambdaQuery(canteenSupplier).in(ArrayUtil.isNotEmpty(ids), CanteenSupplierEntity::getSupplierId, ids));
}
/**
* 货商下拉
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/selectSimpleAll" )
public R selectSimpleAll(@RequestParam(value = "name",required = false)String name,
@RequestParam(value = "supplierId",required = false)Long supplierId) {
List<CanteenSupplierEntity> list = canteenSupplierService.selectSimpleAllScope(name,supplierId);
List<CanteenSupplierSimpleVo> bean = BeanUtils.toBean(list, CanteenSupplierSimpleVo.class);
return R.ok(bean);
}
}
@@ -1,8 +1,29 @@
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.CanteenSupplierEntity;
import java.util.List;
public interface CanteenSupplierService extends IService<CanteenSupplierEntity> {
/**
* 数据权限分页查询
* @param page
* @param wrapper
* @return
*/
Object pageScope(Page page, LambdaQueryWrapper<CanteenSupplierEntity> wrapper);
/**
* 货商下拉
* @param name
* @param supplierId
* @return
*/
List<CanteenSupplierEntity> selectSimpleAllScope(String name, Long supplierId);
}
@@ -1,10 +1,18 @@
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.CanteenSupplierEntity;
import com.bsd.pjcloud.canteen.mapper.CanteenSupplierMapper;
import com.bsd.pjcloud.canteen.service.CanteenSupplierService;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 货商信息
*
@@ -12,5 +20,19 @@ import org.springframework.stereotype.Service;
* @date 2025-05-09 13:18:19
*/
@Service
@AllArgsConstructor
public class CanteenSupplierServiceImpl extends ServiceImpl<CanteenSupplierMapper, CanteenSupplierEntity> implements CanteenSupplierService {
@Override
public Object pageScope(Page page, LambdaQueryWrapper<CanteenSupplierEntity> wrapper) {
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
}
@Override
public List<CanteenSupplierEntity> selectSimpleAllScope(String name, Long supplierId) {
LambdaQueryWrapper<CanteenSupplierEntity> wrapper = new LambdaQueryWrapper<CanteenSupplierEntity>();
wrapper.eq(CanteenSupplierEntity::getStatus, "0");
wrapper.like(StringUtils.isNotBlank(name),CanteenSupplierEntity::getSupplierName,name);
wrapper.eq(supplierId!=null,CanteenSupplierEntity::getSupplierId,supplierId);
return baseMapper.selectListByScope(wrapper, DataScope.of());
}
}