add(hwmom-mes): 新增班组信息和班次信息模块

- 添加了班组信息(BaseClassTeamInfo)和班次信息(BaseShiftInfo)的实体类、业务对象类、控制器、Mapper接口和实现类、服务接口和实现类以及视图对象类
master
zch 3 months ago
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,89 @@
package org.dromara.mes.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* base_class_team_info
*
* @author ZangCH
* @date 2025-01-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("base_class_team_info")
public class BaseClassTeamInfo extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "class_team_id", type = IdType.AUTO)
private Long classTeamId;
/**
*
*/
private String teamCode;
/**
*
*/
private String teamName;
/**
*
*/
private String teamHead;
/**
* ID
*/
private Long shiftId;
/**
* ID
*/
private Long processId;
/**
* ID
*/
private Long stationId;
/**
* ID
*/
private Long deviceId;
/**
* 1 0
*/
private String activeFlag;
/**
* BaseShiftInfo
*/
@TableField(exist = false)
private String shiftName;
/**
* ProdBaseStationInfo
*/
@TableField(exist = false)
private String stationName;
/**
* ProdBaseProcessInfo
*/
@TableField(exist = false)
private String processName;
}

@ -0,0 +1,70 @@
package org.dromara.mes.domain;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* base_shift_info
*
* @author LionLi
* @date 2025-01-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("base_shift_info")
public class BaseShiftInfo extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "shift_id", type = IdType.ASSIGN_ID)
private Long shiftId;
/**
*
*/
private String shiftCode;
/**
*
*/
private String shiftName;
/**
*
*/
private String startTime;
/**
* 1 0
*/
private String startCrossFlag;
/**
*
*/
private String endTime;
/**
* 1 0
*/
private String endCrossFlag;
/**
*
*/
private Long workHour;
/**
* 1 0
*/
private String activeFlag;
}

@ -0,0 +1,78 @@
package org.dromara.mes.domain.bo;
import org.dromara.mes.domain.BaseClassTeamInfo;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
/**
* base_class_team_info
*
* @author ZangCH
* @date 2025-01-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = BaseClassTeamInfo.class, reverseConvertGenerate = false)
public class BaseClassTeamInfoBo extends BaseEntity {
/**
*
*/
/* @NotNull(message = "主键标识不能为空", groups = { AddGroup.class, EditGroup.class })*/
private Long classTeamId;
/**
*
*/
@NotBlank(message = "班组编号不能为空", groups = { AddGroup.class, EditGroup.class })
private String teamCode;
/**
*
*/
@NotBlank(message = "班组名称不能为空", groups = { AddGroup.class, EditGroup.class })
private String teamName;
/**
*
/* */
/* @NotBlank(message = "班组负责人不能为空", groups = { AddGroup.class, EditGroup.class })*/
private String teamHead;
/**
* ID
*/
/* @NotNull(message = "班次ID不能为空", groups = { AddGroup.class, EditGroup.class })*/
private Long shiftId;
/**
* ID
*/
/* @NotNull(message = "工序ID不能为空", groups = { AddGroup.class, EditGroup.class })*/
private Long processId;
/**
* ID
*/
/* @NotNull(message = "工位ID不能为空", groups = { AddGroup.class, EditGroup.class })*/
private Long stationId;
/**
* ID
*/
/* @NotNull(message = "设备ID不能为空", groups = { AddGroup.class, EditGroup.class })*/
private Long deviceId;
/**
* 1 0
*/
/* @NotBlank(message = "激活标识1是 0否不能为空", groups = { AddGroup.class, EditGroup.class })*/
private String activeFlag;
}

@ -0,0 +1,78 @@
package org.dromara.mes.domain.bo;
import org.dromara.mes.domain.BaseShiftInfo;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
/**
* base_shift_info
*
* @author LionLi
* @date 2025-01-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = BaseShiftInfo.class, reverseConvertGenerate = false)
public class BaseShiftInfoBo extends BaseEntity {
/**
*
*/
/* @NotNull(message = "主键标识不能为空", groups = { AddGroup.class, EditGroup.class })*/
private Long shiftId;
/**
*
*/
@NotBlank(message = "班次编号不能为空", groups = { AddGroup.class, EditGroup.class })
private String shiftCode;
/**
*
*/
@NotBlank(message = "班次名称不能为空", groups = { AddGroup.class, EditGroup.class })
private String shiftName;
/**
*
*/
/* @NotBlank(message = "开始时间不能为空", groups = { AddGroup.class, EditGroup.class })*/
private String startTime;
/**
* 1 0
*/
/* @NotBlank(message = "开始跨天标识1是 0否不能为空", groups = { AddGroup.class, EditGroup.class })*/
private String startCrossFlag;
/**
*
*/
/* @NotBlank(message = "结束时间不能为空", groups = { AddGroup.class, EditGroup.class })*/
private String endTime;
/**
* 1 0
*/
/* @NotBlank(message = "结束跨天标识1是 0否不能为空", groups = { AddGroup.class, EditGroup.class })*/
private String endCrossFlag;
/**
*
*/
/* @NotNull(message = "标准工作时长(秒)不能为空", groups = { AddGroup.class, EditGroup.class })*/
private Long workHour;
/**
* 1 0
*/
/* @NotBlank(message = "激活标识1是 0否不能为空", groups = { AddGroup.class, EditGroup.class })*/
private String activeFlag;
}

@ -0,0 +1,138 @@
package org.dromara.mes.domain.vo;
import org.dromara.mes.domain.BaseClassTeamInfo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* base_class_team_info
*
* @author ZangCH
* @date 2025-01-06
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = BaseClassTeamInfo.class)
public class BaseClassTeamInfoVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@ExcelProperty(value = "主键标识")
private Long classTeamId;
/**
*
*/
@ExcelProperty(value = "租户编号")
private String tenantId;
/**
*
*/
@ExcelProperty(value = "班组编号")
private String teamCode;
/**
*
*/
@ExcelProperty(value = "班组名称")
private String teamName;
/**
*
*/
@ExcelProperty(value = "班组负责人")
private String teamHead;
/**
* ID
*/
@ExcelProperty(value = "班次ID")
private Long shiftId;
/**
* ID
*/
@ExcelProperty(value = "工序ID")
private Long processId;
/**
* ID
*/
@ExcelProperty(value = "工位ID")
private Long stationId;
/**
* ID
*/
@ExcelProperty(value = "设备ID")
private Long deviceId;
/**
* 1 0
*/
@ExcelProperty(value = "激活标识", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "active_flag")
private String activeFlag;
/**
*
*/
@ExcelProperty(value = "创建部门")
private Long createDept;
/**
*
*/
@ExcelProperty(value = "创建人")
private Long createBy;
/**
*
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
/**
*
*/
@ExcelProperty(value = "更新人")
private Long updateBy;
/**
*
*/
@ExcelProperty(value = "更新时间")
private Date updateTime;
/**
*
*/
@ExcelProperty(value = "班次名称")
private String shiftName;
/**
*
*/
@ExcelProperty(value = "工位名称")
private String stationName;
/**
*
*/
@ExcelProperty(value = "工序名称")
private String processName;
}

@ -0,0 +1,126 @@
package org.dromara.mes.domain.vo;
import org.dromara.mes.domain.BaseShiftInfo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* base_shift_info
*
* @author LionLi
* @date 2025-01-06
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = BaseShiftInfo.class)
public class BaseShiftInfoVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@ExcelProperty(value = "主键标识")
private Long shiftId;
/**
*
*/
@ExcelProperty(value = "租户编号")
private String tenantId;
/**
*
*/
@ExcelProperty(value = "班次编号")
private String shiftCode;
/**
*
*/
@ExcelProperty(value = "班次名称")
private String shiftName;
/**
*
*/
@ExcelProperty(value = "开始时间")
private String startTime;
/**
* 1 0
*/
@ExcelProperty(value = "开始跨天标识", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "mes_start_cross_flag")
private String startCrossFlag;
/**
*
*/
@ExcelProperty(value = "结束时间")
private String endTime;
/**
* 1 0
*/
@ExcelProperty(value = "结束跨天标识", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "mes_end_cross_flag")
private String endCrossFlag;
/**
*
*/
@ExcelProperty(value = "标准工作时长", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "秒=")
private Long workHour;
/**
* 1 0
*/
@ExcelProperty(value = "激活标识", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "active_flag")
private String activeFlag;
/**
*
*/
@ExcelProperty(value = "创建部门")
private Long createDept;
/**
*
*/
@ExcelProperty(value = "创建人")
private Long createBy;
/**
*
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
/**
*
*/
@ExcelProperty(value = "更新人")
private Long updateBy;
/**
*
*/
@ExcelProperty(value = "更新时间")
private Date updateTime;
}

@ -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…
Cancel
Save