排产增删改查
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
package com.ruoyi.oa.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
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.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.core.validate.QueryGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.oa.domain.vo.OaReportScheduleVo;
|
||||
import com.ruoyi.oa.domain.bo.OaReportScheduleBo;
|
||||
import com.ruoyi.oa.service.IOaReportScheduleService;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 项目排产
|
||||
*
|
||||
* @author liujingchao
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/oa/reportSchedule")
|
||||
public class OaReportScheduleController extends BaseController {
|
||||
|
||||
private final IOaReportScheduleService iOaReportScheduleService;
|
||||
|
||||
/**
|
||||
* 查询项目排产列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<OaReportScheduleVo> list(OaReportScheduleBo bo, PageQuery pageQuery) {
|
||||
return iOaReportScheduleService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出项目排产列表
|
||||
*/
|
||||
@Log(title = "项目排产", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(OaReportScheduleBo bo, HttpServletResponse response) {
|
||||
List<OaReportScheduleVo> list = iOaReportScheduleService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "项目排产", OaReportScheduleVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目排产详细信息
|
||||
*
|
||||
* @param scheduleId 主键
|
||||
*/
|
||||
@GetMapping("/{scheduleId}")
|
||||
public R<OaReportScheduleVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long scheduleId) {
|
||||
return R.ok(iOaReportScheduleService.queryById(scheduleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目排产
|
||||
*/
|
||||
@Log(title = "项目排产", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody OaReportScheduleBo bo) {
|
||||
return toAjax(iOaReportScheduleService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目排产
|
||||
*/
|
||||
@Log(title = "项目排产", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody OaReportScheduleBo bo) {
|
||||
return toAjax(iOaReportScheduleService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目排产
|
||||
*
|
||||
* @param scheduleIds 主键串
|
||||
*/
|
||||
@Log(title = "项目排产", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{scheduleIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] scheduleIds) {
|
||||
return toAjax(iOaReportScheduleService.deleteWithValidByIds(Arrays.asList(scheduleIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.ruoyi.oa.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 项目排产对象 oa_report_schedule
|
||||
*
|
||||
* @author liujingchao
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("oa_report_schedule")
|
||||
public class OaReportSchedule extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "schedule_id")
|
||||
private Long scheduleId;
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
private Long projectId;
|
||||
/**
|
||||
* 排产名称
|
||||
*/
|
||||
private String scheduleName;
|
||||
/**
|
||||
* 排产类型(1常规,2特殊,便于扩展)
|
||||
*/
|
||||
private Long type;
|
||||
/**
|
||||
* 开始日期
|
||||
*/
|
||||
private Date startDate;
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
private Date endDate;
|
||||
/**
|
||||
* 排产数量
|
||||
*/
|
||||
private Long amount;
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private String header;
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String contactPhone;
|
||||
/**
|
||||
* 发货联动状态(0未导入,1已导入)
|
||||
*/
|
||||
private Long deliveryStatus;
|
||||
/**
|
||||
* 关联发货记录ID
|
||||
*/
|
||||
private Long deliveryId;
|
||||
/**
|
||||
* 导入发货时间
|
||||
*/
|
||||
private Date deliveryTime;
|
||||
/**
|
||||
* OSS附件ID列表,多个ID用逗号分隔
|
||||
*/
|
||||
private String accessory;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Long sort;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Long status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标志(0正常,1删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private Long delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.ruoyi.oa.domain.bo;
|
||||
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 项目排产业务对象 oa_report_schedule
|
||||
*
|
||||
* @author liujingchao
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class OaReportScheduleBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 排产名称
|
||||
*/
|
||||
private String scheduleName;
|
||||
|
||||
/**
|
||||
* 排产类型(1常规,2特殊,便于扩展)
|
||||
*/
|
||||
private Long type;
|
||||
|
||||
/**
|
||||
* 开始日期
|
||||
*/
|
||||
private Date startDate;
|
||||
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
private Date endDate;
|
||||
|
||||
/**
|
||||
* 排产数量
|
||||
*/
|
||||
private Long amount;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private String header;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 发货联动状态(0未导入,1已导入)
|
||||
*/
|
||||
private Long deliveryStatus;
|
||||
|
||||
/**
|
||||
* 关联发货记录ID
|
||||
*/
|
||||
private Long deliveryId;
|
||||
|
||||
/**
|
||||
* 导入发货时间
|
||||
*/
|
||||
private Date deliveryTime;
|
||||
|
||||
/**
|
||||
* OSS附件ID列表,多个ID用逗号分隔
|
||||
*/
|
||||
private String accessory;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.ruoyi.oa.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.ruoyi.common.annotation.ExcelDictFormat;
|
||||
import com.ruoyi.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 项目排产视图对象 oa_report_schedule
|
||||
*
|
||||
* @author liujingchao
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class OaReportScheduleVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
@ExcelProperty(value = "项目ID")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 排产名称
|
||||
*/
|
||||
@ExcelProperty(value = "排产名称")
|
||||
private String scheduleName;
|
||||
|
||||
/**
|
||||
* 排产类型(1常规,2特殊,便于扩展)
|
||||
*/
|
||||
@ExcelProperty(value = "排产类型", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "1=常规,2特殊,便于扩展")
|
||||
private Long type;
|
||||
|
||||
/**
|
||||
* 开始日期
|
||||
*/
|
||||
@ExcelProperty(value = "开始日期")
|
||||
private Date startDate;
|
||||
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
@ExcelProperty(value = "结束日期")
|
||||
private Date endDate;
|
||||
|
||||
/**
|
||||
* 排产数量
|
||||
*/
|
||||
@ExcelProperty(value = "排产数量")
|
||||
private Long amount;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
@ExcelProperty(value = "负责人")
|
||||
private String header;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@ExcelProperty(value = "联系电话")
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 发货联动状态(0未导入,1已导入)
|
||||
*/
|
||||
@ExcelProperty(value = "发货联动状态", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "0=未导入,1已导入")
|
||||
private Long deliveryStatus;
|
||||
|
||||
/**
|
||||
* 关联发货记录ID
|
||||
*/
|
||||
@ExcelProperty(value = "关联发货记录ID")
|
||||
private Long deliveryId;
|
||||
|
||||
/**
|
||||
* 导入发货时间
|
||||
*/
|
||||
@ExcelProperty(value = "导入发货时间")
|
||||
private Date deliveryTime;
|
||||
|
||||
/**
|
||||
* OSS附件ID列表,多个ID用逗号分隔
|
||||
*/
|
||||
@ExcelProperty(value = "OSS附件ID列表,多个ID用逗号分隔")
|
||||
private String accessory;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@ExcelProperty(value = "状态")
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.ruoyi.oa.mapper;
|
||||
|
||||
import com.ruoyi.oa.domain.OaReportSchedule;
|
||||
import com.ruoyi.oa.domain.vo.OaReportScheduleVo;
|
||||
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 项目排产Mapper接口
|
||||
*
|
||||
* @author liujingchao
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
public interface OaReportScheduleMapper extends BaseMapperPlus<OaReportScheduleMapper, OaReportSchedule, OaReportScheduleVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.ruoyi.oa.service;
|
||||
|
||||
import com.ruoyi.oa.domain.OaReportSchedule;
|
||||
import com.ruoyi.oa.domain.vo.OaReportScheduleVo;
|
||||
import com.ruoyi.oa.domain.bo.OaReportScheduleBo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目排产Service接口
|
||||
*
|
||||
* @author liujingchao
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
public interface IOaReportScheduleService {
|
||||
|
||||
/**
|
||||
* 查询项目排产
|
||||
*/
|
||||
OaReportScheduleVo queryById(Long scheduleId);
|
||||
|
||||
/**
|
||||
* 查询项目排产列表
|
||||
*/
|
||||
TableDataInfo<OaReportScheduleVo> queryPageList(OaReportScheduleBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询项目排产列表
|
||||
*/
|
||||
List<OaReportScheduleVo> queryList(OaReportScheduleBo bo);
|
||||
|
||||
/**
|
||||
* 新增项目排产
|
||||
*/
|
||||
Boolean insertByBo(OaReportScheduleBo bo);
|
||||
|
||||
/**
|
||||
* 修改项目排产
|
||||
*/
|
||||
Boolean updateByBo(OaReportScheduleBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除项目排产信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.ruoyi.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.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.ruoyi.oa.domain.bo.OaReportScheduleBo;
|
||||
import com.ruoyi.oa.domain.vo.OaReportScheduleVo;
|
||||
import com.ruoyi.oa.domain.OaReportSchedule;
|
||||
import com.ruoyi.oa.mapper.OaReportScheduleMapper;
|
||||
import com.ruoyi.oa.service.IOaReportScheduleService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 项目排产Service业务层处理
|
||||
*
|
||||
* @author liujingchao
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class OaReportScheduleServiceImpl implements IOaReportScheduleService {
|
||||
|
||||
private final OaReportScheduleMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询项目排产
|
||||
*/
|
||||
@Override
|
||||
public OaReportScheduleVo queryById(Long scheduleId){
|
||||
return baseMapper.selectVoById(scheduleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目排产列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<OaReportScheduleVo> queryPageList(OaReportScheduleBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<OaReportSchedule> lqw = buildQueryWrapper(bo);
|
||||
Page<OaReportScheduleVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目排产列表
|
||||
*/
|
||||
@Override
|
||||
public List<OaReportScheduleVo> queryList(OaReportScheduleBo bo) {
|
||||
LambdaQueryWrapper<OaReportSchedule> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<OaReportSchedule> buildQueryWrapper(OaReportScheduleBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<OaReportSchedule> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getProjectId() != null, OaReportSchedule::getProjectId, bo.getProjectId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getScheduleName()), OaReportSchedule::getScheduleName, bo.getScheduleName());
|
||||
lqw.eq(bo.getType() != null, OaReportSchedule::getType, bo.getType());
|
||||
lqw.eq(bo.getStartDate() != null, OaReportSchedule::getStartDate, bo.getStartDate());
|
||||
lqw.eq(bo.getEndDate() != null, OaReportSchedule::getEndDate, bo.getEndDate());
|
||||
lqw.eq(bo.getAmount() != null, OaReportSchedule::getAmount, bo.getAmount());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getHeader()), OaReportSchedule::getHeader, bo.getHeader());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getContactPhone()), OaReportSchedule::getContactPhone, bo.getContactPhone());
|
||||
lqw.eq(bo.getDeliveryStatus() != null, OaReportSchedule::getDeliveryStatus, bo.getDeliveryStatus());
|
||||
lqw.eq(bo.getStatus() != null, OaReportSchedule::getStatus, bo.getStatus());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目排产
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(OaReportScheduleBo bo) {
|
||||
OaReportSchedule add = BeanUtil.toBean(bo, OaReportSchedule.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目排产
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(OaReportScheduleBo bo) {
|
||||
OaReportSchedule update = BeanUtil.toBean(bo, OaReportSchedule.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(OaReportSchedule entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除项目排产
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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.ruoyi.oa.mapper.OaReportScheduleMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.oa.domain.OaReportSchedule" id="OaReportScheduleResult">
|
||||
<result property="scheduleId" column="schedule_id"/>
|
||||
<result property="projectId" column="project_id"/>
|
||||
<result property="scheduleName" column="schedule_name"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="startDate" column="start_date"/>
|
||||
<result property="endDate" column="end_date"/>
|
||||
<result property="amount" column="amount"/>
|
||||
<result property="header" column="header"/>
|
||||
<result property="contactPhone" column="contact_phone"/>
|
||||
<result property="deliveryStatus" column="delivery_status"/>
|
||||
<result property="deliveryId" column="delivery_id"/>
|
||||
<result property="deliveryTime" column="delivery_time"/>
|
||||
<result property="accessory" column="accessory"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user