feat:新增LMS 生箔点位库存管理。
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package cn.code.nl.module.lms.enums;
|
||||
|
||||
import cn.code.nl.framework.common.enums.RpcConstants;
|
||||
|
||||
/**
|
||||
* API 相关的枚举
|
||||
*
|
||||
* @author zhouz
|
||||
*/
|
||||
public class ApiConstants {
|
||||
|
||||
/**
|
||||
* 服务名
|
||||
*
|
||||
* 注意,需要保证和 spring.application.name 保持一致
|
||||
*/
|
||||
public static final String NAME = "lms-server";
|
||||
|
||||
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/lms";
|
||||
|
||||
public static final String VERSION = "1.0.0";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.code.nl.module.lms.enums;
|
||||
|
||||
import cn.code.nl.framework.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2026/7/16
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 生箔点位库存 ==========
|
||||
ErrorCode RAW_FOIL_POINT_IVT_NOT_EXISTS = new ErrorCode(1, "生箔点位库存不存在");
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package cn.code.nl.module.lms.controller.admin.rawfoilpointivt;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.code.nl.framework.common.pojo.PageParam;
|
||||
import cn.code.nl.framework.common.pojo.PageResult;
|
||||
import cn.code.nl.framework.common.pojo.CommonResult;
|
||||
import cn.code.nl.framework.common.util.object.BeanUtils;
|
||||
import static cn.code.nl.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.code.nl.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.code.nl.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.code.nl.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.code.nl.module.lms.controller.admin.rawfoilpointivt.vo.*;
|
||||
import cn.code.nl.module.lms.dal.dataobject.rawfoilpointivt.RawFoilPointIVTDO;
|
||||
import cn.code.nl.module.lms.service.rawfoilpointivt.RawFoilPointIVTService;
|
||||
|
||||
@Tag(name = "管理后台 - 生箔点位库存")
|
||||
@RestController
|
||||
@RequestMapping("/lms/raw-foil-point-IVT")
|
||||
@Validated
|
||||
public class RawFoilPointIVTController {
|
||||
|
||||
@Resource
|
||||
private RawFoilPointIVTService rawFoilPointIVTService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建生箔点位库存")
|
||||
@PreAuthorize("@ss.hasPermission('lms:raw-foil-point-IVT:create')")
|
||||
public CommonResult<Long> createRawFoilPointIVT(@Valid @RequestBody RawFoilPointIVTSaveReqVO createReqVO) {
|
||||
return success(rawFoilPointIVTService.createRawFoilPointIVT(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新生箔点位库存")
|
||||
@PreAuthorize("@ss.hasPermission('lms:raw-foil-point-IVT:update')")
|
||||
public CommonResult<Boolean> updateRawFoilPointIVT(@Valid @RequestBody RawFoilPointIVTSaveReqVO updateReqVO) {
|
||||
rawFoilPointIVTService.updateRawFoilPointIVT(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除生箔点位库存")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('lms:raw-foil-point-IVT:delete')")
|
||||
public CommonResult<Boolean> deleteRawFoilPointIVT(@RequestParam("id") Long id) {
|
||||
rawFoilPointIVTService.deleteRawFoilPointIVT(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除生箔点位库存")
|
||||
@PreAuthorize("@ss.hasPermission('lms:raw-foil-point-IVT:delete')")
|
||||
public CommonResult<Boolean> deleteRawFoilPointIVTList(@RequestParam("ids") List<Long> ids) {
|
||||
rawFoilPointIVTService.deleteRawFoilPointIVTListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得生箔点位库存")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('lms:raw-foil-point-IVT:query')")
|
||||
public CommonResult<RawFoilPointIVTRespVO> getRawFoilPointIVT(@RequestParam("id") Long id) {
|
||||
RawFoilPointIVTDO rawFoilPointIVT = rawFoilPointIVTService.getRawFoilPointIVT(id);
|
||||
return success(BeanUtils.toBean(rawFoilPointIVT, RawFoilPointIVTRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得生箔点位库存分页")
|
||||
@PreAuthorize("@ss.hasPermission('lms:raw-foil-point-IVT:query')")
|
||||
public CommonResult<PageResult<RawFoilPointIVTRespVO>> getRawFoilPointIVTPage(@Valid RawFoilPointIVTPageReqVO pageReqVO) {
|
||||
PageResult<RawFoilPointIVTDO> pageResult = rawFoilPointIVTService.getRawFoilPointIVTPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, RawFoilPointIVTRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出生箔点位库存 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('lms:raw-foil-point-IVT:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportRawFoilPointIVTExcel(@Valid RawFoilPointIVTPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<RawFoilPointIVTDO> list = rawFoilPointIVTService.getRawFoilPointIVTPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "生箔点位库存.xls", "数据", RawFoilPointIVTRespVO.class,
|
||||
BeanUtils.toBean(list, RawFoilPointIVTRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package cn.code.nl.module.lms.controller.admin.rawfoilpointivt.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.code.nl.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.code.nl.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 生箔点位库存分页 Request VO")
|
||||
@Data
|
||||
public class RawFoilPointIVTPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "点位编码")
|
||||
private String pointCode;
|
||||
|
||||
@Schema(description = "载具编码")
|
||||
private String vehicleCode;
|
||||
|
||||
@Schema(description = "生产区域")
|
||||
private String productionArea;
|
||||
|
||||
@Schema(description = "位置")
|
||||
private String pointLocation;
|
||||
|
||||
@Schema(description = "外部编码")
|
||||
private String extCode;
|
||||
|
||||
@Schema(description = "是否启用")
|
||||
private String isUsed;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package cn.code.nl.module.lms.controller.admin.rawfoilpointivt.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 生箔点位库存 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class RawFoilPointIVTRespVO {
|
||||
|
||||
@Schema(description = "点位标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "31653")
|
||||
@ExcelProperty("点位标识")
|
||||
private Long pointId;
|
||||
|
||||
@Schema(description = "点位编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("点位编码")
|
||||
private String pointCode;
|
||||
|
||||
@Schema(description = "载具编码")
|
||||
@ExcelProperty("载具编码")
|
||||
private String vehicleCode;
|
||||
|
||||
@Schema(description = "生产区域")
|
||||
@ExcelProperty("生产区域")
|
||||
private String productionArea;
|
||||
|
||||
@Schema(description = "位置")
|
||||
@ExcelProperty("位置")
|
||||
private String pointLocation;
|
||||
|
||||
@Schema(description = "外部编码")
|
||||
@ExcelProperty("外部编码")
|
||||
private String extCode;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("是否启用")
|
||||
private String isUsed;
|
||||
|
||||
@Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@ExcelProperty("创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "修改人", example = "张三")
|
||||
@ExcelProperty("修改人")
|
||||
private String updater;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
@ExcelProperty("修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "是否删除")
|
||||
@ExcelProperty("是否删除")
|
||||
private String deleted;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package cn.code.nl.module.lms.controller.admin.rawfoilpointivt.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 生箔点位库存新增/修改 Request VO")
|
||||
@Data
|
||||
public class RawFoilPointIVTSaveReqVO {
|
||||
|
||||
@Schema(description = "点位标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "31653")
|
||||
private Long pointId;
|
||||
|
||||
@Schema(description = "点位编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "点位编码不能为空")
|
||||
private String pointCode;
|
||||
|
||||
@Schema(description = "载具编码")
|
||||
private String vehicleCode;
|
||||
|
||||
@Schema(description = "生产区域")
|
||||
private String productionArea;
|
||||
|
||||
@Schema(description = "位置")
|
||||
private String pointLocation;
|
||||
|
||||
@Schema(description = "外部编码")
|
||||
private String extCode;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "是否启用不能为空")
|
||||
private String isUsed;
|
||||
|
||||
@Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "修改人", example = "张三")
|
||||
private String updater;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "是否删除")
|
||||
private String deleted;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package cn.code.nl.module.lms.dal.dataobject.rawfoilpointivt;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.code.nl.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 生箔点位库存 DO
|
||||
*
|
||||
* @author 诺力管理员
|
||||
*/
|
||||
@TableName("lms_rawfoil_pointivt")
|
||||
@KeySequence("lms_rawfoil_pointivt_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RawFoilPointIVTDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 点位标识
|
||||
*/
|
||||
@TableId
|
||||
private Long pointId;
|
||||
/**
|
||||
* 点位编码
|
||||
*/
|
||||
private String pointCode;
|
||||
/**
|
||||
* 载具编码
|
||||
*/
|
||||
private String vehicleCode;
|
||||
/**
|
||||
* 生产区域
|
||||
*/
|
||||
private String productionArea;
|
||||
/**
|
||||
* 位置
|
||||
*/
|
||||
private String pointLocation;
|
||||
/**
|
||||
* 外部编码
|
||||
*/
|
||||
private String extCode;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String isUsed;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package cn.code.nl.module.lms.dal.mysql.rawfoilpointivt;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.code.nl.framework.common.pojo.PageResult;
|
||||
import cn.code.nl.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.code.nl.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.code.nl.module.lms.dal.dataobject.rawfoilpointivt.RawFoilPointIVTDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.code.nl.module.lms.controller.admin.rawfoilpointivt.vo.*;
|
||||
|
||||
/**
|
||||
* 生箔点位库存 Mapper
|
||||
*
|
||||
* @author 诺力管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface RawFoilPointIVTMapper extends BaseMapperX<RawFoilPointIVTDO> {
|
||||
|
||||
default PageResult<RawFoilPointIVTDO> selectPage(RawFoilPointIVTPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RawFoilPointIVTDO>()
|
||||
.eqIfPresent(RawFoilPointIVTDO::getPointCode, reqVO.getPointCode())
|
||||
.eqIfPresent(RawFoilPointIVTDO::getVehicleCode, reqVO.getVehicleCode())
|
||||
.eqIfPresent(RawFoilPointIVTDO::getProductionArea, reqVO.getProductionArea())
|
||||
.eqIfPresent(RawFoilPointIVTDO::getPointLocation, reqVO.getPointLocation())
|
||||
.eqIfPresent(RawFoilPointIVTDO::getExtCode, reqVO.getExtCode())
|
||||
.eqIfPresent(RawFoilPointIVTDO::getIsUsed, reqVO.getIsUsed())
|
||||
.orderByDesc(RawFoilPointIVTDO::getPointId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package cn.code.nl.module.lms.framwork.security.config;
|
||||
|
||||
import cn.code.nl.framework.security.config.AuthorizeRequestsCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer;
|
||||
|
||||
/**
|
||||
* Lms 模块的 Security 配置
|
||||
*
|
||||
* @author dsh
|
||||
* 2026/7/16
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false, value = "lmsSecurityConfiguration")
|
||||
public class SecurityConfiguration {
|
||||
|
||||
/*
|
||||
*
|
||||
* 根因确认
|
||||
|
||||
问题出在 NlWebSecurityConfigurerAdapter.java:77-78:
|
||||
|
||||
@Resource // 第77行
|
||||
private List<AuthorizeRequestsCustomizer> authorizeRequestsCustomizers;
|
||||
|
||||
@Resource 在处理 List<T> 泛型注入时的行为与 @Autowired 不同:
|
||||
- @Autowired 能正确按元素类型 T 解析,即使 0 个 Bean 也能注入空集合
|
||||
- @Resource 先按字段名查找,失败后按原始类型回退匹配。由于泛型擦除,类型变成了原始 java.util.List,Spring 找不到类型为 java.util.List 的 Bean,直接报错
|
||||
|
||||
为什么 infra 模块正常? infra 模块的 SecurityConfiguration 定义了 1 个 AuthorizeRequestsCustomizer Bean,@Resource 的非空集合路径能正确处理。而 base 模块有
|
||||
0 个这样的 Bean,触发了空集合路径的 bug。
|
||||
|
||||
修复方式: 为 base 模块创建 SecurityConfiguration(已创建),这是该项目的标准模式(每个模块定义自己的安全配置)。
|
||||
|
||||
现在验证修改:
|
||||
|
||||
Thought for 6s, read 1 file (ctrl+o to expand)
|
||||
|
||||
⏺ 配置已创建。让我验证一下文件结构是否完整:
|
||||
|
||||
Thought for 5s, searched for 1 pattern (ctrl+o to expand)
|
||||
|
||||
⏺ 总结
|
||||
|
||||
问题根因
|
||||
|
||||
NlWebSecurityConfigurerAdapter.java:77-78 中使用了 @Resource 注入 List<AuthorizeRequestsCustomizer>:
|
||||
|
||||
@Resource
|
||||
private List<AuthorizeRequestsCustomizer> authorizeRequestsCustomizers;
|
||||
|
||||
@Resource 在处理泛型集合时存在局限性,按字段名查找失败后会按原始类型 java.util.List 回退匹配,导致 Spring 找不到对应 Bean 而报错。@Autowired
|
||||
能正确处理这种情况(包括空集合),但 @Resource 不行。
|
||||
|
||||
修复内容
|
||||
|
||||
创建了 base 模块的 SecurityConfiguration(参考 infra 模块的同等配置):
|
||||
|
||||
nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/framework/security/config/SecurityConfiguration.java
|
||||
|
||||
这个配置类:
|
||||
1. 定义了一个 AuthorizeRequestsCustomizer Bean,使 NlWebSecurityConfigurerAdapter 中的 List<AuthorizeRequestsCustomizer> 能正确解析
|
||||
1. 定义了一个 AuthorizeRequestsCustomizer Bean,使 NlWebSecurityConfigurerAdapter 中的 List<AuthorizeRequestsCustomizer> 能正确解析
|
||||
|
||||
Thought for 5s, searched for 1 pattern (ctrl+o to expand)
|
||||
⏺ 总结
|
||||
|
||||
问题根因
|
||||
|
||||
NlWebSecurityConfigurerAdapter.java:77-78 中使用了 @Resource 注入
|
||||
List<AuthorizeRequestsCustomizer>:
|
||||
|
||||
@Resource
|
||||
private List<AuthorizeRequestsCustomizer> authorizeRequestsCustomizers;
|
||||
|
||||
@Resource 在处理泛型集合时存在局限性,按字段名查找失败后会按原始类型
|
||||
java.util.List 回退匹配,导致 Spring 找不到对应 Bean 而报错。@Autowired
|
||||
能正确处理这种情况(包括空集合),但 @Resource 不行。
|
||||
修复内容
|
||||
|
||||
创建了 base 模块的 SecurityConfiguration(参考 infra 模块的同等配置):
|
||||
|
||||
nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/fr
|
||||
amework/security/config/SecurityConfiguration.java
|
||||
|
||||
|
||||
nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/framework/security/config/SecurityConfiguration.java
|
||||
|
||||
这个配置类:
|
||||
1. 定义了一个 AuthorizeRequestsCustomizer Bean,使 NlWebSecurityConfigurerAdapter 中的 List<AuthorizeRequestsCustomizer> 能正确解析
|
||||
2. 配置了 Swagger、Actuator、Druid 等公共路径的免登录访问
|
||||
3. 遵循了项目中每个模块定义各自安全配置的标准模式
|
||||
|
||||
3. 遵循了项目中每个模块定义各自安全配置的标准模式
|
||||
* */
|
||||
@Bean("lmsAuthorizeRequestsCustomizer")
|
||||
public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
|
||||
return new AuthorizeRequestsCustomizer() {
|
||||
|
||||
@Override
|
||||
public void customize(AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry registry) {
|
||||
// Swagger 接口文档
|
||||
registry.requestMatchers("/v3/api-docs/**").permitAll()
|
||||
.requestMatchers("/webjars/**").permitAll()
|
||||
.requestMatchers("/swagger-ui").permitAll()
|
||||
.requestMatchers("/swagger-ui/**").permitAll();
|
||||
// Spring Boot Actuator 的安全配置
|
||||
registry.requestMatchers("/actuator").permitAll()
|
||||
.requestMatchers("/actuator/**").permitAll();
|
||||
// Druid 监控
|
||||
registry.requestMatchers("/druid/**").permitAll();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.code.nl.module.lms.service.rawfoilpointivt;
|
||||
|
||||
import java.util.*;
|
||||
import jakarta.validation.*;
|
||||
import cn.code.nl.module.lms.controller.admin.rawfoilpointivt.vo.*;
|
||||
import cn.code.nl.module.lms.dal.dataobject.rawfoilpointivt.RawFoilPointIVTDO;
|
||||
import cn.code.nl.framework.common.pojo.PageResult;
|
||||
import cn.code.nl.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 生箔点位库存 Service 接口
|
||||
*
|
||||
* @author 诺力管理员
|
||||
*/
|
||||
public interface RawFoilPointIVTService {
|
||||
|
||||
/**
|
||||
* 创建生箔点位库存
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createRawFoilPointIVT(@Valid RawFoilPointIVTSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新生箔点位库存
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateRawFoilPointIVT(@Valid RawFoilPointIVTSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除生箔点位库存
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteRawFoilPointIVT(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除生箔点位库存
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteRawFoilPointIVTListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得生箔点位库存
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 生箔点位库存
|
||||
*/
|
||||
RawFoilPointIVTDO getRawFoilPointIVT(Long id);
|
||||
|
||||
/**
|
||||
* 获得生箔点位库存分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 生箔点位库存分页
|
||||
*/
|
||||
PageResult<RawFoilPointIVTDO> getRawFoilPointIVTPage(RawFoilPointIVTPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package cn.code.nl.module.lms.service.rawfoilpointivt;
|
||||
|
||||
import cn.code.nl.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.code.nl.module.lms.controller.admin.rawfoilpointivt.vo.*;
|
||||
import cn.code.nl.module.lms.dal.dataobject.rawfoilpointivt.RawFoilPointIVTDO;
|
||||
import cn.code.nl.framework.common.pojo.PageResult;
|
||||
import cn.code.nl.framework.common.pojo.PageParam;
|
||||
import cn.code.nl.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.code.nl.module.lms.dal.mysql.rawfoilpointivt.RawFoilPointIVTMapper;
|
||||
|
||||
import static cn.code.nl.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.code.nl.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static cn.code.nl.framework.common.util.collection.CollectionUtils.diffList;
|
||||
import static cn.code.nl.module.lms.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 生箔点位库存 Service 实现类
|
||||
*
|
||||
* @author 诺力管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class RawFoilPointIVTServiceImpl implements RawFoilPointIVTService {
|
||||
|
||||
@Resource
|
||||
private RawFoilPointIVTMapper rawFoilPointIVTMapper;
|
||||
|
||||
@Override
|
||||
public Long createRawFoilPointIVT(RawFoilPointIVTSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
RawFoilPointIVTDO rawFoilPointIVT = BeanUtils.toBean(createReqVO, RawFoilPointIVTDO.class);
|
||||
rawFoilPointIVTMapper.insert(rawFoilPointIVT);
|
||||
|
||||
// 返回
|
||||
return rawFoilPointIVT.getPointId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRawFoilPointIVT(RawFoilPointIVTSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateRawFoilPointIVTExists(updateReqVO.getPointId());
|
||||
// 更新
|
||||
RawFoilPointIVTDO updateObj = BeanUtils.toBean(updateReqVO, RawFoilPointIVTDO.class);
|
||||
rawFoilPointIVTMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRawFoilPointIVT(Long id) {
|
||||
// 校验存在
|
||||
validateRawFoilPointIVTExists(id);
|
||||
// 删除
|
||||
rawFoilPointIVTMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRawFoilPointIVTListByIds(List<Long> ids) {
|
||||
// 删除
|
||||
rawFoilPointIVTMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validateRawFoilPointIVTExists(Long id) {
|
||||
if (rawFoilPointIVTMapper.selectById(id) == null) {
|
||||
throw exception(RAW_FOIL_POINT_IVT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RawFoilPointIVTDO getRawFoilPointIVT(Long id) {
|
||||
return rawFoilPointIVTMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<RawFoilPointIVTDO> getRawFoilPointIVTPage(RawFoilPointIVTPageReqVO pageReqVO) {
|
||||
return rawFoilPointIVTMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.code.nl.module.lms.dal.mysql.rawfoilpointivt.RawFoilPointIVTMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user