Compare commits
5 Commits
f94ebc4527
...
bd85e08a3c
| Author | SHA1 | Date | |
|---|---|---|---|
| bd85e08a3c | |||
| ab5cc9331b | |||
| 53789734c3 | |||
| da3c891bf0 | |||
| 25c050225b |
@@ -145,6 +145,9 @@ ErrorCode PURCHASE_ORDER_ITEM_RETURN_FAIL_IN_EXCEED = new ErrorCode(1_030_101_00
|
|||||||
ErrorCode PRODUCT_UNIT_NAME_DUPLICATE = new ErrorCode(1_030_502_001, "已存在该名字的产品单位");
|
ErrorCode PRODUCT_UNIT_NAME_DUPLICATE = new ErrorCode(1_030_502_001, "已存在该名字的产品单位");
|
||||||
ErrorCode PRODUCT_UNIT_EXITS_PRODUCT = new ErrorCode(1_030_502_002, "存在产品使用该单位,无法删除");
|
ErrorCode PRODUCT_UNIT_EXITS_PRODUCT = new ErrorCode(1_030_502_002, "存在产品使用该单位,无法删除");
|
||||||
|
|
||||||
|
// ========== 进销存系统 - 器械分类 1-030-503-000 ==========
|
||||||
|
ErrorCode DEVICE_CATEGORY_NOT_EXISTS = new ErrorCode(1_030_503_000, "进销存系统 - 器械分类不存在");
|
||||||
|
|
||||||
// ========== ERP 结算账户 1-030-600-000 ==========
|
// ========== ERP 结算账户 1-030-600-000 ==========
|
||||||
ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1_030_600_000, "结算账户不存在");
|
ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1_030_600_000, "结算账户不存在");
|
||||||
ErrorCode ACCOUNT_NOT_ENABLE = new ErrorCode(1_030_600_001, "结算账户({})未启用");
|
ErrorCode ACCOUNT_NOT_ENABLE = new ErrorCode(1_030_600_001, "结算账户({})未启用");
|
||||||
|
|||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package cn.iocoder.yudao.module.erp.controller.admin.devicecategory;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.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 javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.erp.controller.admin.devicecategory.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.erp.dal.dataobject.devicecategory.DeviceCategoryDO;
|
||||||
|
import cn.iocoder.yudao.module.erp.service.devicecategory.DeviceCategoryService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 进销存系统 - 器械分类")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/erp/device-category")
|
||||||
|
@Validated
|
||||||
|
public class DeviceCategoryController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DeviceCategoryService deviceCategoryService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建进销存系统 - 器械分类")
|
||||||
|
@PreAuthorize("@ss.hasPermission('erp:device-category:create')")
|
||||||
|
public CommonResult<Integer> createDeviceCategory(@Valid @RequestBody DeviceCategorySaveReqVO createReqVO) {
|
||||||
|
return success(deviceCategoryService.createDeviceCategory(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新进销存系统 - 器械分类")
|
||||||
|
@PreAuthorize("@ss.hasPermission('erp:device-category:update')")
|
||||||
|
public CommonResult<Boolean> updateDeviceCategory(@Valid @RequestBody DeviceCategorySaveReqVO updateReqVO) {
|
||||||
|
deviceCategoryService.updateDeviceCategory(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除进销存系统 - 器械分类")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('erp:device-category:delete')")
|
||||||
|
public CommonResult<Boolean> deleteDeviceCategory(@RequestParam("id") Integer id) {
|
||||||
|
deviceCategoryService.deleteDeviceCategory(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除进销存系统 - 器械分类")
|
||||||
|
@PreAuthorize("@ss.hasPermission('erp:device-category:delete')")
|
||||||
|
public CommonResult<Boolean> deleteDeviceCategoryList(@RequestParam("ids") List<Integer> ids) {
|
||||||
|
deviceCategoryService.deleteDeviceCategoryListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得进销存系统 - 器械分类")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('erp:device-category:query')")
|
||||||
|
public CommonResult<DeviceCategoryRespVO> getDeviceCategory(@RequestParam("id") Integer id) {
|
||||||
|
DeviceCategoryDO deviceCategory = deviceCategoryService.getDeviceCategory(id);
|
||||||
|
return success(BeanUtils.toBean(deviceCategory, DeviceCategoryRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得进销存系统 - 器械分类分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('erp:device-category:query')")
|
||||||
|
public CommonResult<PageResult<DeviceCategoryRespVO>> getDeviceCategoryPage(@Valid DeviceCategoryPageReqVO pageReqVO) {
|
||||||
|
PageResult<DeviceCategoryDO> pageResult = deviceCategoryService.getDeviceCategoryPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, DeviceCategoryRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出进销存系统 - 器械分类 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('erp:device-category:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportDeviceCategoryExcel(@Valid DeviceCategoryPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<DeviceCategoryDO> list = deviceCategoryService.getDeviceCategoryPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "进销存系统 - 器械分类.xls", "数据", DeviceCategoryRespVO.class,
|
||||||
|
BeanUtils.toBean(list, DeviceCategoryRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package cn.iocoder.yudao.module.erp.controller.admin.devicecategory.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 进销存系统 - 器械分类分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class DeviceCategoryPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "分类名称(如 "01 有源手术器械"),业务核心字段,必填", example = "芋艿")
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
|
@Schema(description = "分类编号(如 "1-8-8.2""1-10-10.4"),业务唯一标识(页面标*必填)")
|
||||||
|
private String categoryCode;
|
||||||
|
|
||||||
|
@Schema(description = "类别(如 "一类""二类""三类"),通过下拉选择,必填", example = "1")
|
||||||
|
private String deviceType;
|
||||||
|
|
||||||
|
@Schema(description = "品名举例(如 "移动式 LED 手术照明灯、LED 手术照明灯..."),可选填")
|
||||||
|
private String exampleNames;
|
||||||
|
|
||||||
|
@Schema(description = "记录创建时间,自动生成,用于数据审计")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "记录创建人(如 "admin"),用于追溯操作人")
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
@Schema(description = "记录最后更新人,数据首次创建时可为空,修改后自动填充")
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
@Schema(description = "状态", example = "2")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package cn.iocoder.yudao.module.erp.controller.admin.devicecategory.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 DeviceCategoryRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "记录唯一标识,系统自动生成,用于数据关联和查询", requiredMode = Schema.RequiredMode.REQUIRED, example = "11153")
|
||||||
|
@ExcelProperty("记录唯一标识,系统自动生成,用于数据关联和查询")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Schema(description = "分类名称(如 "01 有源手术器械"),业务核心字段,必填", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||||
|
@ExcelProperty("分类名称(如 "01 有源手术器械"),业务核心字段,必填")
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
|
@Schema(description = "分类编号(如 "1-8-8.2""1-10-10.4"),业务唯一标识(页面标*必填)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("分类编号(如 "1-8-8.2""1-10-10.4"),业务唯一标识(页面标*必填)")
|
||||||
|
private String categoryCode;
|
||||||
|
|
||||||
|
@Schema(description = "类别(如 "一类""二类""三类"),通过下拉选择,必填", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@ExcelProperty("类别(如 "一类""二类""三类"),通过下拉选择,必填")
|
||||||
|
private String deviceType;
|
||||||
|
|
||||||
|
@Schema(description = "品名举例(如 "移动式 LED 手术照明灯、LED 手术照明灯..."),可选填")
|
||||||
|
@ExcelProperty("品名举例(如 "移动式 LED 手术照明灯、LED 手术照明灯..."),可选填")
|
||||||
|
private String exampleNames;
|
||||||
|
|
||||||
|
@Schema(description = "记录创建时间,自动生成,用于数据审计")
|
||||||
|
@ExcelProperty("记录创建时间,自动生成,用于数据审计")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "记录创建人(如 "admin"),用于追溯操作人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("记录创建人(如 "admin"),用于追溯操作人")
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
@Schema(description = "记录最后更新人,数据首次创建时可为空,修改后自动填充")
|
||||||
|
@ExcelProperty("记录最后更新人,数据首次创建时可为空,修改后自动填充")
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@ExcelProperty("状态")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package cn.iocoder.yudao.module.erp.controller.admin.devicecategory.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 进销存系统 - 器械分类新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class DeviceCategorySaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "记录唯一标识,系统自动生成,用于数据关联和查询", requiredMode = Schema.RequiredMode.REQUIRED, example = "11153")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Schema(description = "分类名称(如 "01 有源手术器械"),业务核心字段,必填", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||||
|
@NotEmpty(message = "分类名称(如 "01 有源手术器械"),业务核心字段,必填不能为空")
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
|
@Schema(description = "分类编号(如 "1-8-8.2""1-10-10.4"),业务唯一标识(页面标*必填)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "分类编号(如 "1-8-8.2""1-10-10.4"),业务唯一标识(页面标*必填)不能为空")
|
||||||
|
private String categoryCode;
|
||||||
|
|
||||||
|
@Schema(description = "类别(如 "一类""二类""三类"),通过下拉选择,必填", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotEmpty(message = "类别(如 "一类""二类""三类"),通过下拉选择,必填不能为空")
|
||||||
|
private String deviceType;
|
||||||
|
|
||||||
|
@Schema(description = "品名举例(如 "移动式 LED 手术照明灯、LED 手术照明灯..."),可选填")
|
||||||
|
private String exampleNames;
|
||||||
|
|
||||||
|
@Schema(description = "记录创建人(如 "admin"),用于追溯操作人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "记录创建人(如 "admin"),用于追溯操作人不能为空")
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
@Schema(description = "记录最后更新人,数据首次创建时可为空,修改后自动填充")
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@NotNull(message = "状态不能为空")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package cn.iocoder.yudao.module.erp.dal.dataobject.devicecategory;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进销存系统 - 器械分类 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("erp_device_category")
|
||||||
|
@KeySequence("erp_device_category_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DeviceCategoryDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录唯一标识,系统自动生成,用于数据关联和查询
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 分类名称(如 "01 有源手术器械"),业务核心字段,必填
|
||||||
|
*/
|
||||||
|
private String categoryName;
|
||||||
|
/**
|
||||||
|
* 分类编号(如 "1-8-8.2""1-10-10.4"),业务唯一标识(页面标*必填)
|
||||||
|
*/
|
||||||
|
private String categoryCode;
|
||||||
|
/**
|
||||||
|
* 类别(如 "一类""二类""三类"),通过下拉选择,必填
|
||||||
|
*/
|
||||||
|
private String deviceType;
|
||||||
|
/**
|
||||||
|
* 品名举例(如 "移动式 LED 手术照明灯、LED 手术照明灯..."),可选填
|
||||||
|
*/
|
||||||
|
private String exampleNames;
|
||||||
|
/**
|
||||||
|
* 记录创建人(如 "admin"),用于追溯操作人
|
||||||
|
*/
|
||||||
|
private String createUser;
|
||||||
|
/**
|
||||||
|
* 记录最后更新人,数据首次创建时可为空,修改后自动填充
|
||||||
|
*/
|
||||||
|
private String updateUser;
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package cn.iocoder.yudao.module.erp.dal.mysql.devicecategory;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.erp.dal.dataobject.devicecategory.DeviceCategoryDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.erp.controller.admin.devicecategory.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进销存系统 - 器械分类 Mapper
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface DeviceCategoryMapper extends BaseMapperX<DeviceCategoryDO> {
|
||||||
|
|
||||||
|
default PageResult<DeviceCategoryDO> selectPage(DeviceCategoryPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<DeviceCategoryDO>()
|
||||||
|
.likeIfPresent(DeviceCategoryDO::getCategoryName, reqVO.getCategoryName())
|
||||||
|
.eqIfPresent(DeviceCategoryDO::getCategoryCode, reqVO.getCategoryCode())
|
||||||
|
.eqIfPresent(DeviceCategoryDO::getDeviceType, reqVO.getDeviceType())
|
||||||
|
.eqIfPresent(DeviceCategoryDO::getExampleNames, reqVO.getExampleNames())
|
||||||
|
.betweenIfPresent(DeviceCategoryDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.eqIfPresent(DeviceCategoryDO::getCreateUser, reqVO.getCreateUser())
|
||||||
|
.eqIfPresent(DeviceCategoryDO::getUpdateUser, reqVO.getUpdateUser())
|
||||||
|
.eqIfPresent(DeviceCategoryDO::getStatus, reqVO.getStatus())
|
||||||
|
.orderByDesc(DeviceCategoryDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package cn.iocoder.yudao.module.erp.service.devicecategory;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.erp.controller.admin.devicecategory.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.erp.dal.dataobject.devicecategory.DeviceCategoryDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进销存系统 - 器械分类 Service 接口
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface DeviceCategoryService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建进销存系统 - 器械分类
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Integer createDeviceCategory(@Valid DeviceCategorySaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新进销存系统 - 器械分类
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateDeviceCategory(@Valid DeviceCategorySaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除进销存系统 - 器械分类
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteDeviceCategory(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除进销存系统 - 器械分类
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteDeviceCategoryListByIds(List<Integer> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得进销存系统 - 器械分类
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 进销存系统 - 器械分类
|
||||||
|
*/
|
||||||
|
DeviceCategoryDO getDeviceCategory(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得进销存系统 - 器械分类分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 进销存系统 - 器械分类分页
|
||||||
|
*/
|
||||||
|
PageResult<DeviceCategoryDO> getDeviceCategoryPage(DeviceCategoryPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package cn.iocoder.yudao.module.erp.service.devicecategory;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.erp.controller.admin.devicecategory.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.erp.dal.dataobject.devicecategory.DeviceCategoryDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.erp.dal.mysql.devicecategory.DeviceCategoryMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList;
|
||||||
|
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进销存系统 - 器械分类 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class DeviceCategoryServiceImpl implements DeviceCategoryService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DeviceCategoryMapper deviceCategoryMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer createDeviceCategory(DeviceCategorySaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
DeviceCategoryDO deviceCategory = BeanUtils.toBean(createReqVO, DeviceCategoryDO.class);
|
||||||
|
deviceCategoryMapper.insert(deviceCategory);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return deviceCategory.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateDeviceCategory(DeviceCategorySaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateDeviceCategoryExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
DeviceCategoryDO updateObj = BeanUtils.toBean(updateReqVO, DeviceCategoryDO.class);
|
||||||
|
deviceCategoryMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteDeviceCategory(Integer id) {
|
||||||
|
// 校验存在
|
||||||
|
validateDeviceCategoryExists(id);
|
||||||
|
// 删除
|
||||||
|
deviceCategoryMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteDeviceCategoryListByIds(List<Integer> ids) {
|
||||||
|
// 删除
|
||||||
|
deviceCategoryMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateDeviceCategoryExists(Integer id) {
|
||||||
|
if (deviceCategoryMapper.selectById(id) == null) {
|
||||||
|
throw exception(DEVICE_CATEGORY_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceCategoryDO getDeviceCategory(Integer id) {
|
||||||
|
return deviceCategoryMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<DeviceCategoryDO> getDeviceCategoryPage(DeviceCategoryPageReqVO pageReqVO) {
|
||||||
|
return deviceCategoryMapper.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.iocoder.yudao.module.erp.dal.mysql.devicecategory.DeviceCategoryMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -168,4 +168,5 @@ public interface ErrorCodeConstants {
|
|||||||
// ========== 站内信发送 1-002-028-000 ==========
|
// ========== 站内信发送 1-002-028-000 ==========
|
||||||
ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_028_000, "模板参数({})缺失");
|
ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_028_000, "模板参数({})缺失");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user