update 添加工序工艺信息
parent
cf972cef0c
commit
5d22a31579
@ -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.ProdTechnologyInfoVo;
|
||||
import org.dromara.mes.domain.bo.ProdTechnologyInfoBo;
|
||||
import org.dromara.mes.service.IProdTechnologyInfoService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 工序工艺信息
|
||||
* 前端访问路由地址为:/mes/technologyInfo
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-21
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/technologyInfo")
|
||||
public class ProdTechnologyInfoController extends BaseController {
|
||||
|
||||
private final IProdTechnologyInfoService prodTechnologyInfoService;
|
||||
|
||||
/**
|
||||
* 查询工序工艺信息列表
|
||||
*/
|
||||
@SaCheckPermission("mes:technologyInfo:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ProdTechnologyInfoVo> list(ProdTechnologyInfoBo bo, PageQuery pageQuery) {
|
||||
return prodTechnologyInfoService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出工序工艺信息列表
|
||||
*/
|
||||
@SaCheckPermission("mes:technologyInfo:export")
|
||||
@Log(title = "工序工艺信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(ProdTechnologyInfoBo bo, HttpServletResponse response) {
|
||||
List<ProdTechnologyInfoVo> list = prodTechnologyInfoService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "工序工艺信息", ProdTechnologyInfoVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工序工艺信息详细信息
|
||||
*
|
||||
* @param technologyId 主键
|
||||
*/
|
||||
@SaCheckPermission("mes:technologyInfo:query")
|
||||
@GetMapping("/{technologyId}")
|
||||
public R<ProdTechnologyInfoVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long technologyId) {
|
||||
return R.ok(prodTechnologyInfoService.queryById(technologyId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工序工艺信息
|
||||
*/
|
||||
@SaCheckPermission("mes:technologyInfo:add")
|
||||
@Log(title = "工序工艺信息", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ProdTechnologyInfoBo bo) {
|
||||
return toAjax(prodTechnologyInfoService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工序工艺信息
|
||||
*/
|
||||
@SaCheckPermission("mes:technologyInfo:edit")
|
||||
@Log(title = "工序工艺信息", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ProdTechnologyInfoBo bo) {
|
||||
return toAjax(prodTechnologyInfoService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工序工艺信息
|
||||
*
|
||||
* @param technologyIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("mes:technologyInfo:remove")
|
||||
@Log(title = "工序工艺信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{technologyIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] technologyIds) {
|
||||
return toAjax(prodTechnologyInfoService.deleteWithValidByIds(List.of(technologyIds), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下拉框查询工序工艺信息列表
|
||||
*/
|
||||
|
||||
@GetMapping("getProdTechnologyInfoList")
|
||||
public R<List<ProdTechnologyInfoVo>> getProdTechnologyInfolist(ProdTechnologyInfoBo bo) {
|
||||
List<ProdTechnologyInfoVo> list = prodTechnologyInfoService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
@ -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.ProdTechnologyStepInfoVo;
|
||||
import org.dromara.mes.domain.bo.ProdTechnologyStepInfoBo;
|
||||
import org.dromara.mes.service.IProdTechnologyStepInfoService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 工艺步序信息
|
||||
* 前端访问路由地址为:/mes/technologyStepInfo
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-21
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/technologyStepInfo")
|
||||
public class ProdTechnologyStepInfoController extends BaseController {
|
||||
|
||||
private final IProdTechnologyStepInfoService prodTechnologyStepInfoService;
|
||||
|
||||
/**
|
||||
* 查询工艺步序信息列表
|
||||
*/
|
||||
@SaCheckPermission("mes:technologyStepInfo:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ProdTechnologyStepInfoVo> list(ProdTechnologyStepInfoBo bo, PageQuery pageQuery) {
|
||||
return prodTechnologyStepInfoService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出工艺步序信息列表
|
||||
*/
|
||||
@SaCheckPermission("mes:technologyStepInfo:export")
|
||||
@Log(title = "工艺步序信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(ProdTechnologyStepInfoBo bo, HttpServletResponse response) {
|
||||
List<ProdTechnologyStepInfoVo> list = prodTechnologyStepInfoService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "工艺步序信息", ProdTechnologyStepInfoVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工艺步序信息详细信息
|
||||
*
|
||||
* @param stepId 主键
|
||||
*/
|
||||
@SaCheckPermission("mes:technologyStepInfo:query")
|
||||
@GetMapping("/{stepId}")
|
||||
public R<ProdTechnologyStepInfoVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long stepId) {
|
||||
return R.ok(prodTechnologyStepInfoService.queryById(stepId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工艺步序信息
|
||||
*/
|
||||
@SaCheckPermission("mes:technologyStepInfo:add")
|
||||
@Log(title = "工艺步序信息", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ProdTechnologyStepInfoBo bo) {
|
||||
return toAjax(prodTechnologyStepInfoService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工艺步序信息
|
||||
*/
|
||||
@SaCheckPermission("mes:technologyStepInfo:edit")
|
||||
@Log(title = "工艺步序信息", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ProdTechnologyStepInfoBo bo) {
|
||||
return toAjax(prodTechnologyStepInfoService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工艺步序信息
|
||||
*
|
||||
* @param stepIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("mes:technologyStepInfo:remove")
|
||||
@Log(title = "工艺步序信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{stepIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] stepIds) {
|
||||
return toAjax(prodTechnologyStepInfoService.deleteWithValidByIds(List.of(stepIds), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下拉框查询工艺步序信息列表
|
||||
*/
|
||||
|
||||
@GetMapping("getProdTechnologyStepInfoList")
|
||||
public R<List<ProdTechnologyStepInfoVo>> getProdTechnologyStepInfolist(ProdTechnologyStepInfoBo bo) {
|
||||
List<ProdTechnologyStepInfoVo> list = prodTechnologyStepInfoService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.mes.mapper;
|
||||
|
||||
import org.dromara.mes.domain.ProdTechnologyInfo;
|
||||
import org.dromara.mes.domain.vo.ProdTechnologyInfoVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 工序工艺信息Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-21
|
||||
*/
|
||||
public interface ProdTechnologyInfoMapper extends BaseMapperPlus<ProdTechnologyInfo, ProdTechnologyInfoVo> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.mes.mapper;
|
||||
|
||||
import org.dromara.mes.domain.ProdTechnologyStepInfo;
|
||||
import org.dromara.mes.domain.vo.ProdTechnologyStepInfoVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 工艺步序信息Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-21
|
||||
*/
|
||||
public interface ProdTechnologyStepInfoMapper extends BaseMapperPlus<ProdTechnologyStepInfo, ProdTechnologyStepInfoVo> {
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package org.dromara.mes.service;
|
||||
|
||||
import org.dromara.mes.domain.ProdTechnologyInfo;
|
||||
import org.dromara.mes.domain.vo.ProdTechnologyInfoVo;
|
||||
import org.dromara.mes.domain.bo.ProdTechnologyInfoBo;
|
||||
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-01-21
|
||||
*/
|
||||
public interface IProdTechnologyInfoService {
|
||||
|
||||
/**
|
||||
* 查询工序工艺信息
|
||||
*
|
||||
* @param technologyId 主键
|
||||
* @return 工序工艺信息
|
||||
*/
|
||||
ProdTechnologyInfoVo queryById(Long technologyId);
|
||||
|
||||
/**
|
||||
* 分页查询工序工艺信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 工序工艺信息分页列表
|
||||
*/
|
||||
TableDataInfo<ProdTechnologyInfoVo> queryPageList(ProdTechnologyInfoBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的工序工艺信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 工序工艺信息列表
|
||||
*/
|
||||
List<ProdTechnologyInfoVo> queryList(ProdTechnologyInfoBo bo);
|
||||
|
||||
/**
|
||||
* 新增工序工艺信息
|
||||
*
|
||||
* @param bo 工序工艺信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(ProdTechnologyInfoBo bo);
|
||||
|
||||
/**
|
||||
* 修改工序工艺信息
|
||||
*
|
||||
* @param bo 工序工艺信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(ProdTechnologyInfoBo 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.ProdTechnologyStepInfo;
|
||||
import org.dromara.mes.domain.vo.ProdTechnologyStepInfoVo;
|
||||
import org.dromara.mes.domain.bo.ProdTechnologyStepInfoBo;
|
||||
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-01-21
|
||||
*/
|
||||
public interface IProdTechnologyStepInfoService {
|
||||
|
||||
/**
|
||||
* 查询工艺步序信息
|
||||
*
|
||||
* @param stepId 主键
|
||||
* @return 工艺步序信息
|
||||
*/
|
||||
ProdTechnologyStepInfoVo queryById(Long stepId);
|
||||
|
||||
/**
|
||||
* 分页查询工艺步序信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 工艺步序信息分页列表
|
||||
*/
|
||||
TableDataInfo<ProdTechnologyStepInfoVo> queryPageList(ProdTechnologyStepInfoBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的工艺步序信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 工艺步序信息列表
|
||||
*/
|
||||
List<ProdTechnologyStepInfoVo> queryList(ProdTechnologyStepInfoBo bo);
|
||||
|
||||
/**
|
||||
* 新增工艺步序信息
|
||||
*
|
||||
* @param bo 工艺步序信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(ProdTechnologyStepInfoBo bo);
|
||||
|
||||
/**
|
||||
* 修改工艺步序信息
|
||||
*
|
||||
* @param bo 工艺步序信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(ProdTechnologyStepInfoBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除工艺步序信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,149 @@
|
||||
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.ProdBaseProcessInfo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.mes.domain.bo.ProdTechnologyInfoBo;
|
||||
import org.dromara.mes.domain.vo.ProdTechnologyInfoVo;
|
||||
import org.dromara.mes.domain.ProdTechnologyInfo;
|
||||
import org.dromara.mes.mapper.ProdTechnologyInfoMapper;
|
||||
import org.dromara.mes.service.IProdTechnologyInfoService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 工序工艺信息Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-21
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class ProdTechnologyInfoServiceImpl implements IProdTechnologyInfoService {
|
||||
|
||||
private final ProdTechnologyInfoMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询工序工艺信息
|
||||
*
|
||||
* @param technologyId 主键
|
||||
* @return 工序工艺信息
|
||||
*/
|
||||
@Override
|
||||
public ProdTechnologyInfoVo queryById(Long technologyId) {
|
||||
ProdTechnologyInfoBo bo = new ProdTechnologyInfoBo();
|
||||
bo.setTechnologyId(technologyId);
|
||||
MPJLambdaWrapper<ProdTechnologyInfo> lqw = buildQueryWrapper(bo);
|
||||
List<ProdTechnologyInfoVo> voList = baseMapper.selectVoList(lqw);
|
||||
return voList.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询工序工艺信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 工序工艺信息分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<ProdTechnologyInfoVo> queryPageList(ProdTechnologyInfoBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<ProdTechnologyInfo> lqw = buildQueryWrapper(bo);
|
||||
Page<ProdTechnologyInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的工序工艺信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 工序工艺信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<ProdTechnologyInfoVo> queryList(ProdTechnologyInfoBo bo) {
|
||||
MPJLambdaWrapper<ProdTechnologyInfo> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<ProdTechnologyInfo> buildQueryWrapper(ProdTechnologyInfoBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<ProdTechnologyInfo> lqw = JoinWrappers.lambda(ProdTechnologyInfo.class)
|
||||
.selectAll(ProdTechnologyInfo.class)
|
||||
.select(ProdBaseProcessInfo::getProcessName)
|
||||
.select(BaseMaterialInfo::getMaterialName)
|
||||
.leftJoin(ProdBaseProcessInfo.class, ProdBaseProcessInfo::getProcessId, ProdTechnologyInfo::getProcessId)
|
||||
.leftJoin(BaseMaterialInfo.class, BaseMaterialInfo::getMaterialId, ProdTechnologyInfo::getMaterialId)
|
||||
.eq(bo.getTechnologyId() != null, ProdTechnologyInfo::getTechnologyId, bo.getTechnologyId())
|
||||
.eq(bo.getProcessId() != null, ProdTechnologyInfo::getProcessId, bo.getProcessId())
|
||||
.eq(bo.getMaterialId() != null, ProdTechnologyInfo::getMaterialId, bo.getMaterialId())
|
||||
.eq(StringUtils.isNotBlank(bo.getMachineType()), ProdTechnologyInfo::getMachineType, bo.getMachineType())
|
||||
.eq(StringUtils.isNotBlank(bo.getTechnologyType()), ProdTechnologyInfo::getTechnologyType, bo.getTechnologyType())
|
||||
.eq(StringUtils.isNotBlank(bo.getTechnologyVersion()), ProdTechnologyInfo::getTechnologyVersion, bo.getTechnologyVersion())
|
||||
.eq(bo.getStandardTime() != null, ProdTechnologyInfo::getStandardTime, bo.getStandardTime())
|
||||
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), ProdTechnologyInfo::getActiveFlag, bo.getActiveFlag())
|
||||
.orderByDesc(ProdTechnologyInfo::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工序工艺信息
|
||||
*
|
||||
* @param bo 工序工艺信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(ProdTechnologyInfoBo bo) {
|
||||
ProdTechnologyInfo add = MapstructUtils.convert(bo, ProdTechnologyInfo.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setTechnologyId(add.getTechnologyId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工序工艺信息
|
||||
*
|
||||
* @param bo 工序工艺信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(ProdTechnologyInfoBo bo) {
|
||||
ProdTechnologyInfo update = MapstructUtils.convert(bo, ProdTechnologyInfo.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(ProdTechnologyInfo 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,139 @@
|
||||
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.ProdTechnologyStepInfoBo;
|
||||
import org.dromara.mes.domain.vo.ProdTechnologyStepInfoVo;
|
||||
import org.dromara.mes.domain.ProdTechnologyStepInfo;
|
||||
import org.dromara.mes.mapper.ProdTechnologyStepInfoMapper;
|
||||
import org.dromara.mes.service.IProdTechnologyStepInfoService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 工艺步序信息Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-21
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class ProdTechnologyStepInfoServiceImpl implements IProdTechnologyStepInfoService {
|
||||
|
||||
private final ProdTechnologyStepInfoMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询工艺步序信息
|
||||
*
|
||||
* @param stepId 主键
|
||||
* @return 工艺步序信息
|
||||
*/
|
||||
@Override
|
||||
public ProdTechnologyStepInfoVo queryById(Long stepId){
|
||||
return baseMapper.selectVoById(stepId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询工艺步序信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 工艺步序信息分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<ProdTechnologyStepInfoVo> queryPageList(ProdTechnologyStepInfoBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<ProdTechnologyStepInfo> lqw = buildQueryWrapper(bo);
|
||||
Page<ProdTechnologyStepInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的工艺步序信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 工艺步序信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<ProdTechnologyStepInfoVo> queryList(ProdTechnologyStepInfoBo bo) {
|
||||
MPJLambdaWrapper<ProdTechnologyStepInfo> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<ProdTechnologyStepInfo> buildQueryWrapper(ProdTechnologyStepInfoBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<ProdTechnologyStepInfo> lqw = JoinWrappers.lambda(ProdTechnologyStepInfo.class)
|
||||
.selectAll(ProdTechnologyStepInfo.class)
|
||||
.eq(bo.getStepId() != null, ProdTechnologyStepInfo::getStepId, bo.getStepId())
|
||||
.eq(bo.getTechnologyId() != null, ProdTechnologyStepInfo::getTechnologyId, bo.getTechnologyId())
|
||||
.eq(bo.getStepCode() != null, ProdTechnologyStepInfo::getStepCode, bo.getStepCode())
|
||||
.like(StringUtils.isNotBlank(bo.getStepName()), ProdTechnologyStepInfo::getStepName, bo.getStepName())
|
||||
.eq(bo.getStepTime() != null, ProdTechnologyStepInfo::getStepTime, bo.getStepTime())
|
||||
.eq(StringUtils.isNotBlank(bo.getStepParameter()), ProdTechnologyStepInfo::getStepParameter, bo.getStepParameter())
|
||||
.eq(StringUtils.isNotBlank(bo.getValueState()), ProdTechnologyStepInfo::getValueState, bo.getValueState())
|
||||
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), ProdTechnologyStepInfo::getActiveFlag, bo.getActiveFlag())
|
||||
.orderByDesc(ProdTechnologyStepInfo::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工艺步序信息
|
||||
*
|
||||
* @param bo 工艺步序信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(ProdTechnologyStepInfoBo bo) {
|
||||
ProdTechnologyStepInfo add = MapstructUtils.convert(bo, ProdTechnologyStepInfo.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setStepId(add.getStepId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工艺步序信息
|
||||
*
|
||||
* @param bo 工艺步序信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(ProdTechnologyStepInfoBo bo) {
|
||||
ProdTechnologyStepInfo update = MapstructUtils.convert(bo, ProdTechnologyStepInfo.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(ProdTechnologyStepInfo 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.ProdTechnologyInfoMapper">
|
||||
|
||||
</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.ProdTechnologyStepInfoMapper">
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue