feat(wms/report): 新增WMS报表通用配置管理功能
- 新增WmsReportConfig实体类、Bo、Vo和Mapper,定义报表配置的数据结构 - 新增IWmsReportConfigService接口及WmsReportConfigServiceImpl实现类,提供增删改查和分页查询服务 - 新增WmsReportConfigController控制器,提供配置列表、详情、新增、修改、删除和导出的API接口 - 在WmsReportConfigMapper.xml中映射数据库字段与实体属性
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.WmsReportConfigVo;
|
||||
import com.klp.domain.bo.WmsReportConfigBo;
|
||||
import com.klp.service.IWmsReportConfigService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* WMS报通用配置
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wms/reportConfig")
|
||||
public class WmsReportConfigController extends BaseController {
|
||||
|
||||
private final IWmsReportConfigService iWmsReportConfigService;
|
||||
|
||||
/**
|
||||
* 查询WMS报通用配置列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsReportConfigVo> list(WmsReportConfigBo bo, PageQuery pageQuery) {
|
||||
return iWmsReportConfigService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出WMS报通用配置列表
|
||||
*/
|
||||
@Log(title = "WMS报通用配置", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsReportConfigBo bo, HttpServletResponse response) {
|
||||
List<WmsReportConfigVo> list = iWmsReportConfigService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "WMS报通用配置", WmsReportConfigVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取WMS报通用配置详细信息
|
||||
*
|
||||
* @param configId 主键
|
||||
*/
|
||||
@GetMapping("/{configId}")
|
||||
public R<WmsReportConfigVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long configId) {
|
||||
return R.ok(iWmsReportConfigService.queryById(configId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增WMS报通用配置
|
||||
*/
|
||||
@Log(title = "WMS报通用配置", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsReportConfigBo bo) {
|
||||
return toAjax(iWmsReportConfigService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改WMS报通用配置
|
||||
*/
|
||||
@Log(title = "WMS报通用配置", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsReportConfigBo bo) {
|
||||
return toAjax(iWmsReportConfigService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除WMS报通用配置
|
||||
*
|
||||
* @param configIds 主键串
|
||||
*/
|
||||
@Log(title = "WMS报通用配置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{configIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] configIds) {
|
||||
return toAjax(iWmsReportConfigService.deleteWithValidByIds(Arrays.asList(configIds), true));
|
||||
}
|
||||
}
|
||||
49
klp-wms/src/main/java/com/klp/domain/WmsReportConfig.java
Normal file
49
klp-wms/src/main/java/com/klp/domain/WmsReportConfig.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package com.klp.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* WMS报通用配置对象 wms_report_config
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("wms_report_config")
|
||||
public class WmsReportConfig extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "config_id")
|
||||
private Long configId;
|
||||
/**
|
||||
* 报表唯一编码(如:attendance_report、coil_report)
|
||||
*/
|
||||
private String reportCode;
|
||||
/**
|
||||
* 报表名称
|
||||
*/
|
||||
private String reportName;
|
||||
/**
|
||||
* 报表配置JSON(列配置、查询条件、样式、权限等)
|
||||
*/
|
||||
private String configJson;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标识 0正常 2删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.klp.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* WMS报通用配置业务对象 wms_report_config
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WmsReportConfigBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long configId;
|
||||
|
||||
/**
|
||||
* 报表唯一编码(如:attendance_report、coil_report)
|
||||
*/
|
||||
private String reportCode;
|
||||
|
||||
/**
|
||||
* 报表名称
|
||||
*/
|
||||
private String reportName;
|
||||
|
||||
/**
|
||||
* 报表配置JSON(列配置、查询条件、样式、权限等)
|
||||
*/
|
||||
private String configJson;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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报通用配置视图对象 wms_report_config
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WmsReportConfigVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long configId;
|
||||
|
||||
/**
|
||||
* 报表唯一编码(如:attendance_report、coil_report)
|
||||
*/
|
||||
@ExcelProperty(value = "报表唯一编码", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "如=:attendance_report、coil_report")
|
||||
private String reportCode;
|
||||
|
||||
/**
|
||||
* 报表名称
|
||||
*/
|
||||
@ExcelProperty(value = "报表名称")
|
||||
private String reportName;
|
||||
|
||||
/**
|
||||
* 报表配置JSON(列配置、查询条件、样式、权限等)
|
||||
*/
|
||||
@ExcelProperty(value = "报表配置JSON", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "列=配置、查询条件、样式、权限等")
|
||||
private String configJson;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.mapper;
|
||||
|
||||
import com.klp.domain.WmsReportConfig;
|
||||
import com.klp.domain.vo.WmsReportConfigVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* WMS报通用配置Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
public interface WmsReportConfigMapper extends BaseMapperPlus<WmsReportConfigMapper, WmsReportConfig, WmsReportConfigVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.service;
|
||||
|
||||
import com.klp.domain.WmsReportConfig;
|
||||
import com.klp.domain.vo.WmsReportConfigVo;
|
||||
import com.klp.domain.bo.WmsReportConfigBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* WMS报通用配置Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
public interface IWmsReportConfigService {
|
||||
|
||||
/**
|
||||
* 查询WMS报通用配置
|
||||
*/
|
||||
WmsReportConfigVo queryById(Long configId);
|
||||
|
||||
/**
|
||||
* 查询WMS报通用配置列表
|
||||
*/
|
||||
TableDataInfo<WmsReportConfigVo> queryPageList(WmsReportConfigBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询WMS报通用配置列表
|
||||
*/
|
||||
List<WmsReportConfigVo> queryList(WmsReportConfigBo bo);
|
||||
|
||||
/**
|
||||
* 新增WMS报通用配置
|
||||
*/
|
||||
Boolean insertByBo(WmsReportConfigBo bo);
|
||||
|
||||
/**
|
||||
* 修改WMS报通用配置
|
||||
*/
|
||||
Boolean updateByBo(WmsReportConfigBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除WMS报通用配置信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
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 com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.domain.bo.WmsReportConfigBo;
|
||||
import com.klp.domain.vo.WmsReportConfigVo;
|
||||
import com.klp.domain.WmsReportConfig;
|
||||
import com.klp.mapper.WmsReportConfigMapper;
|
||||
import com.klp.service.IWmsReportConfigService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* WMS报通用配置Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsReportConfigServiceImpl implements IWmsReportConfigService {
|
||||
|
||||
private final WmsReportConfigMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询WMS报通用配置
|
||||
*/
|
||||
@Override
|
||||
public WmsReportConfigVo queryById(Long configId){
|
||||
return baseMapper.selectVoById(configId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询WMS报通用配置列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsReportConfigVo> queryPageList(WmsReportConfigBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsReportConfig> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsReportConfigVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询WMS报通用配置列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsReportConfigVo> queryList(WmsReportConfigBo bo) {
|
||||
LambdaQueryWrapper<WmsReportConfig> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsReportConfig> buildQueryWrapper(WmsReportConfigBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WmsReportConfig> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getReportCode()), WmsReportConfig::getReportCode, bo.getReportCode());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getReportName()), WmsReportConfig::getReportName, bo.getReportName());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getConfigJson()), WmsReportConfig::getConfigJson, bo.getConfigJson());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getRemark()), WmsReportConfig::getRemark, bo.getRemark());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增WMS报通用配置
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsReportConfigBo bo) {
|
||||
WmsReportConfig add = BeanUtil.toBean(bo, WmsReportConfig.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setConfigId(add.getConfigId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改WMS报通用配置
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsReportConfigBo bo) {
|
||||
WmsReportConfig update = BeanUtil.toBean(bo, WmsReportConfig.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsReportConfig entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除WMS报通用配置
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user