add(hwmom-mes): 新增班组信息和班次信息模块
- 添加了班组信息(BaseClassTeamInfo)和班次信息(BaseShiftInfo)的实体类、业务对象类、控制器、Mapper接口和实现类、服务接口和实现类以及视图对象类master
parent
03f2457be7
commit
dd3625c6e5
@ -0,0 +1,117 @@
|
||||
package org.dromara.mes.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.mes.domain.vo.BaseClassTeamInfoVo;
|
||||
import org.dromara.mes.domain.bo.BaseClassTeamInfoBo;
|
||||
import org.dromara.mes.service.IBaseClassTeamInfoService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 班组信息
|
||||
* 前端访问路由地址为:/mes/baseClassTeamInfo
|
||||
*
|
||||
* @author ZangCH
|
||||
* @date 2025-01-06
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/baseClassTeamInfo")
|
||||
public class BaseClassTeamInfoController extends BaseController {
|
||||
|
||||
private final IBaseClassTeamInfoService baseClassTeamInfoService;
|
||||
|
||||
/**
|
||||
* 查询班组信息列表
|
||||
*/
|
||||
@SaCheckPermission("mes:baseClassTeamInfo:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<BaseClassTeamInfoVo> list(BaseClassTeamInfoBo bo, PageQuery pageQuery) {
|
||||
return baseClassTeamInfoService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出班组信息列表
|
||||
*/
|
||||
@SaCheckPermission("mes:baseClassTeamInfo:export")
|
||||
@Log(title = "班组信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(BaseClassTeamInfoBo bo, HttpServletResponse response) {
|
||||
List<BaseClassTeamInfoVo> list = baseClassTeamInfoService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "班组信息", BaseClassTeamInfoVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取班组信息详细信息
|
||||
*
|
||||
* @param classTeamId 主键
|
||||
*/
|
||||
@SaCheckPermission("mes:baseClassTeamInfo:query")
|
||||
@GetMapping("/{classTeamId}")
|
||||
public R<BaseClassTeamInfoVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long classTeamId) {
|
||||
return R.ok(baseClassTeamInfoService.queryById(classTeamId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增班组信息
|
||||
*/
|
||||
@SaCheckPermission("mes:baseClassTeamInfo:add")
|
||||
@Log(title = "班组信息", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody BaseClassTeamInfoBo bo) {
|
||||
return toAjax(baseClassTeamInfoService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改班组信息
|
||||
*/
|
||||
@SaCheckPermission("mes:baseClassTeamInfo:edit")
|
||||
@Log(title = "班组信息", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BaseClassTeamInfoBo bo) {
|
||||
return toAjax(baseClassTeamInfoService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除班组信息
|
||||
*
|
||||
* @param classTeamIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("mes:baseClassTeamInfo:remove")
|
||||
@Log(title = "班组信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{classTeamIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] classTeamIds) {
|
||||
return toAjax(baseClassTeamInfoService.deleteWithValidByIds(List.of(classTeamIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询班组信息列表
|
||||
*/
|
||||
@SaCheckPermission("mes:baseClassTeamInfo:list")
|
||||
@GetMapping("/selectList")
|
||||
public R<List<BaseClassTeamInfoVo>>selectClassTeamList(BaseClassTeamInfoBo bo, PageQuery pageQuery) {
|
||||
return R.ok(baseClassTeamInfoService.queryList(bo));
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
package org.dromara.mes.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.mes.domain.vo.BaseShiftInfoVo;
|
||||
import org.dromara.mes.domain.bo.BaseShiftInfoBo;
|
||||
import org.dromara.mes.service.IBaseShiftInfoService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 班次信息
|
||||
* 前端访问路由地址为:/mes/BaseShiftInfo
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-06
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/baseShiftInfo")
|
||||
public class BaseShiftInfoController extends BaseController {
|
||||
|
||||
private final IBaseShiftInfoService baseShiftInfoService;
|
||||
|
||||
/**
|
||||
* 查询班次信息列表
|
||||
*/
|
||||
@SaCheckPermission("mes:baseShiftInfo:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<BaseShiftInfoVo> list(BaseShiftInfoBo bo, PageQuery pageQuery) {
|
||||
return baseShiftInfoService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出班次信息列表
|
||||
*/
|
||||
@SaCheckPermission("mes:baseShiftInfo:export")
|
||||
@Log(title = "班次信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(BaseShiftInfoBo bo, HttpServletResponse response) {
|
||||
List<BaseShiftInfoVo> list = baseShiftInfoService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "班次信息", BaseShiftInfoVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取班次信息详细信息
|
||||
*
|
||||
* @param shiftId 主键
|
||||
*/
|
||||
@SaCheckPermission("mes:baseShiftInfo:query")
|
||||
@GetMapping("/{shiftId}")
|
||||
public R<BaseShiftInfoVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long shiftId) {
|
||||
return R.ok(baseShiftInfoService.queryById(shiftId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增班次信息
|
||||
*/
|
||||
@SaCheckPermission("mes:baseShiftInfo:add")
|
||||
@Log(title = "班次信息", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody BaseShiftInfoBo bo) {
|
||||
return toAjax(baseShiftInfoService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改班次信息
|
||||
*/
|
||||
@SaCheckPermission("mes:baseShiftInfo:edit")
|
||||
@Log(title = "班次信息", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BaseShiftInfoBo bo) {
|
||||
return toAjax(baseShiftInfoService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除班次信息
|
||||
*
|
||||
* @param shiftIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("mes:baseShiftInfo:remove")
|
||||
@Log(title = "班次信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{shiftIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] shiftIds) {
|
||||
return toAjax(baseShiftInfoService.deleteWithValidByIds(List.of(shiftIds), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下拉框查询班次信息列表
|
||||
*/
|
||||
/* @SaCheckPermission("mes:baseShiftInfo:list")*/
|
||||
@GetMapping("getBaseShiftInfoList")
|
||||
public R<List<BaseShiftInfoVo>> getBaseShiftInfolist(BaseShiftInfoBo bo) {
|
||||
List<BaseShiftInfoVo> list = baseShiftInfoService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.mes.mapper;
|
||||
|
||||
import org.dromara.mes.domain.BaseClassTeamInfo;
|
||||
import org.dromara.mes.domain.vo.BaseClassTeamInfoVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 班组信息Mapper接口
|
||||
*
|
||||
* @author ZangCH
|
||||
* @date 2025-01-06
|
||||
*/
|
||||
public interface BaseClassTeamInfoMapper extends BaseMapperPlus<BaseClassTeamInfo, BaseClassTeamInfoVo> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.mes.mapper;
|
||||
|
||||
import org.dromara.mes.domain.BaseShiftInfo;
|
||||
import org.dromara.mes.domain.vo.BaseShiftInfoVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 班次信息Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-06
|
||||
*/
|
||||
public interface BaseShiftInfoMapper extends BaseMapperPlus<BaseShiftInfo, BaseShiftInfoVo> {
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package org.dromara.mes.service;
|
||||
|
||||
import org.dromara.mes.domain.BaseClassTeamInfo;
|
||||
import org.dromara.mes.domain.vo.BaseClassTeamInfoVo;
|
||||
import org.dromara.mes.domain.bo.BaseClassTeamInfoBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 班组信息Service接口
|
||||
*
|
||||
* @author ZangCH
|
||||
* @date 2025-01-06
|
||||
*/
|
||||
public interface IBaseClassTeamInfoService {
|
||||
|
||||
/**
|
||||
* 查询班组信息
|
||||
*
|
||||
* @param classTeamId 主键
|
||||
* @return 班组信息
|
||||
*/
|
||||
BaseClassTeamInfoVo queryById(Long classTeamId);
|
||||
|
||||
/**
|
||||
* 分页查询班组信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 班组信息分页列表
|
||||
*/
|
||||
TableDataInfo<BaseClassTeamInfoVo> queryPageList(BaseClassTeamInfoBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的班组信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 班组信息列表
|
||||
*/
|
||||
List<BaseClassTeamInfoVo> queryList(BaseClassTeamInfoBo bo);
|
||||
|
||||
/**
|
||||
* 新增班组信息
|
||||
*
|
||||
* @param bo 班组信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(BaseClassTeamInfoBo bo);
|
||||
|
||||
/**
|
||||
* 修改班组信息
|
||||
*
|
||||
* @param bo 班组信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(BaseClassTeamInfoBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除班组信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package org.dromara.mes.service;
|
||||
|
||||
import org.dromara.mes.domain.BaseShiftInfo;
|
||||
import org.dromara.mes.domain.vo.BaseShiftInfoVo;
|
||||
import org.dromara.mes.domain.bo.BaseShiftInfoBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 班次信息Service接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-06
|
||||
*/
|
||||
public interface IBaseShiftInfoService {
|
||||
|
||||
/**
|
||||
* 查询班次信息
|
||||
*
|
||||
* @param shiftId 主键
|
||||
* @return 班次信息
|
||||
*/
|
||||
BaseShiftInfoVo queryById(Long shiftId);
|
||||
|
||||
/**
|
||||
* 分页查询班次信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 班次信息分页列表
|
||||
*/
|
||||
TableDataInfo<BaseShiftInfoVo> queryPageList(BaseShiftInfoBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的班次信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 班次信息列表
|
||||
*/
|
||||
List<BaseShiftInfoVo> queryList(BaseShiftInfoBo bo);
|
||||
|
||||
/**
|
||||
* 新增班次信息
|
||||
*
|
||||
* @param bo 班次信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(BaseShiftInfoBo bo);
|
||||
|
||||
/**
|
||||
* 修改班次信息
|
||||
*
|
||||
* @param bo 班次信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(BaseShiftInfoBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除班次信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,158 @@
|
||||
package org.dromara.mes.service.impl;
|
||||
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.mes.domain.bo.BaseClassTeamInfoBo;
|
||||
import org.dromara.mes.domain.vo.BaseClassTeamInfoVo;
|
||||
import org.dromara.mes.domain.BaseClassTeamInfo;
|
||||
import org.dromara.mes.mapper.BaseClassTeamInfoMapper;
|
||||
import org.dromara.mes.service.IBaseClassTeamInfoService;
|
||||
|
||||
import org.dromara.mes.domain.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 班组信息Service业务层处理
|
||||
*
|
||||
* @author ZangCH
|
||||
* @date 2025-01-06
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class BaseClassTeamInfoServiceImpl implements IBaseClassTeamInfoService {
|
||||
|
||||
private final BaseClassTeamInfoMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询班组信息
|
||||
*
|
||||
* @param classTeamId 主键
|
||||
* @return 班组信息
|
||||
*/
|
||||
@Override
|
||||
public BaseClassTeamInfoVo queryById(Long classTeamId){
|
||||
return baseMapper.selectVoById(classTeamId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询班组信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 班组信息分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<BaseClassTeamInfoVo> queryPageList(BaseClassTeamInfoBo bo, PageQuery pageQuery) {
|
||||
/* LambdaQueryWrapper<BaseClassTeamInfo> lqw = buildQueryWrapper(bo);
|
||||
Page<BaseClassTeamInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);*/
|
||||
MPJLambdaWrapper<BaseClassTeamInfo> lqw = buildQueryWrapper(bo);
|
||||
Page<BaseClassTeamInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的班组信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 班组信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<BaseClassTeamInfoVo> queryList(BaseClassTeamInfoBo bo) {
|
||||
MPJLambdaWrapper<BaseClassTeamInfo> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<BaseClassTeamInfo> buildQueryWrapper(BaseClassTeamInfoBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<BaseClassTeamInfo> lqw = JoinWrappers.lambda(BaseClassTeamInfo.class)
|
||||
.selectAll(BaseClassTeamInfo.class)
|
||||
|
||||
// 关联查询班次名称
|
||||
.select(BaseShiftInfo::getShiftName)
|
||||
.leftJoin(BaseShiftInfo.class, BaseShiftInfo::getShiftId, BaseClassTeamInfo::getShiftId)
|
||||
// 关联查询工位名称
|
||||
.select(ProdBaseStationInfo::getStationName)
|
||||
.leftJoin(ProdBaseStationInfo.class, ProdBaseStationInfo::getStationId, BaseClassTeamInfo::getStationId)
|
||||
// 关联查询工序名称
|
||||
.select(ProdBaseProcessInfo::getProcessName)
|
||||
.leftJoin(ProdBaseProcessInfo.class, ProdBaseProcessInfo::getProcessId, BaseClassTeamInfo::getProcessId)
|
||||
|
||||
.eq(bo.getClassTeamId() != null, BaseClassTeamInfo::getClassTeamId, bo.getClassTeamId())
|
||||
.eq(StringUtils.isNotBlank(bo.getTeamCode()), BaseClassTeamInfo::getTeamCode, bo.getTeamCode())
|
||||
.like(StringUtils.isNotBlank(bo.getTeamName()), BaseClassTeamInfo::getTeamName, bo.getTeamName())
|
||||
.eq(StringUtils.isNotBlank(bo.getTeamHead()), BaseClassTeamInfo::getTeamHead, bo.getTeamHead())
|
||||
.eq(bo.getShiftId() != null, BaseClassTeamInfo::getShiftId, bo.getShiftId())
|
||||
.eq(bo.getProcessId() != null, BaseClassTeamInfo::getProcessId, bo.getProcessId())
|
||||
.eq(bo.getStationId() != null, BaseClassTeamInfo::getStationId, bo.getStationId())
|
||||
.eq(bo.getDeviceId() != null, BaseClassTeamInfo::getDeviceId, bo.getDeviceId())
|
||||
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), BaseClassTeamInfo::getActiveFlag, bo.getActiveFlag())
|
||||
.orderByDesc(BaseClassTeamInfo::getCreateTime);
|
||||
return lqw;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增班组信息
|
||||
*
|
||||
* @param bo 班组信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(BaseClassTeamInfoBo bo) {
|
||||
BaseClassTeamInfo add = MapstructUtils.convert(bo, BaseClassTeamInfo.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setClassTeamId(add.getClassTeamId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改班组信息
|
||||
*
|
||||
* @param bo 班组信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(BaseClassTeamInfoBo bo) {
|
||||
BaseClassTeamInfo update = MapstructUtils.convert(bo, BaseClassTeamInfo.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(BaseClassTeamInfo entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除班组信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,149 @@
|
||||
package org.dromara.mes.service.impl;
|
||||
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import lombok.val;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.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 org.dromara.mes.domain.bo.BaseShiftInfoBo;
|
||||
import org.dromara.mes.domain.vo.BaseShiftInfoVo;
|
||||
import org.dromara.mes.domain.BaseShiftInfo;
|
||||
import org.dromara.mes.mapper.BaseShiftInfoMapper;
|
||||
import org.dromara.mes.service.IBaseShiftInfoService;
|
||||
import org.dromara.mes.domain.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 班次信息Service业务层处理
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-06
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class BaseShiftInfoServiceImpl implements IBaseShiftInfoService {
|
||||
|
||||
private final BaseShiftInfoMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询班次信息
|
||||
*
|
||||
* @param shiftId 主键
|
||||
* @return 班次信息
|
||||
*/
|
||||
@Override
|
||||
public BaseShiftInfoVo queryById(Long shiftId){
|
||||
return baseMapper.selectVoById(shiftId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询班次信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 班次信息分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<BaseShiftInfoVo> queryPageList(BaseShiftInfoBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<BaseShiftInfo> lqw = buildQueryWrapper(bo);
|
||||
Page<BaseShiftInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的班次信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 班次信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<BaseShiftInfoVo> queryList(BaseShiftInfoBo bo) {
|
||||
MPJLambdaWrapper<BaseShiftInfo> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<BaseShiftInfo> buildQueryWrapper(BaseShiftInfoBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<BaseShiftInfo> lqw = JoinWrappers.lambda(BaseShiftInfo.class)
|
||||
.selectAll(BaseShiftInfo.class)
|
||||
/* .leftJoin(BaseClassTeamInfo.class,BaseClassTeamInfo::getShiftId, BaseShiftInfo::getShiftId)*/
|
||||
.eq(bo.getShiftId() != null, BaseShiftInfo::getShiftId, bo.getShiftId())
|
||||
.eq(StringUtils.isNotBlank(bo.getShiftCode()), BaseShiftInfo::getShiftCode, bo.getShiftCode())
|
||||
.like(StringUtils.isNotBlank(bo.getShiftName()), BaseShiftInfo::getShiftName, bo.getShiftName())
|
||||
.eq(StringUtils.isNotBlank(bo.getStartTime()), BaseShiftInfo::getStartTime, bo.getStartTime())
|
||||
.eq(StringUtils.isNotBlank(bo.getStartCrossFlag()), BaseShiftInfo::getStartCrossFlag, bo.getStartCrossFlag())
|
||||
.eq(StringUtils.isNotBlank(bo.getEndTime()), BaseShiftInfo::getEndTime, bo.getEndTime())
|
||||
.eq(StringUtils.isNotBlank(bo.getEndCrossFlag()), BaseShiftInfo::getEndCrossFlag, bo.getEndCrossFlag())
|
||||
.eq(bo.getWorkHour() != null, BaseShiftInfo::getWorkHour, bo.getWorkHour())
|
||||
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), BaseShiftInfo::getActiveFlag, bo.getActiveFlag())
|
||||
.eq(bo.getCreateDept() != null, BaseShiftInfo::getCreateDept, bo.getCreateDept())
|
||||
.eq(bo.getCreateBy() != null, BaseShiftInfo::getCreateBy, bo.getCreateBy())
|
||||
.eq(bo.getCreateTime() != null, BaseShiftInfo::getCreateTime, bo.getCreateTime())
|
||||
.eq(bo.getUpdateBy() != null, BaseShiftInfo::getUpdateBy, bo.getUpdateBy())
|
||||
.eq(bo.getUpdateTime() != null, BaseShiftInfo::getUpdateTime, bo.getUpdateTime())
|
||||
.orderByDesc(BaseShiftInfo::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增班次信息
|
||||
*
|
||||
* @param bo 班次信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(BaseShiftInfoBo bo) {
|
||||
BaseShiftInfo add = MapstructUtils.convert(bo, BaseShiftInfo.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setShiftId(add.getShiftId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改班次信息
|
||||
*
|
||||
* @param bo 班次信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(BaseShiftInfoBo bo) {
|
||||
BaseShiftInfo update = MapstructUtils.convert(bo, BaseShiftInfo.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(BaseShiftInfo entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除班次信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?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="org.dromara.mes.mapper.BaseClassTeamInfoMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,7 @@
|
||||
<?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="org.dromara.mes.mapper.BaseShiftInfoMapper">
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue