feat(wms): 添加钢卷库区操作记录管理功能
- 创建钢卷库区操作记录实体类WmsCoilWarehouseOperationLog - 定义服务接口IWmsCoilWarehouseOperationLogService及其实现 - 实现控制器WmsCoilWarehouseOperationLogController提供CRUD操作 - 添加数据传输对象WmsCoilWarehouseOperationLogBo和WmsCoilWarehouseOperationLogVo - 配置MyBatis映射器WmsCoilWarehouseOperationLogMapper及XML映射文件 - 实现出入库操作类型和方向的业务字段定义 - 集成分页查询、导出Excel等功能
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
package com.klp.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.domain.vo.WmsCoilWarehouseOperationLogVo;
|
||||
import com.klp.domain.bo.WmsCoilWarehouseOperationLogBo;
|
||||
import com.klp.service.IWmsCoilWarehouseOperationLogService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 钢卷库区操作记录
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-03-05
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wms/coilWarehouseOperationLog")
|
||||
public class WmsCoilWarehouseOperationLogController extends BaseController {
|
||||
|
||||
private final IWmsCoilWarehouseOperationLogService iWmsCoilWarehouseOperationLogService;
|
||||
|
||||
/**
|
||||
* 查询钢卷库区操作记录列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsCoilWarehouseOperationLogVo> list(WmsCoilWarehouseOperationLogBo bo, PageQuery pageQuery) {
|
||||
return iWmsCoilWarehouseOperationLogService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出钢卷库区操作记录列表
|
||||
*/
|
||||
@Log(title = "钢卷库区操作记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsCoilWarehouseOperationLogBo bo, HttpServletResponse response) {
|
||||
List<WmsCoilWarehouseOperationLogVo> list = iWmsCoilWarehouseOperationLogService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "钢卷库区操作记录", WmsCoilWarehouseOperationLogVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取钢卷库区操作记录详细信息
|
||||
*
|
||||
* @param logId 主键
|
||||
*/
|
||||
@GetMapping("/{logId}")
|
||||
public R<WmsCoilWarehouseOperationLogVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long logId) {
|
||||
return R.ok(iWmsCoilWarehouseOperationLogService.queryById(logId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增钢卷库区操作记录
|
||||
*/
|
||||
@Log(title = "钢卷库区操作记录", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsCoilWarehouseOperationLogBo bo) {
|
||||
return toAjax(iWmsCoilWarehouseOperationLogService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改钢卷库区操作记录
|
||||
*/
|
||||
@Log(title = "钢卷库区操作记录", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsCoilWarehouseOperationLogBo bo) {
|
||||
return toAjax(iWmsCoilWarehouseOperationLogService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除钢卷库区操作记录
|
||||
*
|
||||
* @param logIds 主键串
|
||||
*/
|
||||
@Log(title = "钢卷库区操作记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{logIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] logIds) {
|
||||
return toAjax(iWmsCoilWarehouseOperationLogService.deleteWithValidByIds(Arrays.asList(logIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.klp.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 钢卷库区操作记录对象 wms_coil_warehouse_operation_log
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-03-05
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("wms_coil_warehouse_operation_log")
|
||||
public class WmsCoilWarehouseOperationLog extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "log_id")
|
||||
private Long logId;
|
||||
/**
|
||||
* 钢卷ID
|
||||
*/
|
||||
private Long coilId;
|
||||
/**
|
||||
* 实际库区ID
|
||||
*/
|
||||
private Long actualWarehouseId;
|
||||
/**
|
||||
* 业务操作类型:1=收货,2=加工,3=调拨,4=发货
|
||||
*/
|
||||
private Integer operationType;
|
||||
/**
|
||||
* 出入库方向:1=入库,2=出库
|
||||
*/
|
||||
private Integer inOutType;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标志(0=正常,1=已删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.klp.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* 钢卷库区操作记录业务对象 wms_coil_warehouse_operation_log
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-03-05
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WmsCoilWarehouseOperationLogBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long logId;
|
||||
|
||||
/**
|
||||
* 钢卷ID
|
||||
*/
|
||||
private Long coilId;
|
||||
|
||||
/**
|
||||
* 实际库区ID
|
||||
*/
|
||||
private Long actualWarehouseId;
|
||||
|
||||
/**
|
||||
* 业务操作类型:1=收货,2=加工,3=调拨,4=发货
|
||||
*/
|
||||
private Integer operationType;
|
||||
|
||||
/**
|
||||
* 出入库方向:1=入库,2=出库
|
||||
*/
|
||||
private Integer inOutType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.klp.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 钢卷库区操作记录视图对象 wms_coil_warehouse_operation_log
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-03-05
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WmsCoilWarehouseOperationLogVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long logId;
|
||||
|
||||
/**
|
||||
* 钢卷ID
|
||||
*/
|
||||
@ExcelProperty(value = "钢卷ID")
|
||||
private Long coilId;
|
||||
|
||||
/**
|
||||
* 实际库区ID
|
||||
*/
|
||||
@ExcelProperty(value = "实际库区ID")
|
||||
private Long actualWarehouseId;
|
||||
|
||||
/**
|
||||
* 业务操作类型:1=收货,2=加工,3=调拨,4=发货
|
||||
*/
|
||||
@ExcelProperty(value = "业务操作类型:1=收货,2=加工,3=调拨,4=发货")
|
||||
private Integer operationType;
|
||||
|
||||
/**
|
||||
* 出入库方向:1=入库,2=出库
|
||||
*/
|
||||
@ExcelProperty(value = "出入库方向:1=入库,2=出库")
|
||||
private Integer inOutType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.mapper;
|
||||
|
||||
import com.klp.domain.WmsCoilWarehouseOperationLog;
|
||||
import com.klp.domain.vo.WmsCoilWarehouseOperationLogVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 钢卷库区操作记录Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-03-05
|
||||
*/
|
||||
public interface WmsCoilWarehouseOperationLogMapper extends BaseMapperPlus<WmsCoilWarehouseOperationLogMapper, WmsCoilWarehouseOperationLog, WmsCoilWarehouseOperationLogVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.service;
|
||||
|
||||
import com.klp.domain.WmsCoilWarehouseOperationLog;
|
||||
import com.klp.domain.vo.WmsCoilWarehouseOperationLogVo;
|
||||
import com.klp.domain.bo.WmsCoilWarehouseOperationLogBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 钢卷库区操作记录Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-03-05
|
||||
*/
|
||||
public interface IWmsCoilWarehouseOperationLogService {
|
||||
|
||||
/**
|
||||
* 查询钢卷库区操作记录
|
||||
*/
|
||||
WmsCoilWarehouseOperationLogVo queryById(Long logId);
|
||||
|
||||
/**
|
||||
* 查询钢卷库区操作记录列表
|
||||
*/
|
||||
TableDataInfo<WmsCoilWarehouseOperationLogVo> queryPageList(WmsCoilWarehouseOperationLogBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询钢卷库区操作记录列表
|
||||
*/
|
||||
List<WmsCoilWarehouseOperationLogVo> queryList(WmsCoilWarehouseOperationLogBo bo);
|
||||
|
||||
/**
|
||||
* 新增钢卷库区操作记录
|
||||
*/
|
||||
Boolean insertByBo(WmsCoilWarehouseOperationLogBo bo);
|
||||
|
||||
/**
|
||||
* 修改钢卷库区操作记录
|
||||
*/
|
||||
Boolean updateByBo(WmsCoilWarehouseOperationLogBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除钢卷库区操作记录信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.klp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.domain.bo.WmsCoilWarehouseOperationLogBo;
|
||||
import com.klp.domain.vo.WmsCoilWarehouseOperationLogVo;
|
||||
import com.klp.domain.WmsCoilWarehouseOperationLog;
|
||||
import com.klp.mapper.WmsCoilWarehouseOperationLogMapper;
|
||||
import com.klp.service.IWmsCoilWarehouseOperationLogService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 钢卷库区操作记录Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-03-05
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsCoilWarehouseOperationLogServiceImpl implements IWmsCoilWarehouseOperationLogService {
|
||||
|
||||
private final WmsCoilWarehouseOperationLogMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询钢卷库区操作记录
|
||||
*/
|
||||
@Override
|
||||
public WmsCoilWarehouseOperationLogVo queryById(Long logId){
|
||||
return baseMapper.selectVoById(logId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询钢卷库区操作记录列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsCoilWarehouseOperationLogVo> queryPageList(WmsCoilWarehouseOperationLogBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsCoilWarehouseOperationLog> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsCoilWarehouseOperationLogVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询钢卷库区操作记录列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsCoilWarehouseOperationLogVo> queryList(WmsCoilWarehouseOperationLogBo bo) {
|
||||
LambdaQueryWrapper<WmsCoilWarehouseOperationLog> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsCoilWarehouseOperationLog> buildQueryWrapper(WmsCoilWarehouseOperationLogBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WmsCoilWarehouseOperationLog> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getCoilId() != null, WmsCoilWarehouseOperationLog::getCoilId, bo.getCoilId());
|
||||
lqw.eq(bo.getActualWarehouseId() != null, WmsCoilWarehouseOperationLog::getActualWarehouseId, bo.getActualWarehouseId());
|
||||
lqw.eq(bo.getOperationType() != null, WmsCoilWarehouseOperationLog::getOperationType, bo.getOperationType());
|
||||
lqw.eq(bo.getInOutType() != null, WmsCoilWarehouseOperationLog::getInOutType, bo.getInOutType());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增钢卷库区操作记录
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsCoilWarehouseOperationLogBo bo) {
|
||||
WmsCoilWarehouseOperationLog add = BeanUtil.toBean(bo, WmsCoilWarehouseOperationLog.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setLogId(add.getLogId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改钢卷库区操作记录
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsCoilWarehouseOperationLogBo bo) {
|
||||
WmsCoilWarehouseOperationLog update = BeanUtil.toBean(bo, WmsCoilWarehouseOperationLog.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsCoilWarehouseOperationLog entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除钢卷库区操作记录
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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="com.klp.mapper.WmsCoilWarehouseOperationLogMapper">
|
||||
|
||||
<resultMap type="com.klp.domain.WmsCoilWarehouseOperationLog" id="WmsCoilWarehouseOperationLogResult">
|
||||
<result property="logId" column="log_id"/>
|
||||
<result property="coilId" column="coil_id"/>
|
||||
<result property="actualWarehouseId" column="actual_warehouse_id"/>
|
||||
<result property="operationType" column="operation_type"/>
|
||||
<result property="inOutType" column="in_out_type"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user