排产增删改查
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user