Merge remote-tracking branch 'origin/0.8.X' into 0.8.X
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.WmsAttendanceTemplateVo;
|
||||
import com.klp.domain.bo.WmsAttendanceTemplateBo;
|
||||
import com.klp.service.IWmsAttendanceTemplateService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 排班模板
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-06
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wms/attendanceTemplate")
|
||||
public class WmsAttendanceTemplateController extends BaseController {
|
||||
|
||||
private final IWmsAttendanceTemplateService iWmsAttendanceTemplateService;
|
||||
|
||||
/**
|
||||
* 查询排班模板列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsAttendanceTemplateVo> list(WmsAttendanceTemplateBo bo, PageQuery pageQuery) {
|
||||
return iWmsAttendanceTemplateService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出排班模板列表
|
||||
*/
|
||||
@Log(title = "排班模板", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsAttendanceTemplateBo bo, HttpServletResponse response) {
|
||||
List<WmsAttendanceTemplateVo> list = iWmsAttendanceTemplateService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "排班模板", WmsAttendanceTemplateVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取排班模板详细信息
|
||||
*
|
||||
* @param templateId 主键
|
||||
*/
|
||||
@GetMapping("/{templateId}")
|
||||
public R<WmsAttendanceTemplateVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long templateId) {
|
||||
return R.ok(iWmsAttendanceTemplateService.queryById(templateId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增排班模板
|
||||
*/
|
||||
@Log(title = "排班模板", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsAttendanceTemplateBo bo) {
|
||||
return toAjax(iWmsAttendanceTemplateService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改排班模板
|
||||
*/
|
||||
@Log(title = "排班模板", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsAttendanceTemplateBo bo) {
|
||||
return toAjax(iWmsAttendanceTemplateService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除排班模板
|
||||
*
|
||||
* @param templateIds 主键串
|
||||
*/
|
||||
@Log(title = "排班模板", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{templateIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] templateIds) {
|
||||
return toAjax(iWmsAttendanceTemplateService.deleteWithValidByIds(Arrays.asList(templateIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.klp.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 排班模板对象 wms_attendance_template
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("wms_attendance_template")
|
||||
public class WmsAttendanceTemplate extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "template_id")
|
||||
private Long templateId;
|
||||
/**
|
||||
* 模板名称
|
||||
*/
|
||||
private String templateName;
|
||||
/**
|
||||
* 模板内容
|
||||
*/
|
||||
private String templateContent;
|
||||
/**
|
||||
* 删除标志(0=存在 2=删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.klp.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* 排班模板业务对象 wms_attendance_template
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-06
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WmsAttendanceTemplateBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class })
|
||||
private Long templateId;
|
||||
|
||||
private String templateName;
|
||||
|
||||
private String templateContent;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.klp.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 排班模板视图对象 wms_attendance_template
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-06
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WmsAttendanceTemplateVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long templateId;
|
||||
|
||||
/**
|
||||
* 模板名称
|
||||
*/
|
||||
@ExcelProperty(value = "模板名称")
|
||||
private String templateName;
|
||||
|
||||
/**
|
||||
* 模板内容
|
||||
*/
|
||||
@ExcelProperty(value = "模板内容")
|
||||
private String templateContent;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.mapper;
|
||||
|
||||
import com.klp.domain.WmsAttendanceTemplate;
|
||||
import com.klp.domain.vo.WmsAttendanceTemplateVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 排班模板Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-06
|
||||
*/
|
||||
public interface WmsAttendanceTemplateMapper extends BaseMapperPlus<WmsAttendanceTemplateMapper, WmsAttendanceTemplate, WmsAttendanceTemplateVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.service;
|
||||
|
||||
import com.klp.domain.WmsAttendanceTemplate;
|
||||
import com.klp.domain.vo.WmsAttendanceTemplateVo;
|
||||
import com.klp.domain.bo.WmsAttendanceTemplateBo;
|
||||
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-06-06
|
||||
*/
|
||||
public interface IWmsAttendanceTemplateService {
|
||||
|
||||
/**
|
||||
* 查询排班模板
|
||||
*/
|
||||
WmsAttendanceTemplateVo queryById(Long templateId);
|
||||
|
||||
/**
|
||||
* 查询排班模板列表
|
||||
*/
|
||||
TableDataInfo<WmsAttendanceTemplateVo> queryPageList(WmsAttendanceTemplateBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询排班模板列表
|
||||
*/
|
||||
List<WmsAttendanceTemplateVo> queryList(WmsAttendanceTemplateBo bo);
|
||||
|
||||
/**
|
||||
* 新增排班模板
|
||||
*/
|
||||
Boolean insertByBo(WmsAttendanceTemplateBo bo);
|
||||
|
||||
/**
|
||||
* 修改排班模板
|
||||
*/
|
||||
Boolean updateByBo(WmsAttendanceTemplateBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除排班模板信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.klp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
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.WmsAttendanceTemplateBo;
|
||||
import com.klp.domain.vo.WmsAttendanceTemplateVo;
|
||||
import com.klp.domain.WmsAttendanceTemplate;
|
||||
import com.klp.mapper.WmsAttendanceTemplateMapper;
|
||||
import com.klp.service.IWmsAttendanceTemplateService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 排班模板Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-06
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsAttendanceTemplateServiceImpl implements IWmsAttendanceTemplateService {
|
||||
|
||||
private final WmsAttendanceTemplateMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询排班模板
|
||||
*/
|
||||
@Override
|
||||
public WmsAttendanceTemplateVo queryById(Long templateId){
|
||||
return baseMapper.selectVoById(templateId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询排班模板列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsAttendanceTemplateVo> queryPageList(WmsAttendanceTemplateBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsAttendanceTemplate> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsAttendanceTemplateVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询排班模板列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsAttendanceTemplateVo> queryList(WmsAttendanceTemplateBo bo) {
|
||||
LambdaQueryWrapper<WmsAttendanceTemplate> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsAttendanceTemplate> buildQueryWrapper(WmsAttendanceTemplateBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WmsAttendanceTemplate> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getTemplateName()), WmsAttendanceTemplate::getTemplateName, bo.getTemplateName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getTemplateContent()), WmsAttendanceTemplate::getTemplateContent, bo.getTemplateContent());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增排班模板
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsAttendanceTemplateBo bo) {
|
||||
WmsAttendanceTemplate add = BeanUtil.toBean(bo, WmsAttendanceTemplate.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setTemplateId(add.getTemplateId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改排班模板
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsAttendanceTemplateBo bo) {
|
||||
WmsAttendanceTemplate update = BeanUtil.toBean(bo, WmsAttendanceTemplate.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsAttendanceTemplate entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除排班模板
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user