update mes添加工装类型:关联物料、关联工序。
parent
6f7abed094
commit
27a4e46f31
@ -0,0 +1,116 @@
|
||||
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.BaseToolingTypeVo;
|
||||
import org.dromara.mes.domain.bo.BaseToolingTypeBo;
|
||||
import org.dromara.mes.service.IBaseToolingTypeService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 载具工装类型
|
||||
* 前端访问路由地址为:/mes/toolingType
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/toolingType")
|
||||
public class BaseToolingTypeController extends BaseController {
|
||||
|
||||
private final IBaseToolingTypeService baseToolingTypeService;
|
||||
|
||||
/**
|
||||
* 查询载具工装类型列表
|
||||
*/
|
||||
@SaCheckPermission("mes:toolingType:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<BaseToolingTypeVo> list(BaseToolingTypeBo bo, PageQuery pageQuery) {
|
||||
return baseToolingTypeService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出载具工装类型列表
|
||||
*/
|
||||
@SaCheckPermission("mes:toolingType:export")
|
||||
@Log(title = "载具工装类型", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(BaseToolingTypeBo bo, HttpServletResponse response) {
|
||||
List<BaseToolingTypeVo> list = baseToolingTypeService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "载具工装类型", BaseToolingTypeVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取载具工装类型详细信息
|
||||
*
|
||||
* @param toolingTypeId 主键
|
||||
*/
|
||||
@SaCheckPermission("mes:toolingType:query")
|
||||
@GetMapping("/{toolingTypeId}")
|
||||
public R<BaseToolingTypeVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long toolingTypeId) {
|
||||
return R.ok(baseToolingTypeService.queryById(toolingTypeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增载具工装类型
|
||||
*/
|
||||
@SaCheckPermission("mes:toolingType:add")
|
||||
@Log(title = "载具工装类型", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody BaseToolingTypeBo bo) {
|
||||
return toAjax(baseToolingTypeService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改载具工装类型
|
||||
*/
|
||||
@SaCheckPermission("mes:toolingType:edit")
|
||||
@Log(title = "载具工装类型", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BaseToolingTypeBo bo) {
|
||||
return toAjax(baseToolingTypeService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除载具工装类型
|
||||
*
|
||||
* @param toolingTypeIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("mes:toolingType:remove")
|
||||
@Log(title = "载具工装类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{toolingTypeIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] toolingTypeIds) {
|
||||
return toAjax(baseToolingTypeService.deleteWithValidByIds(List.of(toolingTypeIds), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下拉框查询载具工装类型列表
|
||||
*/
|
||||
@GetMapping("/getBaseToolingTypeList")
|
||||
public R<List<BaseToolingTypeVo>> getBaseToolingTypeList(BaseToolingTypeBo bo) {
|
||||
List<BaseToolingTypeVo> list = baseToolingTypeService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package org.dromara.mes.domain.bo;
|
||||
|
||||
import org.dromara.mes.domain.BaseToolingType;
|
||||
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.*;
|
||||
import org.dromara.mes.domain.BaseToolingTypeRelation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 载具工装类型业务对象 base_tooling_type
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = BaseToolingType.class, reverseConvertGenerate = false)
|
||||
public class BaseToolingTypeBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
private Long toolingTypeId;
|
||||
|
||||
/**
|
||||
* 工装类型编号
|
||||
*/
|
||||
@NotBlank(message = "工装类型编号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String toolingTypeCode;
|
||||
|
||||
/**
|
||||
* 工装类型名称
|
||||
*/
|
||||
@NotBlank(message = "工装类型名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String toolingTypeName;
|
||||
|
||||
/**
|
||||
* 工装类型规格
|
||||
*/
|
||||
private String toolingSpecCode;
|
||||
|
||||
/**
|
||||
* 标准使用次数/秒
|
||||
*/
|
||||
private Long standardLife;
|
||||
|
||||
/**
|
||||
* 标准重量(kg)
|
||||
*/
|
||||
private Long standardWeight;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private List<BaseToolingTypeRelation> typeRelationList;
|
||||
|
||||
private List<BaseToolingTypeRelation> processList;
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package org.dromara.mes.domain.bo;
|
||||
|
||||
import org.dromara.mes.domain.BaseToolingTypeRelation;
|
||||
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_tooling_type_relation
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = BaseToolingTypeRelation.class, reverseConvertGenerate = false)
|
||||
public class BaseToolingTypeRelationBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
private Long relationId;
|
||||
|
||||
/**
|
||||
* 工装类型ID
|
||||
*/
|
||||
@NotNull(message = "工装类型ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long toolingTypeId;
|
||||
|
||||
/**
|
||||
* 关联信息类型(1物料 2工序)
|
||||
*/
|
||||
@NotBlank(message = "关联信息类型不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String relationInfoType;
|
||||
|
||||
/**
|
||||
* 关联信息ID
|
||||
*/
|
||||
@NotNull(message = "关联信息ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long relationInfoId;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package org.dromara.mes.domain.vo;
|
||||
|
||||
import org.dromara.mes.domain.BaseToolingTypeRelation;
|
||||
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_tooling_type_relation
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = BaseToolingTypeRelation.class)
|
||||
public class BaseToolingTypeRelationVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
@ExcelProperty(value = "主键标识")
|
||||
private Long relationId;
|
||||
|
||||
/**
|
||||
* 工装类型ID
|
||||
*/
|
||||
@ExcelProperty(value = "工装类型ID")
|
||||
private Long toolingTypeId;
|
||||
|
||||
/**
|
||||
* 关联信息类型(1物料 2工序)
|
||||
*/
|
||||
@ExcelProperty(value = "关联信息类型(1物料 2工序)")
|
||||
private String relationInfoType;
|
||||
|
||||
/**
|
||||
* 关联信息ID
|
||||
*/
|
||||
@ExcelProperty(value = "关联信息ID")
|
||||
private Long relationInfoId;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package org.dromara.mes.domain.vo;
|
||||
|
||||
import org.dromara.mes.domain.BaseToolingType;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.mes.domain.BaseToolingTypeRelation;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 载具工装类型视图对象 base_tooling_type
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = BaseToolingType.class)
|
||||
public class BaseToolingTypeVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
@ExcelProperty(value = "主键标识")
|
||||
private Long toolingTypeId;
|
||||
|
||||
/**
|
||||
* 工装类型编号
|
||||
*/
|
||||
@ExcelProperty(value = "工装类型编号")
|
||||
private String toolingTypeCode;
|
||||
|
||||
/**
|
||||
* 工装类型名称
|
||||
*/
|
||||
@ExcelProperty(value = "工装类型名称")
|
||||
private String toolingTypeName;
|
||||
|
||||
/**
|
||||
* 工装类型规格
|
||||
*/
|
||||
@ExcelProperty(value = "工装类型规格")
|
||||
private String toolingSpecCode;
|
||||
|
||||
/**
|
||||
* 标准使用次数/秒
|
||||
*/
|
||||
@ExcelProperty(value = "标准使用次数/秒")
|
||||
private Long standardLife;
|
||||
|
||||
/**
|
||||
* 标准重量(kg)
|
||||
*/
|
||||
@ExcelProperty(value = "标准重量(kg)")
|
||||
private Long standardWeight;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
private List<BaseToolingTypeRelation> typeRelationList;
|
||||
|
||||
private List<BaseToolingTypeRelation> processList;
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.mes.mapper;
|
||||
|
||||
import org.dromara.mes.domain.BaseToolingType;
|
||||
import org.dromara.mes.domain.vo.BaseToolingTypeVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 载具工装类型Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
public interface BaseToolingTypeMapper extends BaseMapperPlus<BaseToolingType, BaseToolingTypeVo> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.mes.mapper;
|
||||
|
||||
import org.dromara.mes.domain.BaseToolingTypeRelation;
|
||||
import org.dromara.mes.domain.vo.BaseToolingTypeRelationVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 载具工装类型关联信息Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
public interface BaseToolingTypeRelationMapper extends BaseMapperPlus<BaseToolingTypeRelation, BaseToolingTypeRelationVo> {
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package org.dromara.mes.service;
|
||||
|
||||
import org.dromara.mes.domain.BaseToolingTypeRelation;
|
||||
import org.dromara.mes.domain.vo.BaseToolingTypeRelationVo;
|
||||
import org.dromara.mes.domain.bo.BaseToolingTypeRelationBo;
|
||||
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 Yinq
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
public interface IBaseToolingTypeRelationService {
|
||||
|
||||
/**
|
||||
* 查询载具工装类型关联信息
|
||||
*
|
||||
* @param relationId 主键
|
||||
* @return 载具工装类型关联信息
|
||||
*/
|
||||
BaseToolingTypeRelationVo queryById(Long relationId);
|
||||
|
||||
/**
|
||||
* 分页查询载具工装类型关联信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 载具工装类型关联信息分页列表
|
||||
*/
|
||||
TableDataInfo<BaseToolingTypeRelationVo> queryPageList(BaseToolingTypeRelationBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的载具工装类型关联信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 载具工装类型关联信息列表
|
||||
*/
|
||||
List<BaseToolingTypeRelationVo> queryList(BaseToolingTypeRelationBo bo);
|
||||
|
||||
/**
|
||||
* 新增载具工装类型关联信息
|
||||
*
|
||||
* @param bo 载具工装类型关联信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(BaseToolingTypeRelationBo bo);
|
||||
|
||||
/**
|
||||
* 修改载具工装类型关联信息
|
||||
*
|
||||
* @param bo 载具工装类型关联信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(BaseToolingTypeRelationBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除载具工装类型关联信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package org.dromara.mes.service;
|
||||
|
||||
import org.dromara.mes.domain.BaseToolingType;
|
||||
import org.dromara.mes.domain.vo.BaseToolingTypeVo;
|
||||
import org.dromara.mes.domain.bo.BaseToolingTypeBo;
|
||||
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 Yinq
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
public interface IBaseToolingTypeService {
|
||||
|
||||
/**
|
||||
* 查询载具工装类型
|
||||
*
|
||||
* @param toolingTypeId 主键
|
||||
* @return 载具工装类型
|
||||
*/
|
||||
BaseToolingTypeVo queryById(Long toolingTypeId);
|
||||
|
||||
/**
|
||||
* 分页查询载具工装类型列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 载具工装类型分页列表
|
||||
*/
|
||||
TableDataInfo<BaseToolingTypeVo> queryPageList(BaseToolingTypeBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的载具工装类型列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 载具工装类型列表
|
||||
*/
|
||||
List<BaseToolingTypeVo> queryList(BaseToolingTypeBo bo);
|
||||
|
||||
/**
|
||||
* 新增载具工装类型
|
||||
*
|
||||
* @param bo 载具工装类型
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(BaseToolingTypeBo bo);
|
||||
|
||||
/**
|
||||
* 修改载具工装类型
|
||||
*
|
||||
* @param bo 载具工装类型
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(BaseToolingTypeBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除载具工装类型信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
package org.dromara.mes.service.impl;
|
||||
|
||||
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.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.mes.domain.bo.BaseToolingTypeRelationBo;
|
||||
import org.dromara.mes.domain.vo.BaseToolingTypeRelationVo;
|
||||
import org.dromara.mes.domain.BaseToolingTypeRelation;
|
||||
import org.dromara.mes.mapper.BaseToolingTypeRelationMapper;
|
||||
import org.dromara.mes.service.IBaseToolingTypeRelationService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 载具工装类型关联信息Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class BaseToolingTypeRelationServiceImpl implements IBaseToolingTypeRelationService {
|
||||
|
||||
private final BaseToolingTypeRelationMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询载具工装类型关联信息
|
||||
*
|
||||
* @param relationId 主键
|
||||
* @return 载具工装类型关联信息
|
||||
*/
|
||||
@Override
|
||||
public BaseToolingTypeRelationVo queryById(Long relationId){
|
||||
return baseMapper.selectVoById(relationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询载具工装类型关联信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 载具工装类型关联信息分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<BaseToolingTypeRelationVo> queryPageList(BaseToolingTypeRelationBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<BaseToolingTypeRelation> lqw = buildQueryWrapper(bo);
|
||||
Page<BaseToolingTypeRelationVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的载具工装类型关联信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 载具工装类型关联信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<BaseToolingTypeRelationVo> queryList(BaseToolingTypeRelationBo bo) {
|
||||
MPJLambdaWrapper<BaseToolingTypeRelation> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<BaseToolingTypeRelation> buildQueryWrapper(BaseToolingTypeRelationBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<BaseToolingTypeRelation> lqw = JoinWrappers.lambda(BaseToolingTypeRelation.class)
|
||||
.selectAll(BaseToolingTypeRelation.class)
|
||||
.eq(bo.getRelationId() != null, BaseToolingTypeRelation::getRelationId, bo.getRelationId())
|
||||
.eq(bo.getToolingTypeId() != null, BaseToolingTypeRelation::getToolingTypeId, bo.getToolingTypeId())
|
||||
.eq(StringUtils.isNotBlank(bo.getRelationInfoType()), BaseToolingTypeRelation::getRelationInfoType, bo.getRelationInfoType())
|
||||
.eq(bo.getRelationInfoId() != null, BaseToolingTypeRelation::getRelationInfoId, bo.getRelationInfoId())
|
||||
.orderByAsc(BaseToolingTypeRelation::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增载具工装类型关联信息
|
||||
*
|
||||
* @param bo 载具工装类型关联信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(BaseToolingTypeRelationBo bo) {
|
||||
BaseToolingTypeRelation add = MapstructUtils.convert(bo, BaseToolingTypeRelation.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setRelationId(add.getRelationId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改载具工装类型关联信息
|
||||
*
|
||||
* @param bo 载具工装类型关联信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(BaseToolingTypeRelationBo bo) {
|
||||
BaseToolingTypeRelation update = MapstructUtils.convert(bo, BaseToolingTypeRelation.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(BaseToolingTypeRelation 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,237 @@
|
||||
package org.dromara.mes.service.impl;
|
||||
|
||||
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.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.mes.domain.BaseMaterialInfo;
|
||||
import org.dromara.mes.domain.BaseToolingTypeRelation;
|
||||
import org.dromara.mes.domain.ProdBaseRouteMaterial;
|
||||
import org.dromara.mes.mapper.BaseToolingTypeRelationMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.mes.domain.bo.BaseToolingTypeBo;
|
||||
import org.dromara.mes.domain.vo.BaseToolingTypeVo;
|
||||
import org.dromara.mes.domain.BaseToolingType;
|
||||
import org.dromara.mes.mapper.BaseToolingTypeMapper;
|
||||
import org.dromara.mes.service.IBaseToolingTypeService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 载具工装类型Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class BaseToolingTypeServiceImpl implements IBaseToolingTypeService {
|
||||
|
||||
private final BaseToolingTypeMapper baseMapper;
|
||||
|
||||
private final BaseToolingTypeRelationMapper relationMapper;
|
||||
|
||||
/**
|
||||
* 查询载具工装类型
|
||||
*
|
||||
* @param toolingTypeId 主键
|
||||
* @return 载具工装类型
|
||||
*/
|
||||
@Override
|
||||
public BaseToolingTypeVo queryById(Long toolingTypeId){
|
||||
BaseToolingTypeVo baseToolingTypeVo = baseMapper.selectVoById(toolingTypeId);
|
||||
// 关联物料
|
||||
MPJLambdaWrapper<BaseToolingTypeRelation> lqw = JoinWrappers.lambda(BaseToolingTypeRelation.class);
|
||||
lqw.selectAll(BaseToolingTypeRelation.class)
|
||||
.select(BaseMaterialInfo::getMaterialName)
|
||||
.leftJoin(BaseMaterialInfo.class, BaseMaterialInfo::getMaterialId, BaseToolingTypeRelation::getRelationInfoId)
|
||||
.eq(BaseToolingTypeRelation::getToolingTypeId, toolingTypeId)
|
||||
.eq(BaseToolingTypeRelation::getRelationInfoType, "1");
|
||||
List<BaseToolingTypeRelation> relationList = relationMapper.selectList(lqw);
|
||||
baseToolingTypeVo.setTypeRelationList(relationList);
|
||||
|
||||
// 关联工序
|
||||
MPJLambdaWrapper<BaseToolingTypeRelation> lqwProcess = JoinWrappers.lambda(BaseToolingTypeRelation.class);
|
||||
lqwProcess.selectAll(BaseToolingTypeRelation.class)
|
||||
.eq(BaseToolingTypeRelation::getToolingTypeId, toolingTypeId)
|
||||
.eq(BaseToolingTypeRelation::getRelationInfoType, "2");
|
||||
List<BaseToolingTypeRelation> relationProcessList = relationMapper.selectList(lqwProcess);
|
||||
System.out.println("工序查询SQL: " + lqwProcess.getSqlSegment());
|
||||
System.out.println("工序查询参数: " + lqwProcess.getParamNameValuePairs());
|
||||
baseToolingTypeVo.setProcessList(relationProcessList);
|
||||
return baseToolingTypeVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询载具工装类型列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 载具工装类型分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<BaseToolingTypeVo> queryPageList(BaseToolingTypeBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<BaseToolingType> lqw = buildQueryWrapper(bo);
|
||||
Page<BaseToolingTypeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的载具工装类型列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 载具工装类型列表
|
||||
*/
|
||||
@Override
|
||||
public List<BaseToolingTypeVo> queryList(BaseToolingTypeBo bo) {
|
||||
MPJLambdaWrapper<BaseToolingType> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<BaseToolingType> buildQueryWrapper(BaseToolingTypeBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<BaseToolingType> lqw = JoinWrappers.lambda(BaseToolingType.class)
|
||||
.selectAll(BaseToolingType.class)
|
||||
.eq(bo.getToolingTypeId() != null, BaseToolingType::getToolingTypeId, bo.getToolingTypeId())
|
||||
.eq(StringUtils.isNotBlank(bo.getToolingTypeCode()), BaseToolingType::getToolingTypeCode, bo.getToolingTypeCode())
|
||||
.like(StringUtils.isNotBlank(bo.getToolingTypeName()), BaseToolingType::getToolingTypeName, bo.getToolingTypeName())
|
||||
.eq(StringUtils.isNotBlank(bo.getToolingSpecCode()), BaseToolingType::getToolingSpecCode, bo.getToolingSpecCode())
|
||||
.eq(bo.getStandardLife() != null, BaseToolingType::getStandardLife, bo.getStandardLife())
|
||||
.eq(bo.getStandardWeight() != null, BaseToolingType::getStandardWeight, bo.getStandardWeight())
|
||||
.orderByAsc(BaseToolingType::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增载具工装类型
|
||||
*
|
||||
* @param bo 载具工装类型
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(BaseToolingTypeBo bo) {
|
||||
BaseToolingType add = MapstructUtils.convert(bo, BaseToolingType.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
assert add != null;
|
||||
bo.setToolingTypeId(add.getToolingTypeId());
|
||||
// 插入关联物料
|
||||
List<BaseToolingTypeRelation> typeRelationList = bo.getTypeRelationList();
|
||||
if (typeRelationList != null && !typeRelationList.isEmpty()) {
|
||||
for (BaseToolingTypeRelation typeRelation : typeRelationList) {
|
||||
typeRelation.setToolingTypeId(add.getToolingTypeId());
|
||||
relationMapper.insert(typeRelation);
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改载具工装类型
|
||||
*
|
||||
* @param bo 载具工装类型
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(BaseToolingTypeBo bo) {
|
||||
BaseToolingType update = MapstructUtils.convert(bo, BaseToolingType.class);
|
||||
validEntityBeforeSave(update);
|
||||
// 更新工艺路线关联物料
|
||||
List<BaseToolingTypeRelation> typeRelationList = bo.getTypeRelationList();
|
||||
MPJLambdaWrapper<BaseToolingTypeRelation> lqwMaterial = JoinWrappers.lambda(BaseToolingTypeRelation.class);
|
||||
lqwMaterial.eq(BaseToolingTypeRelation::getToolingTypeId, bo.getToolingTypeId())
|
||||
.eq(BaseToolingTypeRelation::getRelationInfoType, "1");
|
||||
List<BaseToolingTypeRelation> dbTypeRelationList = relationMapper.selectList(lqwMaterial);
|
||||
if (typeRelationList != null && !typeRelationList.isEmpty()) {
|
||||
for (BaseToolingTypeRelation typeRelation : typeRelationList) {
|
||||
typeRelation.setToolingTypeId(bo.getToolingTypeId());
|
||||
if (typeRelation.getRelationId() == null) {
|
||||
relationMapper.insert(typeRelation);
|
||||
} else {
|
||||
relationMapper.updateById(typeRelation);
|
||||
}
|
||||
}
|
||||
Set<Long> existingIds = typeRelationList.stream()
|
||||
.filter(m -> m.getRelationId() != null)
|
||||
.map(BaseToolingTypeRelation::getRelationId)
|
||||
.collect(Collectors.toSet());
|
||||
List<BaseToolingTypeRelation> filteredIds = dbTypeRelationList.stream()
|
||||
.filter(field -> !existingIds.contains(field.getRelationId()))
|
||||
.toList();
|
||||
for (BaseToolingTypeRelation typeRelation : filteredIds) {
|
||||
relationMapper.deleteById(typeRelation.getRelationId());
|
||||
}
|
||||
} else if (dbTypeRelationList != null && !dbTypeRelationList.isEmpty()) {
|
||||
// 如果前端传空,全部删除
|
||||
for (BaseToolingTypeRelation typeRelation : dbTypeRelationList) {
|
||||
relationMapper.deleteById(typeRelation.getRelationId());
|
||||
}
|
||||
}
|
||||
|
||||
// 更新关联工序
|
||||
List<BaseToolingTypeRelation> typeProessList = bo.getProcessList();
|
||||
MPJLambdaWrapper<BaseToolingTypeRelation> lqwMaterialProess = JoinWrappers.lambda(BaseToolingTypeRelation.class);
|
||||
lqwMaterialProess.eq(BaseToolingTypeRelation::getToolingTypeId, bo.getToolingTypeId())
|
||||
.eq(BaseToolingTypeRelation::getRelationInfoType, "2");
|
||||
List<BaseToolingTypeRelation> dbTypeProessList = relationMapper.selectList(lqwMaterialProess);
|
||||
if (typeProessList != null && !typeProessList.isEmpty()) {
|
||||
for (BaseToolingTypeRelation typeRelation : typeProessList) {
|
||||
typeRelation.setToolingTypeId(bo.getToolingTypeId());
|
||||
if (typeRelation.getRelationId() == null) {
|
||||
relationMapper.insert(typeRelation);
|
||||
} else {
|
||||
relationMapper.updateById(typeRelation);
|
||||
}
|
||||
}
|
||||
Set<Long> existingIds = typeProessList.stream()
|
||||
.filter(m -> m.getRelationId() != null)
|
||||
.map(BaseToolingTypeRelation::getRelationId)
|
||||
.collect(Collectors.toSet());
|
||||
List<BaseToolingTypeRelation> filteredIds = dbTypeProessList.stream()
|
||||
.filter(field -> !existingIds.contains(field.getRelationId()))
|
||||
.toList();
|
||||
for (BaseToolingTypeRelation typeRelation : filteredIds) {
|
||||
relationMapper.deleteById(typeRelation.getRelationId());
|
||||
}
|
||||
} else if (dbTypeProessList != null && !dbTypeProessList.isEmpty()) {
|
||||
// 如果前端传空,全部删除
|
||||
for (BaseToolingTypeRelation typeRelation : dbTypeProessList) {
|
||||
relationMapper.deleteById(typeRelation.getRelationId());
|
||||
}
|
||||
}
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(BaseToolingType 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.BaseToolingTypeMapper">
|
||||
|
||||
</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.BaseToolingTypeRelationMapper">
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue