add(hwmom-mes): 工序信息关联用户和产线功能

- 新增工序信息关联用户和产线的接口和实现
- 在工序信息中添加关联用户和产线的列表字段
- 实现工序信息关联用户和产线的增删改查功能
- 优化工序信息查询接口,支持查询关联的用户和产线信息
master
zch 3 months ago
parent 1b6bb08d91
commit f0013b7c6e

@ -95,11 +95,22 @@ public class ProdBaseProcessInfoController extends BaseController {
@SaCheckPermission("mes:baseProcessInfo:edit")
@Log(title = "工序信息", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
@PutMapping("/edit")
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ProdBaseProcessInfoBo bo) {
return toAjax(prodBaseProcessInfoService.updateByBo(bo));
}
/**
*
*/
@SaCheckPermission("mes:baseProcessInfo:edit")
@Log(title = "工序信息", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping("/editUser")
public R<Void> editUser(@Validated(EditGroup.class) @RequestBody ProdBaseProcessInfoBo bo) {
return toAjax(prodBaseProcessInfoService.updateByBoUser(bo));
}
/**
*
*

@ -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.ProdBaseProcessProdLineVo;
import org.dromara.mes.domain.bo.ProdBaseProcessProdLineBo;
import org.dromara.mes.service.IProdBaseProcessProdLineService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
* 线
* 访:/mes/prodBaseProcessProdLine
*
* @author LionLi
* @date 2025-01-09
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/prodBaseProcessProdLine")
public class ProdBaseProcessProdLineController extends BaseController {
private final IProdBaseProcessProdLineService prodBaseProcessProdLineService;
/**
* 线
*/
@SaCheckPermission("mes:prodBaseProcessProdLine:list")
@GetMapping("/list")
public TableDataInfo<ProdBaseProcessProdLineVo> list(ProdBaseProcessProdLineBo bo, PageQuery pageQuery) {
return prodBaseProcessProdLineService.queryPageList(bo, pageQuery);
}
/**
* 线
*/
@SaCheckPermission("mes:prodBaseProcessProdLine:export")
@Log(title = "工序关联产线", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(ProdBaseProcessProdLineBo bo, HttpServletResponse response) {
List<ProdBaseProcessProdLineVo> list = prodBaseProcessProdLineService.queryList(bo);
ExcelUtil.exportExcel(list, "工序关联产线", ProdBaseProcessProdLineVo.class, response);
}
/**
* 线
*
* @param processId
*/
@SaCheckPermission("mes:prodBaseProcessProdLine:query")
@GetMapping("/{processId}")
public R<ProdBaseProcessProdLineVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long processId) {
return R.ok(prodBaseProcessProdLineService.queryById(processId));
}
/**
* 线
*/
@SaCheckPermission("mes:prodBaseProcessProdLine:add")
@Log(title = "工序关联产线", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody ProdBaseProcessProdLineBo bo) {
return toAjax(prodBaseProcessProdLineService.insertByBo(bo));
}
/**
* 线
*/
@SaCheckPermission("mes:prodBaseProcessProdLine:edit")
@Log(title = "工序关联产线", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ProdBaseProcessProdLineBo bo) {
return toAjax(prodBaseProcessProdLineService.updateByBo(bo));
}
/**
* 线
*
* @param processIds
*/
@SaCheckPermission("mes:prodBaseProcessProdLine:remove")
@Log(title = "工序关联产线", businessType = BusinessType.DELETE)
@DeleteMapping("/{processIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] processIds) {
return toAjax(prodBaseProcessProdLineService.deleteWithValidByIds(List.of(processIds), true));
}
/**
* 线
*/
@GetMapping("getProdBaseProcessProdLineList")
public R<List<ProdBaseProcessProdLineVo>> getProdBaseProcessProdLinelist(ProdBaseProcessProdLineBo bo) {
List<ProdBaseProcessProdLineVo> list = prodBaseProcessProdLineService.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.ProdBaseProcessUserVo;
import org.dromara.mes.domain.bo.ProdBaseProcessUserBo;
import org.dromara.mes.service.IProdBaseProcessUserService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
*
* 访:/mes/prodBaseProcessUser
*
* @author zangch
* @date 2025-01-09
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/prodBaseProcessUser")
public class ProdBaseProcessUserController extends BaseController {
private final IProdBaseProcessUserService prodBaseProcessUserService;
/**
*
*/
@SaCheckPermission("mes:prodBaseProcessUser:list")
@GetMapping("/list")
public TableDataInfo<ProdBaseProcessUserVo> list(ProdBaseProcessUserBo bo, PageQuery pageQuery) {
return prodBaseProcessUserService.queryPageList(bo, pageQuery);
}
/**
*
*/
@SaCheckPermission("mes:prodBaseProcessUser:export")
@Log(title = "工序关联人员", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(ProdBaseProcessUserBo bo, HttpServletResponse response) {
List<ProdBaseProcessUserVo> list = prodBaseProcessUserService.queryList(bo);
ExcelUtil.exportExcel(list, "工序关联人员", ProdBaseProcessUserVo.class, response);
}
/**
*
*
* @param processId
*/
@SaCheckPermission("mes:prodBaseProcessUser:query")
@GetMapping("/{processId}")
public R<ProdBaseProcessUserVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long processId) {
return R.ok(prodBaseProcessUserService.queryById(processId));
}
/**
*
*/
@SaCheckPermission("mes:prodBaseProcessUser:add")
@Log(title = "工序关联人员", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody ProdBaseProcessUserBo bo) {
return toAjax(prodBaseProcessUserService.insertByBo(bo));
}
/**
*
*/
@SaCheckPermission("mes:prodBaseProcessUser:edit")
@Log(title = "工序关联人员", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ProdBaseProcessUserBo bo) {
return toAjax(prodBaseProcessUserService.updateByBo(bo));
}
/**
*
*
* @param processIds
*/
@SaCheckPermission("mes:prodBaseProcessUser:remove")
@Log(title = "工序关联人员", businessType = BusinessType.DELETE)
@DeleteMapping("/{processIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] processIds) {
return toAjax(prodBaseProcessUserService.deleteWithValidByIds(List.of(processIds), true));
}
/**
*
*/
@GetMapping("getProdBaseProcessUserList")
public R<List<ProdBaseProcessUserVo>> getProdBaseProcessUserlist(ProdBaseProcessUserBo bo) {
List<ProdBaseProcessUserVo> list = prodBaseProcessUserService.queryList(bo);
return R.ok(list);
}
}

@ -6,6 +6,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
import java.util.List;
/**
* prod_base_process_info
@ -62,5 +63,18 @@ public class ProdBaseProcessInfo extends TenantEntity {
*/
private String remark;
/**
* 线
*/
@TableField(exist = false)
private List<ProdBaseProcessProdLine> prodBaseProcessProdlineList;//工序关联产线信息,映射字段
/** 工序关联人员信息 */
@TableField(exist = false)
private List<ProdBaseProcessUser> prodBaseProcessUserList;//工序关联人员信息,映射字段
@TableField(exist = false)
private String processPercentage;//映射字段
}

@ -0,0 +1,69 @@
package org.dromara.mes.domain;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 线 prod_base_process_prod_line
*
* @author LionLi
* @date 2025-01-09
*/
@Data
@EqualsAndHashCode()
@TableName("prod_base_process_prod_line")
public class ProdBaseProcessProdLine {
@Serial
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Long processId;
/**
* 线ID
*/
private Long prodLineId;
/*删除继承BaseEntity*/
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@TableField(exist = false)
private Map<String, Object> params = new HashMap<>();
/**
*
*/
@TableField(fill = FieldFill.INSERT)
private Long createDept;
/**
*
*/
@TableField(fill = FieldFill.INSERT)
private Long createBy;
/**
*
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
*
*/
private String tenantId;
}

@ -0,0 +1,73 @@
package org.dromara.mes.domain;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* prod_base_process_user
*
* @author zangch
* @date 2025-01-09
*/
@Data
@EqualsAndHashCode()
@TableName("prod_base_process_user")
public class ProdBaseProcessUser {
@Serial
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Long processId;
/**
* ID
*/
private Long userId;
/**
*
*/
private String userName;
/*删除继承BaseEntity*/
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@TableField(exist = false)
private Map<String, Object> params = new HashMap<>();
/**
*
*/
@TableField(fill = FieldFill.INSERT)
private Long createDept;
/**
*
*/
@TableField(fill = FieldFill.INSERT)
private Long createBy;
/**
*
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
*
*/
private String tenantId;
}

@ -1,5 +1,6 @@
package org.dromara.mes.domain.bo;
import com.baomidou.mybatisplus.annotation.TableField;
import org.dromara.mes.domain.ProdBaseProcessInfo;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
@ -8,6 +9,10 @@ import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import org.dromara.mes.domain.ProdBaseProcessProdLine;
import org.dromara.mes.domain.ProdBaseProcessUser;
import java.util.List;
/**
* prod_base_process_info
@ -65,4 +70,14 @@ public class ProdBaseProcessInfoBo extends BaseEntity {
private String remark;
/**
* 线
*/
private List<ProdBaseProcessProdLineBo> prodBaseProcessProdlineBoList;//工序关联产线信息,映射字段
/** 工序关联人员信息 */
private List<ProdBaseProcessUserBo> prodBaseProcessUserBoList;//工序关联人员信息,映射字段
private String processPercentageBo;//映射字段
}

@ -0,0 +1,83 @@
package org.dromara.mes.domain.bo;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.dromara.mes.domain.ProdBaseProcessProdLine;
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 java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 线 prod_base_process_prod_line
*
* @author LionLi
* @date 2025-01-09
*/
@Data
@EqualsAndHashCode()
@AutoMapper(target = ProdBaseProcessProdLine.class, reverseConvertGenerate = false)
public class ProdBaseProcessProdLineBo {
/**
* ID
*/
@NotNull(message = "工序ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long processId;
/**
* 线ID
*/
@NotNull(message = "所属产线ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long prodLineId;
/**
*
*/
@JsonIgnore
@TableField(exist = false)
private String searchValue;
/**
*
*/
@TableField(fill = FieldFill.INSERT)
private Long createDept;
/**
*
*/
@TableField(fill = FieldFill.INSERT)
private Long createBy;
/**
*
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@TableField(exist = false)
private Map<String, Object> params = new HashMap<>();
/**
*
*/
@TableField(exist = false)
private String tenantId;
}

@ -0,0 +1,81 @@
package org.dromara.mes.domain.bo;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.dromara.mes.domain.ProdBaseProcessUser;
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 java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* prod_base_process_user
*
* @author zangch
* @date 2025-01-09
*/
@Data
@EqualsAndHashCode()
@AutoMapper(target = ProdBaseProcessUser.class, reverseConvertGenerate = false)
public class ProdBaseProcessUserBo {
/**
* ID
*/
@NotNull(message = "工序ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long processId;
/**
* ID
*/
@NotNull(message = "用户ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long userId;
/**
*
*/
private String userName;
/**
*
*/
@JsonIgnore
@TableField(exist = false)
private String searchValue;
/**
*
*/
@TableField(fill = FieldFill.INSERT)
private Long createDept;
/**
*
*/
@TableField(fill = FieldFill.INSERT)
private Long createBy;
/**
*
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@TableField(exist = false)
private Map<String, Object> params = new HashMap<>();
}

@ -1,5 +1,6 @@
package org.dromara.mes.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import org.dromara.mes.domain.ProdBaseProcessInfo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
@ -7,11 +8,13 @@ import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.mes.domain.ProdBaseProcessProdLine;
import org.dromara.mes.domain.ProdBaseProcessUser;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -115,5 +118,17 @@ public class ProdBaseProcessInfoVo implements Serializable {
@ExcelProperty(value = "更新时间")
private Date updateTime;
/**
* 线
*/
private List<ProdBaseProcessProdLineVo> prodBaseProcessProdlineVoList;//工序关联产线信息,映射字段
/** 工序关联人员信息 */
private List<ProdBaseProcessUserVo> prodBaseProcessUserVoList;//工序关联人员信息,映射字段
private String processPercentageVo;//映射字段
}

@ -0,0 +1,62 @@
package org.dromara.mes.domain.vo;
import org.dromara.mes.domain.ProdBaseProcessProdLine;
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;
/**
* 线 prod_base_process_prod_line
*
* @author LionLi
* @date 2025-01-09
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = ProdBaseProcessProdLine.class)
public class ProdBaseProcessProdLineVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* ID
*/
@ExcelProperty(value = "工序ID")
private Long processId;
/**
* 线ID
*/
@ExcelProperty(value = "所属产线ID")
private Long prodLineId;
/**
*
*/
@ExcelProperty(value = "租户编号")
private String tenantId;
/**
*
*/
@ExcelProperty(value = "创建人")
private String createBy;
/**
*
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
}

@ -0,0 +1,68 @@
package org.dromara.mes.domain.vo;
import org.dromara.mes.domain.ProdBaseProcessUser;
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;
/**
* prod_base_process_user
*
* @author zangch
* @date 2025-01-09
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = ProdBaseProcessUser.class)
public class ProdBaseProcessUserVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* ID
*/
@ExcelProperty(value = "工序ID")
private Long processId;
/**
* ID
*/
@ExcelProperty(value = "用户ID")
private Long userId;
/**
*
*/
@ExcelProperty(value = "租户编号")
private String tenantId;
/**
*
*/
@ExcelProperty(value = "用户名称")
private String userName;
/**
*
*/
@ExcelProperty(value = "创建人")
private String createBy;
/**
*
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
}

@ -1,9 +1,16 @@
package org.dromara.mes.mapper;
import org.dromara.mes.domain.ProdBaseProcessInfo;
import org.dromara.mes.domain.ProdBaseProcessProdLine;
import org.dromara.mes.domain.ProdBaseProcessUser;
import org.dromara.mes.domain.bo.ProdBaseProcessInfoBo;
import org.dromara.mes.domain.bo.ProdBaseProcessProdLineBo;
import org.dromara.mes.domain.bo.ProdBaseProcessUserBo;
import org.dromara.mes.domain.vo.ProdBaseProcessInfoVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import java.util.List;
/**
* Mapper
*
@ -12,4 +19,108 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
*/
public interface ProdBaseProcessInfoMapper extends BaseMapperPlus<ProdBaseProcessInfo, ProdBaseProcessInfoVo> {
/**
*
*
* @param processId
* @return
*/
public ProdBaseProcessInfo selectProdBaseProcessInfoByProcessId(Long processId);
/**
*
* @param processId
* @return
*/
public ProdBaseProcessInfo selectProdBaseProcessInfoUserByProcessId(Long processId);
/**
*
*
* @param prodBaseProcessInfo
* @return
*/
public List<ProdBaseProcessInfo> selectProdBaseProcessInfoList(ProdBaseProcessInfoBo prodBaseProcessInfo);
/**
*
*
* @param prodBaseProcessInfo
* @return
*/
public int insertProdBaseProcessInfo(ProdBaseProcessInfoBo prodBaseProcessInfo);
/**
*
*
* @param prodBaseProcessInfo
* @return
*/
public int updateProdBaseProcessInfo(ProdBaseProcessInfoBo prodBaseProcessInfo);
/**
*
*
* @param processId
* @return
*/
public int deleteProdBaseProcessInfoByProcessId(Long processId);
/**
*
*
* @param processIds
* @return
*/
public int deleteProdBaseProcessInfoByProcessIds(Long[] processIds);
/**
* 线
*
* @param processIds
* @return
*/
public int deleteProdBaseProcessProdlineByProcessIds(Long[] processIds);
/**
* 线
*
* @param prodBaseProcessProdlineList 线
* @return
*/
public int batchProdBaseProcessProdline(List<ProdBaseProcessProdLineBo> prodBaseProcessProdlineList);
/**
* 线
*
* @param processId ID
* @return
*/
public int deleteProdBaseProcessProdlineByProcessId(Long processId);
/**
*
*
* @param processIds
* @return
*/
public int deleteProdBaseProcessUserByProcessIds(Long[] processIds);
/**
*
*
* @param prodBaseProcessUserList
* @return
*/
public int batchProdBaseProcessUser(List<ProdBaseProcessUserBo> prodBaseProcessUserList);
/**
*
*
* @param processId ID
* @return
*/
public int deleteProdBaseProcessUserByProcessId(Long processId);
}

@ -0,0 +1,15 @@
package org.dromara.mes.mapper;
import org.dromara.mes.domain.ProdBaseProcessProdLine;
import org.dromara.mes.domain.vo.ProdBaseProcessProdLineVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 线Mapper
*
* @author LionLi
* @date 2025-01-09
*/
public interface ProdBaseProcessProdLineMapper extends BaseMapperPlus<ProdBaseProcessProdLine, ProdBaseProcessProdLineVo> {
}

@ -0,0 +1,15 @@
package org.dromara.mes.mapper;
import org.dromara.mes.domain.ProdBaseProcessUser;
import org.dromara.mes.domain.vo.ProdBaseProcessUserVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* Mapper
*
* @author zangch
* @date 2025-01-09
*/
public interface ProdBaseProcessUserMapper extends BaseMapperPlus<ProdBaseProcessUser, ProdBaseProcessUserVo> {
}

@ -57,6 +57,14 @@ public interface IProdBaseProcessInfoService {
*/
Boolean updateByBo(ProdBaseProcessInfoBo bo);
/**
*
*
* @param bo
* @return
*/
Boolean updateByBoUser(ProdBaseProcessInfoBo bo);
/**
*
*

@ -0,0 +1,69 @@
package org.dromara.mes.service;
import org.dromara.mes.domain.ProdBaseProcessProdLine;
import org.dromara.mes.domain.vo.ProdBaseProcessProdLineVo;
import org.dromara.mes.domain.bo.ProdBaseProcessProdLineBo;
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-09
*/
public interface IProdBaseProcessProdLineService {
/**
* 线
*
* @param processId
* @return 线
*/
ProdBaseProcessProdLineVo queryById(Long processId);
/**
* 线
*
* @param bo
* @param pageQuery
* @return 线
*/
TableDataInfo<ProdBaseProcessProdLineVo> queryPageList(ProdBaseProcessProdLineBo bo, PageQuery pageQuery);
/**
* 线
*
* @param bo
* @return 线
*/
List<ProdBaseProcessProdLineVo> queryList(ProdBaseProcessProdLineBo bo);
/**
* 线
*
* @param bo 线
* @return
*/
Boolean insertByBo(ProdBaseProcessProdLineBo bo);
/**
* 线
*
* @param bo 线
* @return
*/
Boolean updateByBo(ProdBaseProcessProdLineBo 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.ProdBaseProcessUser;
import org.dromara.mes.domain.vo.ProdBaseProcessUserVo;
import org.dromara.mes.domain.bo.ProdBaseProcessUserBo;
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-09
*/
public interface IProdBaseProcessUserService {
/**
*
*
* @param processId
* @return
*/
ProdBaseProcessUserVo queryById(Long processId);
/**
*
*
* @param bo
* @param pageQuery
* @return
*/
TableDataInfo<ProdBaseProcessUserVo> queryPageList(ProdBaseProcessUserBo bo, PageQuery pageQuery);
/**
*
*
* @param bo
* @return
*/
List<ProdBaseProcessUserVo> queryList(ProdBaseProcessUserBo bo);
/**
*
*
* @param bo
* @return
*/
Boolean insertByBo(ProdBaseProcessUserBo bo);
/**
*
*
* @param bo
* @return
*/
Boolean updateByBo(ProdBaseProcessUserBo bo);
/**
*
*
* @param ids
* @param isValid
* @return
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

@ -1,5 +1,9 @@
package org.dromara.mes.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.DateUtils;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -8,13 +12,24 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.RequiredArgsConstructor;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.mes.domain.ProdBaseProcessProdLine;
import org.dromara.mes.domain.ProdBaseProcessUser;
import org.dromara.mes.domain.bo.ProdBaseProcessProdLineBo;
import org.dromara.mes.domain.bo.ProdBaseProcessUserBo;
import org.dromara.mes.domain.vo.ProdBaseProcessProdLineVo;
import org.dromara.mes.domain.vo.ProdBaseProcessUserVo;
import org.dromara.mes.mapper.ProdBaseProcessProdLineMapper;
import org.dromara.mes.mapper.ProdBaseProcessUserMapper;
import org.springframework.stereotype.Service;
import org.dromara.mes.domain.bo.ProdBaseProcessInfoBo;
import org.dromara.mes.domain.vo.ProdBaseProcessInfoVo;
import org.dromara.mes.domain.ProdBaseProcessInfo;
import org.dromara.mes.mapper.ProdBaseProcessInfoMapper;
import org.dromara.mes.service.IProdBaseProcessInfoService;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Collection;
@ -31,6 +46,16 @@ public class ProdBaseProcessInfoServiceImpl implements IProdBaseProcessInfoServi
private final ProdBaseProcessInfoMapper baseMapper;
private final ProdBaseProcessUserServiceImpl prodBaseProcessUserService;
private final ProdBaseProcessProdLineServiceImpl prodBaseProcessProdlineService;
private final ProdBaseProcessUserMapper prodBaseProcessUserMapper;
private final ProdBaseProcessProdLineMapper prodBaseProcessProdlineMapper;
/**
*
*
@ -39,7 +64,23 @@ public class ProdBaseProcessInfoServiceImpl implements IProdBaseProcessInfoServi
*/
@Override
public ProdBaseProcessInfoVo queryById(Long processId){
return baseMapper.selectVoById(processId);
ProdBaseProcessInfoVo prodBaseProcessInfoVo = baseMapper.selectVoById(processId);
if (ObjectUtil.isNotEmpty(prodBaseProcessInfoVo)) {
// 关联人员
ProdBaseProcessUserBo prodBaseProcessUserBo = new ProdBaseProcessUserBo();
prodBaseProcessUserBo.setProcessId(processId);
List<ProdBaseProcessUserVo> prodBaseProcessUserVoList = prodBaseProcessUserService.queryList(prodBaseProcessUserBo);
// 关联人员若有数据则赋值给prodBaseProcessInfoVo
if(ObjectUtil.isNotEmpty(prodBaseProcessUserVoList)) prodBaseProcessInfoVo.setProdBaseProcessUserVoList(prodBaseProcessUserVoList);
// 关联产线
ProdBaseProcessProdLineBo prodBaseProcessProdlineBo = new ProdBaseProcessProdLineBo();
prodBaseProcessProdlineBo.setProcessId(processId);
List<ProdBaseProcessProdLineVo> prodBaseProcessProdlineVoList = prodBaseProcessProdlineService.queryList(prodBaseProcessProdlineBo);
// 关联产线若有数据则赋值给prodBaseProcessInfoVo
if(ObjectUtil.isNotEmpty(prodBaseProcessProdlineVoList)) prodBaseProcessInfoVo.setProdBaseProcessProdlineVoList(prodBaseProcessProdlineVoList);
}
return prodBaseProcessInfoVo;
}
/**
@ -72,6 +113,17 @@ public class ProdBaseProcessInfoServiceImpl implements IProdBaseProcessInfoServi
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<ProdBaseProcessInfo> lqw = JoinWrappers.lambda(ProdBaseProcessInfo.class)
.selectAll(ProdBaseProcessInfo.class)
/* // 关联人员
.select(ProdBaseProcessUser::getUserId)
.select(ProdBaseProcessUser::getUserName)
.leftJoin(ProdBaseProcessUser.class, ProdBaseProcessUser::getProcessId, ProdBaseProcessInfo::getProcessId)
// 关联产线
.select(ProdBaseProcessProdLine::getProdLineId)
.leftJoin(ProdBaseProcessProdLine.class, ProdBaseProcessProdLine::getProcessId, ProdBaseProcessInfo::getProcessId)*/
.eq(bo.getProcessId() != null, ProdBaseProcessInfo::getProcessId, bo.getProcessId())
.eq(StringUtils.isNotBlank(bo.getProcessCode()), ProdBaseProcessInfo::getProcessCode, bo.getProcessCode())
.like(StringUtils.isNotBlank(bo.getProcessName()), ProdBaseProcessInfo::getProcessName, bo.getProcessName())
@ -106,13 +158,76 @@ public class ProdBaseProcessInfoServiceImpl implements IProdBaseProcessInfoServi
* @param bo
* @return
*/
@Transactional
@Override
public Boolean updateByBo(ProdBaseProcessInfoBo bo) {
ProdBaseProcessInfo update = MapstructUtils.convert(bo, ProdBaseProcessInfo.class);
String tenantId = LoginHelper.getTenantId();
Long deptId = LoginHelper.getDeptId();
Long userId = LoginHelper.getUserId();
if (ObjectUtil.isNotEmpty(tenantId)) update.setTenantId(tenantId);
if (ObjectUtil.isNotEmpty(deptId)) update.setCreateDept(deptId);
if (ObjectUtil.isNotEmpty(userId)) update.setCreateBy(userId);
update.setCreateTime(DateUtils.getNowDate());
validEntityBeforeSave(update);
List<ProdBaseProcessProdLine> prodBaseProcessProdlineList = new ArrayList<>();
List<ProdBaseProcessProdLineBo> prodBaseProcessProdlineBoList = bo.getProdBaseProcessProdlineBoList();
if(ObjectUtil.isNotEmpty(prodBaseProcessProdlineBoList)){
prodBaseProcessProdlineList = MapstructUtils.convert(prodBaseProcessProdlineBoList, ProdBaseProcessProdLine.class);
update.setProdBaseProcessProdlineList(prodBaseProcessProdlineList);
}
baseMapper.deleteProdBaseProcessProdlineByProcessId(update.getProcessId());
try {
insertProdBaseProcessProdline(update);
}catch (Exception e){
throw new ServiceException("该工序已关联产线!");
}
return baseMapper.updateById(update) > 0;
}
/**
*
*
* @param bo
* @return
*/
@Transactional
@Override
public Boolean updateByBoUser(ProdBaseProcessInfoBo bo) {
ProdBaseProcessInfo update = MapstructUtils.convert(bo, ProdBaseProcessInfo.class);
String tenantId = LoginHelper.getTenantId();// 获取当前租户ID
Long deptId = LoginHelper.getDeptId();// 获取当前部门ID
Long userId = LoginHelper.getUserId();// 获取当前用户ID
if (ObjectUtil.isNotEmpty(tenantId)) update.setTenantId(tenantId);// 设置当前租户ID
if (ObjectUtil.isNotEmpty(deptId)) update.setCreateDept(deptId);// 设置当前部门ID
if (ObjectUtil.isNotEmpty(userId)) update.setCreateBy(userId);// 设置当前用户ID
update.setCreateTime(DateUtils.getNowDate());// 设置当前时间
validEntityBeforeSave(update);
List<ProdBaseProcessUser> prodBaseProcessUserList = new ArrayList<>();
List<ProdBaseProcessUserBo> prodBaseProcessUserBoList = bo.getProdBaseProcessUserBoList();
if(ObjectUtil.isNotEmpty(prodBaseProcessUserBoList)){
prodBaseProcessUserList = MapstructUtils.convert(prodBaseProcessUserBoList, ProdBaseProcessUser.class);
}
baseMapper.deleteProdBaseProcessUserByProcessId(update.getProcessId());
update.setProdBaseProcessUserList(prodBaseProcessUserList);
try {
insertProdBaseProcessUser(update);
}catch (Exception e){
System.out.println(e.getMessage());
throw new ServiceException("该工序已关联用户!");
}
return baseMapper.updateById(update) > 0;
}
/**
*
*/
@ -134,4 +249,58 @@ public class ProdBaseProcessInfoServiceImpl implements IProdBaseProcessInfoServi
}
return baseMapper.deleteByIds(ids) > 0;
}
/**
* 线
*
* @param prodBaseProcessInfo
*/
public void insertProdBaseProcessProdline(ProdBaseProcessInfo prodBaseProcessInfo) {
List<ProdBaseProcessProdLine> prodBaseProcessProdlineList = prodBaseProcessInfo.getProdBaseProcessProdlineList();
Long processId = prodBaseProcessInfo.getProcessId();
if (ObjectUtil.isNotNull(prodBaseProcessProdlineList)) {
List<ProdBaseProcessProdLine> list = new ArrayList<ProdBaseProcessProdLine>();
for (ProdBaseProcessProdLine prodBaseProcessProdline : prodBaseProcessProdlineList) {
prodBaseProcessProdline.setCreateBy(prodBaseProcessInfo.getCreateBy());
prodBaseProcessProdline.setCreateTime(prodBaseProcessInfo.getCreateTime());
prodBaseProcessProdline.setCreateDept(prodBaseProcessInfo.getCreateDept());
prodBaseProcessProdline.setTenantId(prodBaseProcessInfo.getTenantId());
list.add(prodBaseProcessProdline);
}
if (!list.isEmpty()) {
prodBaseProcessProdlineMapper.insertBatch(list);
}
}
}
/**
*
*
* @param prodBaseProcessInfo
*/
public void insertProdBaseProcessUser(ProdBaseProcessInfo prodBaseProcessInfo) {
List<ProdBaseProcessUser> prodBaseProcessUserList = prodBaseProcessInfo.getProdBaseProcessUserList();
Long processId = prodBaseProcessInfo.getProcessId();
if (ObjectUtil.isNotNull(prodBaseProcessUserList)) {
List<ProdBaseProcessUser> list = new ArrayList<ProdBaseProcessUser>();
for (ProdBaseProcessUser prodBaseProcessUser : prodBaseProcessUserList) {
prodBaseProcessUser.setCreateBy(prodBaseProcessInfo.getCreateBy());
prodBaseProcessUser.setCreateTime(prodBaseProcessInfo.getCreateTime());
prodBaseProcessUser.setCreateDept(prodBaseProcessInfo.getCreateDept());
prodBaseProcessUser.setTenantId(prodBaseProcessInfo.getTenantId());
Long userId = prodBaseProcessUser.getUserId();
list.add(prodBaseProcessUser);
}
if (!list.isEmpty()) {
prodBaseProcessUserMapper.insertBatch(list);
}
}
}
}

@ -0,0 +1,133 @@
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.ProdBaseProcessProdLineBo;
import org.dromara.mes.domain.vo.ProdBaseProcessProdLineVo;
import org.dromara.mes.domain.ProdBaseProcessProdLine;
import org.dromara.mes.mapper.ProdBaseProcessProdLineMapper;
import org.dromara.mes.service.IProdBaseProcessProdLineService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 线Service
*
* @author LionLi
* @date 2025-01-09
*/
@RequiredArgsConstructor
@Service
public class ProdBaseProcessProdLineServiceImpl implements IProdBaseProcessProdLineService {
private final ProdBaseProcessProdLineMapper baseMapper;
/**
* 线
*
* @param processId
* @return 线
*/
@Override
public ProdBaseProcessProdLineVo queryById(Long processId){
return baseMapper.selectVoById(processId);
}
/**
* 线
*
* @param bo
* @param pageQuery
* @return 线
*/
@Override
public TableDataInfo<ProdBaseProcessProdLineVo> queryPageList(ProdBaseProcessProdLineBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<ProdBaseProcessProdLine> lqw = buildQueryWrapper(bo);
Page<ProdBaseProcessProdLineVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 线
*
* @param bo
* @return 线
*/
@Override
public List<ProdBaseProcessProdLineVo> queryList(ProdBaseProcessProdLineBo bo) {
MPJLambdaWrapper<ProdBaseProcessProdLine> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private MPJLambdaWrapper<ProdBaseProcessProdLine> buildQueryWrapper(ProdBaseProcessProdLineBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<ProdBaseProcessProdLine> lqw = JoinWrappers.lambda(ProdBaseProcessProdLine.class)
.selectAll(ProdBaseProcessProdLine.class)
.eq(bo.getProcessId() != null, ProdBaseProcessProdLine::getProcessId, bo.getProcessId())
.eq(bo.getProdLineId() != null, ProdBaseProcessProdLine::getProdLineId, bo.getProdLineId())
.orderByDesc(ProdBaseProcessProdLine::getCreateTime);
return lqw;
}
/**
* 线
*
* @param bo 线
* @return
*/
@Override
public Boolean insertByBo(ProdBaseProcessProdLineBo bo) {
ProdBaseProcessProdLine add = MapstructUtils.convert(bo, ProdBaseProcessProdLine.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setProcessId(add.getProcessId());
}
return flag;
}
/**
* 线
*
* @param bo 线
* @return
*/
@Override
public Boolean updateByBo(ProdBaseProcessProdLineBo bo) {
ProdBaseProcessProdLine update = MapstructUtils.convert(bo, ProdBaseProcessProdLine.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
*
*/
private void validEntityBeforeSave(ProdBaseProcessProdLine 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,134 @@
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.ProdBaseProcessUserBo;
import org.dromara.mes.domain.vo.ProdBaseProcessUserVo;
import org.dromara.mes.domain.ProdBaseProcessUser;
import org.dromara.mes.mapper.ProdBaseProcessUserMapper;
import org.dromara.mes.service.IProdBaseProcessUserService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* Service
*
* @author zangch
* @date 2025-01-09
*/
@RequiredArgsConstructor
@Service
public class ProdBaseProcessUserServiceImpl implements IProdBaseProcessUserService {
private final ProdBaseProcessUserMapper baseMapper;
/**
*
*
* @param processId
* @return
*/
@Override
public ProdBaseProcessUserVo queryById(Long processId){
return baseMapper.selectVoById(processId);
}
/**
*
*
* @param bo
* @param pageQuery
* @return
*/
@Override
public TableDataInfo<ProdBaseProcessUserVo> queryPageList(ProdBaseProcessUserBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<ProdBaseProcessUser> lqw = buildQueryWrapper(bo);
Page<ProdBaseProcessUserVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
*
*
* @param bo
* @return
*/
@Override
public List<ProdBaseProcessUserVo> queryList(ProdBaseProcessUserBo bo) {
MPJLambdaWrapper<ProdBaseProcessUser> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private MPJLambdaWrapper<ProdBaseProcessUser> buildQueryWrapper(ProdBaseProcessUserBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<ProdBaseProcessUser> lqw = JoinWrappers.lambda(ProdBaseProcessUser.class)
.selectAll(ProdBaseProcessUser.class)
.eq(bo.getProcessId() != null, ProdBaseProcessUser::getProcessId, bo.getProcessId())
.eq(bo.getUserId() != null, ProdBaseProcessUser::getUserId, bo.getUserId())
.like(StringUtils.isNotBlank(bo.getUserName()), ProdBaseProcessUser::getUserName, bo.getUserName())
.orderByDesc(ProdBaseProcessUser::getCreateTime);
return lqw;
}
/**
*
*
* @param bo
* @return
*/
@Override
public Boolean insertByBo(ProdBaseProcessUserBo bo) {
ProdBaseProcessUser add = MapstructUtils.convert(bo, ProdBaseProcessUser.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setProcessId(add.getProcessId());
}
return flag;
}
/**
*
*
* @param bo
* @return
*/
@Override
public Boolean updateByBo(ProdBaseProcessUserBo bo) {
ProdBaseProcessUser update = MapstructUtils.convert(bo, ProdBaseProcessUser.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
*
*/
private void validEntityBeforeSave(ProdBaseProcessUser entity){
//TODO 做一些数据校验,如唯一约束
}
/**
*
*
* @param ids
* @param isValid
* @return
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}
}

@ -4,4 +4,231 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.mes.mapper.ProdBaseProcessInfoMapper">
<resultMap type="ProdBaseProcessInfo" id="ProdBaseProcessInfoResult">
<result property="processId" column="process_id"/>
<result property="processCode" column="process_code"/>
<result property="processName" column="process_name"/>
<result property="processType" column="process_type"/>
<result property="processFloor" column="process_floor"/>
<result property="finalProcessFlag" column="final_process_flag"/>
<result property="displayFlag" column="display_flag"/>
<result property="productionTime" column="production_time"/>
<result property="activeFlag" column="active_flag"/>
<result property="remark" column="remark"/>
</resultMap>
<resultMap id="ProdBaseProcessInfoProdBaseProcessProdlineResult" type="ProdBaseProcessInfo"
extends="ProdBaseProcessInfoResult">
<collection property="prodBaseProcessProdlineList" notNullColumn="sub_process_id" javaType="java.util.List"
resultMap="ProdBaseProcessProdlineResult"/>
</resultMap>
<resultMap type="ProdBaseProcessProdline" id="ProdBaseProcessProdlineResult">
<result property="processId" column="sub_process_id"/>
<result property="prodlineId" column="sub_prod_line_id"/>
<result property="createBy" column="sub_create_by"/>
<result property="createTime" column="sub_create_time"/>
</resultMap>
<resultMap id="ProdBaseProcessInfoProdBaseProcessUserResult" type="ProdBaseProcessInfo"
extends="ProdBaseProcessInfoResult">
<collection property="prodBaseProcessUserList" notNullColumn="sub_process_id" javaType="java.util.List"
resultMap="ProdBaseProcessUserResult"/>
</resultMap>
<resultMap type="ProdBaseProcessUser" id="ProdBaseProcessUserResult">
<result property="processId" column="sub_process_id"/>
<result property="userId" column="sub_user_id"/>
<result property="userName" column="sub_user_name"/>
<result property="createBy" column="sub_create_by"/>
<result property="createTime" column="sub_create_time"/>
</resultMap>
<sql id="selectProdBaseProcessInfoVo">
select process_id,
process_code,
process_name,
process_type,
process_floor,
production_time,
active_flag,
remark,
create_by,
create_time,
update_by,
update_time,
tenant_id
from prod_base_process_info
</sql>
<select id="selectProdBaseProcessInfoList" parameterType="ProdBaseProcessInfo" resultMap="ProdBaseProcessInfoResult">
<include refid="selectProdBaseProcessInfoVo"/>
<where>
<if test="processCode != null and processCode != ''">and process_code = #{processCode}</if>
<if test="processName != null and processName != ''">and process_name like concat('%', #{processName},
'%')
</if>
<if test="processType != null and processType != ''">and process_type = #{processType}</if>
<if test="productionTime != null ">and production_time = #{productionTime}</if>
<if test="displayFlag != null and displayFlag != ''">and display_flag = #{displayFlag}</if>
<if test="activeFlag != null and activeFlag != ''">and active_flag = #{activeFlag}</if>
<if test="remark != null and remark != ''">and remark = #{remark}</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId}</if>
</where>
</select>
<select id="selectProdBaseProcessInfoByProcessId" parameterType="Long"
resultMap="ProdBaseProcessInfoProdBaseProcessProdlineResult">
select a.process_id,
a.process_code,
a.process_name,
a.process_type,
a.process_floor,
a.production_time,
a.active_flag,
a.remark,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.tenant_id,
b.process_id as sub_process_id,
b.prod_line_id as sub_prod_line_id,
b.create_by as sub_create_by,
b.create_time as sub_create_time
from prod_base_process_info a
left join prod_base_process_prod_line b on b.process_id = a.process_id
where a.process_id = #{processId}
</select>
<select id="selectProdBaseProcessInfoUserByProcessId" parameterType="Long"
resultMap="ProdBaseProcessInfoProdBaseProcessUserResult">
select a.process_id,
a.process_code,
a.process_name,
a.process_type,
a.process_floor,
a.production_time,
a.active_flag,
a.remark,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.tenant_id,
b.process_id as sub_process_id,
b.user_id as sub_user_id,
b.user_name as sub_user_name,
b.create_by as sub_create_by,
b.create_time as sub_create_time
from prod_base_process_info a
left join prod_base_process_user b on b.process_id = a.process_id
where a.process_id = #{processId}
</select>
<insert id="insertProdBaseProcessInfo" parameterType="ProdBaseProcessInfo" useGeneratedKeys="true"
keyProperty="processId">
insert into prod_base_process_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="processCode != null">process_code,</if>
<if test="processName != null and processName != ''">process_name,</if>
<if test="processType != null and processType != ''">process_type,</if>
<if test="processFloor != null and processFloor != ''">process_floor,</if>
<if test="productionTime != null">production_time,</if>
<if test="activeFlag != null and activeFlag != ''">active_flag,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="tenantId != null">tenant_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="processCode != null">#{processCode},</if>
<if test="processName != null and processName != ''">#{processName},</if>
<if test="processType != null and processType != ''">#{processType},</if>
<if test="processFloor != null and processFloor != ''">#{processFloor},</if>
<if test="productionTime != null">#{productionTime},</if>
<if test="activeFlag != null and activeFlag != ''">#{activeFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="tenantId != null">#{tenantId},</if>
</trim>
</insert>
<update id="updateProdBaseProcessInfo" parameterType="ProdBaseProcessInfo">
update prod_base_process_info
<trim prefix="SET" suffixOverrides=",">
<if test="processCode != null">process_code = #{processCode},</if>
<if test="processName != null and processName != ''">process_name = #{processName},</if>
<if test="processType != null and processType != ''">process_type = #{processType},</if>
<if test="processFloor != null and processFloor != ''">process_floor = #{processFloor},</if>
<if test="productionTime != null">production_time = #{productionTime},</if>
<if test="activeFlag != null and activeFlag != ''">active_flag = #{activeFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="tenantId != null ">tenant_id = #{tenantId},</if>
</trim>
where process_id = #{processId}
</update>
<delete id="deleteProdBaseProcessInfoByProcessId" parameterType="Long">
delete
from prod_base_process_info
where process_id = #{processId}
</delete>
<delete id="deleteProdBaseProcessInfoByProcessIds" parameterType="String">
delete from prod_base_process_info where process_id in
<foreach item="processId" collection="array" open="(" separator="," close=")">
#{processId}
</foreach>
</delete>
<delete id="deleteProdBaseProcessProdlineByProcessIds" parameterType="String">
delete from prod_base_process_prod_line where process_id in
<foreach item="processId" collection="array" open="(" separator="," close=")">
#{processId}
</foreach>
</delete>
<delete id="deleteProdBaseProcessProdlineByProcessId" parameterType="Long">
delete
from prod_base_process_prod_line
where process_id = #{processId}
</delete>
<insert id="batchProdBaseProcessProdline">
insert into prod_base_process_prod_line( process_id, prod_line_id) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.processId}, #{item.prodlineId})
</foreach>
</insert>
<delete id="deleteProdBaseProcessUserByProcessIds" parameterType="String">
delete from prod_base_process_user where process_id in
<foreach item="processId" collection="array" open="(" separator="," close=")">
#{processId}
</foreach>
</delete>
<delete id="deleteProdBaseProcessUserByProcessId" parameterType="Long">
delete from prod_base_process_user where process_id = #{processId}
</delete>
<insert id="batchProdBaseProcessUser">
insert into prod_base_process_user( process_id, user_id, user_name, create_by, create_time,tenant_id) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.processId}, #{item.userId}, #{item.userName}, #{item.createBy}, #{item.createTime}, #{item.tenantId})
</foreach>
</insert>
</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.ProdBaseProcessProdLineMapper">
</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.ProdBaseProcessUserMapper">
</mapper>
Loading…
Cancel
Save