目录
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package cn.iocoder.yudao.module.backendlogistics.controller.admin.backendlogistics.bseMngt.mtrl;
|
||||
|
||||
import cn.iocoder.yudao.module.backendlogistics.controller.admin.backendlogistics.bseMngt.mtrl.vo.MtrlClsListReqVO;
|
||||
import cn.iocoder.yudao.module.backendlogistics.controller.admin.backendlogistics.bseMngt.mtrl.vo.MtrlClsRespVO;
|
||||
import cn.iocoder.yudao.module.backendlogistics.dal.dataobject.bseMngt.mtrl.MtrlClsDO;
|
||||
import cn.iocoder.yudao.module.backendlogistics.service.bseMngt.mtrl.MtrlClsService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import cn.iocoder.yudao.framework.business.interceptor.BusinessControllerMarker;
|
||||
|
||||
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 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;
|
||||
|
||||
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 物料分类")
|
||||
@RestController
|
||||
@RequestMapping("/lgst/mtrl-cls")
|
||||
@Validated
|
||||
public class MtrlClsController implements BusinessControllerMarker {
|
||||
|
||||
|
||||
@Resource
|
||||
private MtrlClsService mtrlClsService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得物料分类列表")
|
||||
@PreAuthorize("@ss.hasPermission('lgst:mtrl-cls:query')")
|
||||
public CommonResult<List<MtrlClsRespVO>> getMtrlClsList(@Valid MtrlClsListReqVO listReqVO) {
|
||||
List<MtrlClsDO> list = mtrlClsService.getMtrlClsList(listReqVO);
|
||||
return success(BeanUtils.toBean(list, MtrlClsRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.backendlogistics.controller.admin.backendlogistics.bseMngt.mtrl.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 物料分类列表 Request VO")
|
||||
@Data
|
||||
public class MtrlClsListReqVO {
|
||||
|
||||
@Schema(description = "父级ID", example = "26586")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "分类编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "分类名称", example = "赵六")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "分类级别-用于类别层级(大/中/小类)")
|
||||
private Long level;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.backendlogistics.controller.admin.backendlogistics.bseMngt.mtrl.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 com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 物料分类 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class MtrlClsRespVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6122")
|
||||
@ExcelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "父级ID", example = "26586")
|
||||
@ExcelProperty("父级ID")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "分类编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("分类编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@ExcelProperty("分类名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "分类级别-用于类别层级(大/中/小类)")
|
||||
@ExcelProperty("分类级别-用于类别层级(大/中/小类)")
|
||||
private Long level;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.backendlogistics.controller.admin.backendlogistics.bseMngt.mtrl.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 物料分类新增/修改 Request VO")
|
||||
@Data
|
||||
public class MtrlClsSaveReqVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6122")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "父级ID", example = "26586")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "分类编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "分类编码不能为空")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@NotEmpty(message = "分类名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "分类级别-用于类别层级(大/中/小类)")
|
||||
private Long level;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.backendlogistics.dal.dataobject.bseMngt.mtrl;
|
||||
|
||||
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.BusinessBaseDO;
|
||||
/**
|
||||
* 物料分类 DO
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@TableName("mtrl_cls")
|
||||
@KeySequence("mtrl_cls_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class MtrlClsDO extends BusinessBaseDO {
|
||||
|
||||
public static final Long PARENT_ID_ROOT = 0L;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 父级ID
|
||||
*/
|
||||
@TableField("PRN_ID")
|
||||
private Long parentId;
|
||||
/**
|
||||
* 分类编码
|
||||
*/
|
||||
@TableField("CD")
|
||||
private String code;
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
@TableField("NAME")
|
||||
private String name;
|
||||
/**
|
||||
* 分类级别-用于类别层级(大/中/小类)
|
||||
*/
|
||||
@TableField("LVL")
|
||||
private Long level;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField("RMK")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.backendlogistics.dal.mysql.bseMngt.mtrl;
|
||||
|
||||
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.backendlogistics.controller.admin.backendlogistics.bseMngt.mtrl.vo.MtrlClsListReqVO;
|
||||
import cn.iocoder.yudao.module.backendlogistics.dal.dataobject.bseMngt.mtrl.MtrlClsDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 物料分类 Mapper
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Mapper
|
||||
public interface MtrlClsMapper extends BaseMapperX<MtrlClsDO> {
|
||||
|
||||
default List<MtrlClsDO> selectList(MtrlClsListReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<MtrlClsDO>()
|
||||
.eqIfPresent(MtrlClsDO::getParentId, reqVO.getParentId())
|
||||
.eqIfPresent(MtrlClsDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(MtrlClsDO::getName, reqVO.getName())
|
||||
.eqIfPresent(MtrlClsDO::getLevel, reqVO.getLevel())
|
||||
.eqIfPresent(MtrlClsDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(MtrlClsDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(MtrlClsDO::getId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.backendlogistics.service.bseMngt.mtrl;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.backendlogistics.controller.admin.backendlogistics.bseMngt.mtrl.vo.MtrlClsListReqVO;
|
||||
import cn.iocoder.yudao.module.backendlogistics.dal.dataobject.bseMngt.mtrl.MtrlClsDO;
|
||||
|
||||
/**
|
||||
* 物料分类 Service 接口
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
public interface MtrlClsService {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获得物料分类
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 物料分类
|
||||
*/
|
||||
MtrlClsDO getMtrlCls(Long id);
|
||||
|
||||
/**
|
||||
* 获得物料分类列表
|
||||
*
|
||||
* @param listReqVO 查询条件
|
||||
* @return 物料分类列表
|
||||
*/
|
||||
List<MtrlClsDO> getMtrlClsList(MtrlClsListReqVO listReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.backendlogistics.service.bseMngt.mtrl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.module.backendlogistics.controller.admin.backendlogistics.bseMngt.mtrl.vo.MtrlClsListReqVO;
|
||||
import cn.iocoder.yudao.module.backendlogistics.controller.admin.backendlogistics.bseMngt.mtrl.vo.MtrlClsRespVO;
|
||||
import cn.iocoder.yudao.module.backendlogistics.controller.admin.backendlogistics.bseMngt.mtrl.vo.MtrlClsSaveReqVO;
|
||||
import cn.iocoder.yudao.module.backendlogistics.dal.dataobject.bseMngt.mtrl.MtrlClsDO;
|
||||
import cn.iocoder.yudao.module.backendlogistics.dal.mysql.bseMngt.mtrl.MtrlClsMapper;
|
||||
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.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 物料分类 Service 实现类
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class MtrlClsServiceImpl implements MtrlClsService {
|
||||
|
||||
@Resource
|
||||
private MtrlClsMapper mtrlClsMapper;
|
||||
|
||||
@Override
|
||||
public MtrlClsDO getMtrlCls(Long id) {
|
||||
return mtrlClsMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MtrlClsDO> getMtrlClsList(MtrlClsListReqVO listReqVO) {
|
||||
return mtrlClsMapper.selectList(listReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user