工艺V1.0

highway
zhaoxiaolin 1 year ago
parent e5161c6ad4
commit f7cd042705

@ -40,7 +40,7 @@ public class ProProcessContentController extends BaseController
/**
*
*/
@RequiresPermissions("mes:pro:processcontent:list")
//@RequiresPermissions("mes:pro:processcontent:list")
@GetMapping("/list")
public TableDataInfo list(ProProcessContent proProcessContent)
{
@ -52,7 +52,7 @@ public class ProProcessContentController extends BaseController
/**
*
*/
@RequiresPermissions("mes:pro:processcontent:export")
//@RequiresPermissions("mes:pro:processcontent:export")
@Log(title = "生产工序内容", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ProProcessContent proProcessContent)
@ -65,7 +65,7 @@ public class ProProcessContentController extends BaseController
/**
*
*/
@RequiresPermissions("mes:pro:processcontent:query")
//@RequiresPermissions("mes:pro:processcontent:query")
@GetMapping(value = "/{contentId}")
public AjaxResult getInfo(@PathVariable("contentId") String contentId)
{
@ -75,7 +75,7 @@ public class ProProcessContentController extends BaseController
/**
*
*/
@RequiresPermissions("mes:pro:processcontent:add")
//@RequiresPermissions("mes:pro:processcontent:add")
@Log(title = "生产工序内容", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ProProcessContent proProcessContent)
@ -86,7 +86,7 @@ public class ProProcessContentController extends BaseController
/**
*
*/
@RequiresPermissions("mes:pro:processcontent:edit")
//@RequiresPermissions("mes:pro:processcontent:edit")
@Log(title = "生产工序内容", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ProProcessContent proProcessContent)
@ -97,7 +97,7 @@ public class ProProcessContentController extends BaseController
/**
*
*/
@RequiresPermissions("mes:pro:processcontent:remove")
//@RequiresPermissions("mes:pro:processcontent:remove")
@Log(title = "生产工序内容", businessType = BusinessType.DELETE)
@DeleteMapping("/{contentIds}")
public AjaxResult remove(@PathVariable String[] contentIds)

@ -0,0 +1,127 @@
package com.op.mes.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.web.page.TableDataInfo;
import com.op.common.core.web.controller.BaseController;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.mes.domain.ProRoute;
import com.op.mes.service.IProRouteProcessService;
import com.op.mes.service.IProRouteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 线Controller
*
* @author yinjinlu
* @date 2022-05-12
*/
@RestController
@RequestMapping("/pro/proroute")
public class ProRouteController extends BaseController
{
@Autowired
private IProRouteService proRouteService;
@Autowired
private IProRouteProcessService proRouteProcessService;
/**
* 线
*/
@RequiresPermissions("mes:pro:process:add")
@GetMapping("/list")
public TableDataInfo list(ProRoute proRoute)
{
startPage();
List<ProRoute> list = proRouteService.selectProRouteList(proRoute);
return getDataTable(list);
}
/**
* 线
*/
@RequiresPermissions("mes:pro:proroute:export")
@Log(title = "工艺路线", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ProRoute proRoute)
{
List<ProRoute> list = proRouteService.selectProRouteList(proRoute);
ExcelUtil<ProRoute> util = new ExcelUtil<ProRoute>(ProRoute.class);
util.exportExcel(response, list, "工艺路线数据");
}
/**
* 线
*/
@RequiresPermissions("mes:pro:proroute:query")
@GetMapping(value = "/{routeId}")
public AjaxResult getInfo(@PathVariable("routeId") String routeId)
{
return AjaxResult.success(proRouteService.selectProRouteByRouteId(routeId));
}
/**
* 线
*/
@RequiresPermissions("mes:pro:proroute:add")
@Log(title = "工艺路线", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ProRoute proRoute)
{
proRoute.setRouteId(IdUtils.fastSimpleUUID());
if(!proRouteService.checkRouteCodeUnique(proRoute)){
return AjaxResult.error("工艺路线编号已存在!");
}
return toAjax(proRouteService.insertProRoute(proRoute));
}
/**
* 线
*/
@RequiresPermissions("mes:pro:proroute:edit")
@Log(title = "工艺路线", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ProRoute proRoute)
{
if(!proRouteService.checkRouteCodeUnique(proRoute)){
return AjaxResult.error("工艺路线编号已存在!");
}
return toAjax(proRouteService.updateProRoute(proRoute));
}
/**
* 线
*/
@RequiresPermissions("mes:pro:proroute:remove")
@Log(title = "工艺路线", businessType = BusinessType.DELETE)
@Transactional
@DeleteMapping("/{routeIds}")
public AjaxResult remove(@PathVariable String[] routeIds)
{
for (String routeId:routeIds
) {
proRouteProcessService.deleteByRouteId(routeId);
//proRouteProductService.deleteByRouteId(routeId);
//proRouteProductBomService.deleteByRouteId(routeId);
}
return toAjax(proRouteService.deleteProRouteByRouteIds(routeIds));
}
}

@ -0,0 +1,180 @@
package com.op.mes.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.op.common.core.constant.UserConstants;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.web.page.TableDataInfo;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.mes.domain.ProProcess;
import com.op.mes.domain.ProRouteProcess;
import com.op.mes.service.IProProcessService;
import com.op.mes.service.IProRouteProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Controller
*
* @author yinjinlu
* @date 2022-05-13
*/
@RestController
@RequestMapping("/pro/routeprocess")
public class ProRouteProcessController extends BaseController
{
@Autowired
private IProRouteProcessService proRouteProcessService;
@Autowired
private IProProcessService proProcessService;
/**
*
*/
//@RequiresPermissions("mes:pro:routeprocess:list")
@GetMapping("/list")
public TableDataInfo list(ProRouteProcess proRouteProcess)
{
startPage();
List<ProRouteProcess> list = proRouteProcessService.selectProRouteProcessList(proRouteProcess);
return getDataTable(list);
}
/**
*
*/
//@RequiresPermissions("mes:pro:routeprocess:export")
@Log(title = "工艺组成", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ProRouteProcess proRouteProcess)
{
List<ProRouteProcess> list = proRouteProcessService.selectProRouteProcessList(proRouteProcess);
ExcelUtil<ProRouteProcess> util = new ExcelUtil<ProRouteProcess>(ProRouteProcess.class);
util.exportExcel(response, list, "工艺组成数据");
}
/**
*
*/
//@RequiresPermissions("mes:pro:routeprocess:query")
@GetMapping(value = "/{recordId}")
public AjaxResult getInfo(@PathVariable("recordId") String recordId)
{
return AjaxResult.success(proRouteProcessService.selectProRouteProcessByRecordId(recordId));
}
/**
*
*/
//@RequiresPermissions("mes:pro:routeprocess:add")
@Log(title = "工艺组成", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ProRouteProcess proRouteProcess)
{
if(!proRouteProcessService.checkOrderNumExists(proRouteProcess)){
return AjaxResult.error("序号已存在!");
}
if(!proRouteProcessService.checkProcessExists(proRouteProcess)){
return AjaxResult.error("不能重复添加工序!");
}
if(UserConstants.YES.equals(proRouteProcess.getKeyFlag()) && !proRouteProcessService.checkUpdateFlagUnique(proRouteProcess)){
return AjaxResult.error("当前工艺路线已经指定过关键工序");
}
ProProcess process = proProcessService.selectProProcessByProcessId(proRouteProcess.getProcessId());
proRouteProcess.setProcessCode(process.getProcessCode());
proRouteProcess.setProcessName(process.getProcessName());
//更新上一个工序的nextProcess
ProRouteProcess preProcess = proRouteProcessService.findPreProcess(proRouteProcess);
if(StringUtils.isNotNull(preProcess)){
preProcess.setNextProcessId(proRouteProcess.getProcessId());
preProcess.setNextProcessCode(proRouteProcess.getProcessCode());
preProcess.setNextProcessName(proRouteProcess.getProcessName());
proRouteProcessService.updateProRouteProcess(preProcess);
}
//设置当前工序的nextProcess
ProRouteProcess nextProcess = proRouteProcessService.findNextProcess(proRouteProcess);
if(StringUtils.isNotNull(nextProcess)){
proRouteProcess.setNextProcessId(nextProcess.getProcessId());
proRouteProcess.setNextProcessCode(nextProcess.getProcessCode());
proRouteProcess.setNextProcessName(nextProcess.getProcessName());
}else{
proRouteProcess.setNextProcessId("0");
proRouteProcess.setNextProcessName("无");
}
return toAjax(proRouteProcessService.insertProRouteProcess(proRouteProcess));
}
/**
*
*/
//@RequiresPermissions("mes:pro:routeprocess:edit")
@Log(title = "工艺组成", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ProRouteProcess proRouteProcess)
{
if(!proRouteProcessService.checkOrderNumExists(proRouteProcess)){
return AjaxResult.error("序号已存在!");
}
if(!proRouteProcessService.checkProcessExists(proRouteProcess)){
return AjaxResult.error("不能重复添加工序!");
}
// if(UserConstants.YES.equals(proRouteProcess.getKeyFlag()) && !proRouteProcessService.checkUpdateFlagUnique(proRouteProcess)){
// return AjaxResult.error("当前工艺路线已经指定过关键工序");
// }
ProProcess process = proProcessService.selectProProcessByProcessId(proRouteProcess.getProcessId());
proRouteProcess.setProcessCode(process.getProcessCode());
proRouteProcess.setProcessName(process.getProcessName());
//更新上一个工序的nextProcess
ProRouteProcess preProcess = proRouteProcessService.findPreProcess(proRouteProcess);
if(StringUtils.isNotNull(preProcess)){
preProcess.setNextProcessId(proRouteProcess.getProcessId());
preProcess.setNextProcessCode(proRouteProcess.getProcessCode());
preProcess.setNextProcessName(proRouteProcess.getProcessName());
proRouteProcessService.updateProRouteProcess(preProcess);
}
//设置当前工序的nextProcess
ProRouteProcess nextProcess = proRouteProcessService.findNextProcess(proRouteProcess);
if(StringUtils.isNotNull(nextProcess)){
proRouteProcess.setNextProcessId(nextProcess.getProcessId());
proRouteProcess.setNextProcessCode(nextProcess.getProcessCode());
proRouteProcess.setNextProcessName(nextProcess.getProcessName());
}else{
proRouteProcess.setNextProcessId("0");
proRouteProcess.setNextProcessName("无");
}
return toAjax(proRouteProcessService.updateProRouteProcess(proRouteProcess));
}
/**
*
*/
//@RequiresPermissions("mes:pro:routeprocess:remove")
@Log(title = "工艺组成", businessType = BusinessType.DELETE)
@DeleteMapping("/{recordIds}")
public AjaxResult remove(@PathVariable String[] recordIds)
{
return toAjax(proRouteProcessService.deleteProRouteProcessByRecordIds(recordIds));
}
}

@ -0,0 +1,182 @@
package com.op.mes.domain;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.List;
/**
* 线 pro_route
*
* @author yinjinlu
* @date 2022-05-12
*/
public class ProRoute extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 工艺路线ID */
private String routeId;
/** 工艺路线编号 */
@Excel(name = "工艺路线编号")
private String routeCode;
/** 工艺路线名称 */
@Excel(name = "工艺路线名称")
private String routeName;
/** 工艺路线说明 */
@Excel(name = "工艺路线说明")
private String routeDesc;
/** 是否启用 */
@Excel(name = "是否启用")
private String enableFlag;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private String attr3;
/** 预留字段4 */
private String attr4;
private String fileList;
private List<BaseFile> files;
private String routeVersion;
public String getFileList() {
return fileList;
}
public void setFileList(String fileList) {
this.fileList = fileList;
}
public List<BaseFile> getFiles() {
return files;
}
public void setFiles(List<BaseFile> files) {
this.files = files;
}
public String getRouteVersion() {
return routeVersion;
}
public void setRouteVersion(String routeVersion) {
this.routeVersion = routeVersion;
}
public void setRouteId(String routeId)
{
this.routeId = routeId;
}
public String getRouteId()
{
return routeId;
}
public void setRouteCode(String routeCode)
{
this.routeCode = routeCode;
}
public String getRouteCode()
{
return routeCode;
}
public void setRouteName(String routeName)
{
this.routeName = routeName;
}
public String getRouteName()
{
return routeName;
}
public void setRouteDesc(String routeDesc)
{
this.routeDesc = routeDesc;
}
public String getRouteDesc()
{
return routeDesc;
}
public void setEnableFlag(String enableFlag)
{
this.enableFlag = enableFlag;
}
public String getEnableFlag()
{
return enableFlag;
}
public void setAttr1(String attr1)
{
this.attr1 = attr1;
}
public String getAttr1()
{
return attr1;
}
public void setAttr2(String attr2)
{
this.attr2 = attr2;
}
public String getAttr2()
{
return attr2;
}
public void setAttr3(String attr3)
{
this.attr3 = attr3;
}
public String getAttr3()
{
return attr3;
}
public void setAttr4(String attr4)
{
this.attr4 = attr4;
}
public String getAttr4()
{
return attr4;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("routeId", getRouteId())
.append("routeCode", getRouteCode())
.append("routeName", getRouteName())
.append("routeDesc", getRouteDesc())
.append("enableFlag", getEnableFlag())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,272 @@
package com.op.mes.domain;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* pro_route_process
*
* @author yinjinlu
* @date 2022-05-13
*/
public class ProRouteProcess extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 记录ID */
private String recordId;
/** 工艺路线ID */
@Excel(name = "工艺路线ID")
private String routeId;
/** 工序ID */
@Excel(name = "工序ID")
private String processId;
/** 工序编码 */
@Excel(name = "工序编码")
private String processCode;
/** 工序名称 */
@Excel(name = "工序名称")
private String processName;
/** 序号 */
@Excel(name = "序号")
private Integer orderNum;
/** 工序ID */
@Excel(name = "工序ID")
private String nextProcessId;
/** 工序编码 */
@Excel(name = "工序编码")
private String nextProcessCode;
/** 工序名称 */
@Excel(name = "工序名称")
private String nextProcessName;
/** 与下一道工序关系 */
@Excel(name = "与下一道工序关系")
private String linkType;
/** 准备时间 */
@Excel(name = "准备时间")
private String defaultPreTime;
/** 等待时间 */
@Excel(name = "等待时间")
private String defaultSufTime;
/** 甘特图显示颜色 */
@Excel(name = "甘特图显示颜色")
private String colorCode;
/** 是否关键工序 */
private String keyFlag;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private String attr3;
/** 预留字段4 */
private String attr4;
public void setRecordId(String recordId)
{
this.recordId = recordId;
}
public String getRecordId()
{
return recordId;
}
public void setRouteId(String routeId)
{
this.routeId = routeId;
}
public String getRouteId()
{
return routeId;
}
public void setProcessId(String processId)
{
this.processId = processId;
}
public String getProcessId()
{
return processId;
}
public void setProcessCode(String processCode)
{
this.processCode = processCode;
}
public String getProcessCode()
{
return processCode;
}
public void setProcessName(String processName)
{
this.processName = processName;
}
public String getProcessName()
{
return processName;
}
public void setOrderNum(Integer orderNum)
{
this.orderNum = orderNum;
}
public Integer getOrderNum()
{
return orderNum;
}
public void setNextProcessId(String nextProcessId)
{
this.nextProcessId = nextProcessId;
}
public String getNextProcessId()
{
return nextProcessId;
}
public void setNextProcessCode(String nextProcessCode)
{
this.nextProcessCode = nextProcessCode;
}
public String getNextProcessCode()
{
return nextProcessCode;
}
public void setNextProcessName(String nextProcessName)
{
this.nextProcessName = nextProcessName;
}
public String getNextProcessName()
{
return nextProcessName;
}
public void setLinkType(String linkType)
{
this.linkType = linkType;
}
public String getLinkType()
{
return linkType;
}
public void setDefaultPreTime(String defaultPreTime)
{
this.defaultPreTime = defaultPreTime;
}
public String getDefaultPreTime()
{
return defaultPreTime;
}
public void setDefaultSufTime(String defaultSufTime)
{
this.defaultSufTime = defaultSufTime;
}
public String getKeyFlag() {
return keyFlag;
}
public void setKeyFlag(String keyFlag) {
this.keyFlag = keyFlag;
}
public String getDefaultSufTime()
{
return defaultSufTime;
}
public void setColorCode(String colorCode)
{
this.colorCode = colorCode;
}
public String getColorCode()
{
return colorCode;
}
public void setAttr1(String attr1)
{
this.attr1 = attr1;
}
public String getAttr1()
{
return attr1;
}
public void setAttr2(String attr2)
{
this.attr2 = attr2;
}
public String getAttr2()
{
return attr2;
}
public void setAttr3(String attr3)
{
this.attr3 = attr3;
}
public String getAttr3()
{
return attr3;
}
public void setAttr4(String attr4)
{
this.attr4 = attr4;
}
public String getAttr4()
{
return attr4;
}
@Override
public String toString() {
return "ProRouteProcess{" +
"recordId=" + recordId +
", routeId=" + routeId +
", processId=" + processId +
", processCode='" + processCode + '\'' +
", processName='" + processName + '\'' +
", orderNum=" + orderNum +
", nextProcessId=" + nextProcessId +
", nextProcessCode='" + nextProcessCode + '\'' +
", nextProcessName='" + nextProcessName + '\'' +
", linkType='" + linkType + '\'' +
", defaultPreTime=" + defaultPreTime +
", defaultSufTime=" + defaultSufTime +
", colorCode='" + colorCode + '\'' +
", keyFlag='" + keyFlag + '\'' +
", attr1='" + attr1 + '\'' +
", attr2='" + attr2 + '\'' +
", attr3=" + attr3 +
", attr4=" + attr4 +
'}';
}
}

@ -0,0 +1,74 @@
package com.op.mes.mapper;
import com.op.mes.domain.ProRoute;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 线Mapper
*
* @author yinjinlu
* @date 2022-05-12
*/
@Mapper
public interface ProRouteMapper
{
/**
* 线
*
* @param routeId 线
* @return 线
*/
public ProRoute selectProRouteByRouteId(String routeId);
/**
* 线
*
* @param proRoute 线
* @return 线
*/
public List<ProRoute> selectProRouteList(ProRoute proRoute);
/**
* 线
* @param itemId
* @return
*/
public ProRoute getRouteByProductId(String itemId);
public ProRoute checkRouteCodeUnique(ProRoute proRoute);
/**
* 线
*
* @param proRoute 线
* @return
*/
public int insertProRoute(ProRoute proRoute);
/**
* 线
*
* @param proRoute 线
* @return
*/
public int updateProRoute(ProRoute proRoute);
/**
* 线
*
* @param routeId 线
* @return
*/
public int deleteProRouteByRouteId(String routeId);
/**
* 线
*
* @param routeIds
* @return
*/
public int deleteProRouteByRouteIds(String[] routeIds);
}

@ -0,0 +1,79 @@
package com.op.mes.mapper;
import com.op.mes.domain.ProRouteProcess;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* Mapper
*
* @author yinjinlu
* @date 2022-05-13
*/
@Mapper
public interface ProRouteProcessMapper
{
/**
*
*
* @param recordId
* @return
*/
public ProRouteProcess selectProRouteProcessByRecordId(String recordId);
/**
*
*
* @param proRouteProcess
* @return
*/
public List<ProRouteProcess> selectProRouteProcessList(ProRouteProcess proRouteProcess);
public ProRouteProcess checkOrderNumExists(ProRouteProcess proRouteProcess);
public ProRouteProcess checkProcessExists(ProRouteProcess proRouteProcess);
public ProRouteProcess checkUpdateFlagUnique(ProRouteProcess proRouteProcess);
public ProRouteProcess findPreProcess(ProRouteProcess proRouteProcess);
public ProRouteProcess findNextProcess(ProRouteProcess proRouteProcess);
/**
*
*
* @param proRouteProcess
* @return
*/
public int insertProRouteProcess(ProRouteProcess proRouteProcess);
/**
*
*
* @param proRouteProcess
* @return
*/
public int updateProRouteProcess(ProRouteProcess proRouteProcess);
/**
*
*
* @param recordId
* @return
*/
public int deleteProRouteProcessByRecordId(String recordId);
/**
*
*
* @param recordIds
* @return
*/
public int deleteProRouteProcessByRecordIds(String[] recordIds);
/**
* 线ID
* @param routeId
* @return
*/
public int deleteByRouteId(String routeId);
}

@ -0,0 +1,111 @@
package com.op.mes.service;
import com.op.mes.domain.ProRouteProcess;
import java.util.List;
/**
* Service
*
* @author yinjinlu
* @date 2022-05-13
*/
public interface IProRouteProcessService
{
/**
*
*
* @param recordId
* @return
*/
public ProRouteProcess selectProRouteProcessByRecordId(String recordId);
/**
*
*
* @param proRouteProcess
* @return
*/
public List<ProRouteProcess> selectProRouteProcessList(ProRouteProcess proRouteProcess);
/**
*
* @param proRouteProcess
* @return
*/
public Boolean checkOrderNumExists(ProRouteProcess proRouteProcess);
/**
*
* @param proRouteProcess
* @return
*/
public Boolean checkProcessExists(ProRouteProcess proRouteProcess);
/**
* 线update_flag=Y
* @param proRouteProcess
* @return
*/
public Boolean checkUpdateFlagUnique(ProRouteProcess proRouteProcess);
// /**
// * 检查某个报工单对应的工序是否是关键工序
// * @param feedback
// * @return
// */
// public boolean checkKeyProcess(ProFeedback feedback);
/**
*
* @param proRouteProcess
* @return
*/
public ProRouteProcess findPreProcess(ProRouteProcess proRouteProcess);
/**
*
* @param proRouteProcess
* @return
*/
public ProRouteProcess findNextProcess(ProRouteProcess proRouteProcess);
/**
*
*
* @param proRouteProcess
* @return
*/
public int insertProRouteProcess(ProRouteProcess proRouteProcess);
/**
*
*
* @param proRouteProcess
* @return
*/
public int updateProRouteProcess(ProRouteProcess proRouteProcess);
/**
*
*
* @param recordIds
* @return
*/
public int deleteProRouteProcessByRecordIds(String[] recordIds);
/**
*
*
* @param recordId
* @return
*/
public int deleteProRouteProcessByRecordId(String recordId);
/**
* 线ID
* @param routeId
* @return
*/
public int deleteByRouteId(String routeId);
}

@ -0,0 +1,71 @@
package com.op.mes.service;
import com.op.mes.domain.ProRoute;
import java.util.List;
/**
* 线Service
*
* @author yinjinlu
* @date 2022-05-12
*/
public interface IProRouteService
{
/**
* 线
*
* @param routeId 线
* @return 线
*/
public ProRoute selectProRouteByRouteId(String routeId);
/**
* 线
*
* @param proRoute 线
* @return 线
*/
public List<ProRoute> selectProRouteList(ProRoute proRoute);
/**
* 线
* @param itemId
* @return
*/
public ProRoute getRouteByProductId(String itemId);
public Boolean checkRouteCodeUnique(ProRoute proRoute);
/**
* 线
*
* @param proRoute 线
* @return
*/
public int insertProRoute(ProRoute proRoute);
/**
* 线
*
* @param proRoute 线
* @return
*/
public int updateProRoute(ProRoute proRoute);
/**
* 线
*
* @param routeIds 线
* @return
*/
public int deleteProRouteByRouteIds(String[] routeIds);
/**
* 线
*
* @param routeId 线
* @return
*/
public int deleteProRouteByRouteId(String routeId);
}

@ -0,0 +1,182 @@
package com.op.mes.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import com.op.common.core.constant.UserConstants;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.mes.domain.ProRouteProcess;
import com.op.mes.mapper.ProRouteMapper;
import com.op.mes.mapper.ProRouteProcessMapper;
import com.op.mes.service.IProRouteProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Service
*
* @author yinjinlu
* @date 2022-05-13
*/
@Service
public class ProRouteProcessServiceImpl implements IProRouteProcessService
{
@Autowired
private ProRouteMapper proRouteMapper;
@Autowired
private ProRouteProcessMapper proRouteProcessMapper;
/**
*
*
* @param recordId
* @return
*/
@Override
public ProRouteProcess selectProRouteProcessByRecordId(String recordId)
{
return proRouteProcessMapper.selectProRouteProcessByRecordId(recordId);
}
/**
*
*
* @param proRouteProcess
* @return
*/
@Override
public List<ProRouteProcess> selectProRouteProcessList(ProRouteProcess proRouteProcess)
{
return proRouteProcessMapper.selectProRouteProcessList(proRouteProcess);
}
@Override
public Boolean checkOrderNumExists(ProRouteProcess proRouteProcess) {
ProRouteProcess process = proRouteProcessMapper.checkOrderNumExists(proRouteProcess);
String recordId = proRouteProcess.getRecordId();
if(StringUtils.isNotNull(process) && process.getRecordId().equals(recordId)){
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
@Override
public Boolean checkProcessExists(ProRouteProcess proRouteProcess) {
ProRouteProcess process = proRouteProcessMapper.checkProcessExists(proRouteProcess);
String recordId = proRouteProcess.getRecordId();
if(StringUtils.isNotNull(process) && process.getRecordId().equals(recordId) ){
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
@Override
public Boolean checkUpdateFlagUnique(ProRouteProcess proRouteProcess) {
ProRouteProcess process = proRouteProcessMapper.checkUpdateFlagUnique(proRouteProcess);
String recordId = proRouteProcess.getRecordId();
if(StringUtils.isNotNull(process) && process.getRecordId().equals(recordId)){
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
// @Override
// public boolean checkKeyProcess(ProFeedback feedback) {
// //根据当前生产的产品获取对应的工艺路线
// String routeId =-1L,processId = -1L;
// ProRouteProduct param = new ProRouteProduct();
// param.setItemId(feedback.getItemId());
// List<ProRouteProduct> products = proRouteProductMapper.selectProRouteProductList(param);
// if(CollectionUtil.isNotEmpty(products)){
// products = products.stream().filter(item -> proRouteMapper.selectProRouteByRouteId(item.getRouteId()).getEnableFlag().equals(UserConstants.YES)).collect(Collectors.toList());
// if (CollectionUtil.isNotEmpty(products)){
// routeId = products.get(0).getRouteId();
// }
// }
//
// //根据工作站获取工序
// MdWorkstation workstation = mdWorkstationMapper.selectMdWorkstationByWorkstationId(feedback.getWorkstationId());
// processId = workstation.getProcessId();
//
// //再判断当前的工序在此工艺路线中是否是关键工序
// ProRouteProcess param2 = new ProRouteProcess();
// param2.setRouteId(routeId);
// param2.setProcessId(processId);
// param2.setKeyFlag(UserConstants.YES);
// List<ProRouteProcess> processes = proRouteProcessMapper.selectProRouteProcessList(param2);
// if(CollectionUtil.isNotEmpty(processes)){
// return true;
// }
// return false;
// }
@Override
public ProRouteProcess findPreProcess(ProRouteProcess proRouteProcess) {
return proRouteProcessMapper.findPreProcess(proRouteProcess);
}
@Override
public ProRouteProcess findNextProcess(ProRouteProcess proRouteProcess) {
return proRouteProcessMapper.findNextProcess(proRouteProcess);
}
/**
*
*
* @param proRouteProcess
* @return
*/
@Override
public int insertProRouteProcess(ProRouteProcess proRouteProcess)
{
proRouteProcess.setCreateTime(DateUtils.getNowDate());
proRouteProcess.setRecordId(IdUtils.fastSimpleUUID());
return proRouteProcessMapper.insertProRouteProcess(proRouteProcess);
}
/**
*
*
* @param proRouteProcess
* @return
*/
@Override
public int updateProRouteProcess(ProRouteProcess proRouteProcess)
{
proRouteProcess.setUpdateTime(DateUtils.getNowDate());
return proRouteProcessMapper.updateProRouteProcess(proRouteProcess);
}
/**
*
*
* @param recordIds
* @return
*/
@Override
public int deleteProRouteProcessByRecordIds(String[] recordIds)
{
return proRouteProcessMapper.deleteProRouteProcessByRecordIds(recordIds);
}
/**
*
*
* @param recordId
* @return
*/
@Override
public int deleteProRouteProcessByRecordId(String recordId)
{
return proRouteProcessMapper.deleteProRouteProcessByRecordId(recordId);
}
@Override
public int deleteByRouteId(String routeId) {
return proRouteProcessMapper.deleteByRouteId(routeId);
}
}

@ -0,0 +1,178 @@
package com.op.mes.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.op.common.core.constant.UserConstants;
import com.op.common.core.domain.BaseFileData;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.mes.domain.BaseFile;
import com.op.mes.domain.ProProcess;
import com.op.mes.domain.ProRoute;
import com.op.mes.mapper.BaseFileMapper;
import com.op.mes.mapper.ProRouteMapper;
import com.op.mes.service.IProRouteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
/**
* 线Service
*
* @author yinjinlu
* @date 2022-05-12
*/
@Service
public class ProRouteServiceImpl implements IProRouteService
{
@Autowired
private ProRouteMapper proRouteMapper;
@Autowired
private BaseFileMapper baseFileMapper;
/**
* 线
*
* @param routeId 线
* @return 线
*/
@Override
public ProRoute selectProRouteByRouteId(String routeId)
{
ProRoute p = proRouteMapper.selectProRouteByRouteId(routeId);
List<BaseFile> files = baseFileMapper.getBaseFileBatch(routeId);
if(!CollectionUtils.isEmpty(files)){
p.setFiles(files);
}
return p;
}
/**
* 线
*
* @param proRoute 线
* @return 线
*/
@Override
public List<ProRoute> selectProRouteList(ProRoute proRoute)
{
return proRouteMapper.selectProRouteList(proRoute);
}
@Override
public ProRoute getRouteByProductId(String itemId) {
return proRouteMapper.getRouteByProductId(itemId);
}
@Override
public Boolean checkRouteCodeUnique(ProRoute proRoute) {
ProRoute route = proRouteMapper.checkRouteCodeUnique(proRoute);
String routeId = proRoute.getRouteId();
if(StringUtils.isNotNull(route) && route.getRouteId().equals(routeId)){
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 线
*
* @param proRoute 线
* @return
*/
@Override
public int insertProRoute(ProRoute proRoute)
{
proRoute.setCreateTime(DateUtils.getNowDate());
proRoute.setRouteVersion("V.1");
//上传附件
if(StringUtils.isNotEmpty(proRoute.getFileList())){
String[] ids = proRoute.getFileList().split(",");
List<BaseFileData> files = new ArrayList<>();
BaseFileData file = null;
for(String id:ids){
file = new BaseFileData();
file.setFileId(IdUtils.fastSimpleUUID());
file.setFileName(id.split("&fileName=")[1]);
file.setFileAddress(id);
file.setSourceId(proRoute.getRouteId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
files.add(file);
}
baseFileMapper.insertBaseFileBatch(files);
}
return proRouteMapper.insertProRoute(proRoute);
}
/**
* 线
*
* @param proRoute 线
* @return
*/
@Override
public int updateProRoute(ProRoute proRoute)
{
proRoute.setUpdateTime(DateUtils.getNowDate());
//上传附件
if(StringUtils.isNotEmpty(proRoute.getFileList())){
baseFileMapper.deleteBaseFileBySourceId(proRoute.getRouteId());
String[] ids = proRoute.getFileList().split(",");
List<BaseFileData> files = new ArrayList<>();
BaseFileData file = null;
for(String id:ids){
file = new BaseFileData();
file.setFileId(IdUtils.fastSimpleUUID());
file.setFileAddress(id);
file.setFileName(id.split("&fileName=")[1]);
file.setSourceId(proRoute.getRouteId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
files.add(file);
}
baseFileMapper.insertBaseFileBatch(files);
}
//更新版本V.1->递增
String nowRouteVersion = proRoute.getRouteVersion().replace("V","")
.replace(".","");
int nowRouteVersionNum = Integer.parseInt(nowRouteVersion);
String newRouteVersionNum = "V."+(++nowRouteVersionNum);
proRoute.setRouteVersion(newRouteVersionNum);
return proRouteMapper.updateProRoute(proRoute);
}
/**
* 线
*
* @param routeIds 线
* @return
*/
@Override
public int deleteProRouteByRouteIds(String[] routeIds)
{
return proRouteMapper.deleteProRouteByRouteIds(routeIds);
}
/**
* 线
*
* @param routeId 线
* @return
*/
@Override
public int deleteProRouteByRouteId(String routeId)
{
return proRouteMapper.deleteProRouteByRouteId(routeId);
}
}

@ -0,0 +1,134 @@
<?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="com.op.mes.mapper.ProRouteMapper">
<resultMap type="ProRoute" id="ProRouteResult">
<result property="routeId" column="route_id" />
<result property="routeCode" column="route_code" />
<result property="routeName" column="route_name" />
<result property="routeDesc" column="route_desc" />
<result property="enableFlag" column="enable_flag" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="routeVersion" column="route_version" />
</resultMap>
<sql id="selectProRouteVo">
select route_id, route_code, route_name, route_desc, enable_flag, remark,
attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time,
route_version
from pro_route
</sql>
<select id="selectProRouteList" parameterType="ProRoute" resultMap="ProRouteResult">
<include refid="selectProRouteVo"/>
<where>
<if test="routeCode != null and routeCode != ''"> and route_code = #{routeCode}</if>
<if test="routeName != null and routeName != ''"> and route_name like concat('%', #{routeName}, '%')</if>
<if test="routeDesc != null and routeDesc != ''"> and route_desc = #{routeDesc}</if>
<if test="enableFlag != null and enableFlag != ''"> and enable_flag = #{enableFlag}</if>
</where>
order by create_time desc
</select>
<select id="selectProRouteByRouteId" parameterType="String" resultMap="ProRouteResult">
<include refid="selectProRouteVo"/>
where route_id = #{routeId}
</select>
<select id="getRouteByProductId" parameterType="String" resultMap="ProRouteResult">
select r.*
from pro_route r
left join pro_route_product p
on p.route_id = r.route_id
where r.enable_flag = 'Y'
and p.item_id = #{itemId}
</select>
<select id="checkRouteCodeUnique" parameterType="ProRoute" resultMap="ProRouteResult">
select top 1 route_id, route_code, route_name, route_desc,
enable_flag, remark, attr1, attr2, attr3, attr4,
create_by, create_time, update_by, update_time
from pro_route
where route_code = #{routeCode} and route_id not in(#{routeId})
</select>
<insert id="insertProRoute" parameterType="ProRoute" useGeneratedKeys="true" keyProperty="routeId">
insert into pro_route
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="routeId != null and routeId != ''">route_id,</if>
<if test="routeCode != null and routeCode != ''">route_code,</if>
<if test="routeName != null and routeName != ''">route_name,</if>
<if test="routeDesc != null">route_desc,</if>
<if test="enableFlag != null and enableFlag != ''">enable_flag,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</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="routeVersion != null">route_version,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="routeId != null and routeId != ''">#{routeId},</if>
<if test="routeCode != null and routeCode != ''">#{routeCode},</if>
<if test="routeName != null and routeName != ''">#{routeName},</if>
<if test="routeDesc != null">#{routeDesc},</if>
<if test="enableFlag != null and enableFlag != ''">#{enableFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</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="routeVersion != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateProRoute" parameterType="ProRoute">
update pro_route
<trim prefix="SET" suffixOverrides=",">
<if test="routeCode != null and routeCode != ''">route_code = #{routeCode},</if>
<if test="routeName != null and routeName != ''">route_name = #{routeName},</if>
<if test="routeDesc != null">route_desc = #{routeDesc},</if>
<if test="enableFlag != null and enableFlag != ''">enable_flag = #{enableFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</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="routeVersion != null">route_version = #{routeVersion},</if>
</trim>
where route_id = #{routeId}
</update>
<delete id="deleteProRouteByRouteId" parameterType="String">
delete from pro_route where route_id = #{routeId}
</delete>
<delete id="deleteProRouteByRouteIds" parameterType="String">
delete from pro_route where route_id in
<foreach item="routeId" collection="array" open="(" separator="," close=")">
#{routeId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,231 @@
<?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="com.op.mes.mapper.ProRouteProcessMapper">
<resultMap type="ProRouteProcess" id="ProRouteProcessResult">
<result property="recordId" column="record_id" />
<result property="routeId" column="route_id" />
<result property="processId" column="process_id" />
<result property="processCode" column="process_code" />
<result property="processName" column="process_name" />
<result property="orderNum" column="order_num" />
<result property="nextProcessId" column="next_process_id" />
<result property="nextProcessCode" column="next_process_code" />
<result property="nextProcessName" column="next_process_name" />
<result property="linkType" column="link_type" />
<result property="defaultPreTime" column="default_pre_time" />
<result property="defaultSufTime" column="default_suf_time" />
<result property="colorCode" column="color_code" />
<result property="keyFlag" column="key_flag" ></result>
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectProRouteProcessVo">
select record_id, route_id, process_id, process_code, process_name, order_num, next_process_id, next_process_code, next_process_name, link_type, default_pre_time, default_suf_time, color_code,key_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_route_process
</sql>
<select id="selectProRouteProcessList" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult">
<include refid="selectProRouteProcessVo"/>
<where>
<if test="routeId != null "> and route_id = #{routeId}</if>
<if test="processId != null "> and process_id = #{processId}</if>
<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="orderNum != null "> and order_num = #{orderNum}</if>
<if test="nextProcessId != null "> and next_process_id = #{nextProcessId}</if>
<if test="nextProcessCode != null and nextProcessCode != ''"> and next_process_code = #{nextProcessCode}</if>
<if test="nextProcessName != null and nextProcessName != ''"> and next_process_name like concat('%', #{nextProcessName}, '%')</if>
<if test="linkType != null and linkType != ''"> and link_type = #{linkType}</if>
<if test="defaultPreTime != null "> and default_pre_time = #{defaultPreTime}</if>
<if test="defaultSufTime != null "> and default_suf_time = #{defaultSufTime}</if>
<if test="colorCode != null and colorCode != ''"> and color_code = #{colorCode}</if>
<if test="keyFlag !=null and keyFlag !=''"> and key_flag = #{keyFlag}</if>
</where>
order by order_num asc
</select>
<select id="selectProRouteProcessByRecordId" parameterType="String" resultMap="ProRouteProcessResult">
<include refid="selectProRouteProcessVo"/>
where record_id = #{recordId}
</select>
<select id="checkOrderNumExists" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult">
select top 1 record_id, route_id, process_id, process_code, process_name,
order_num, next_process_id, next_process_code, next_process_name,
link_type, default_pre_time, default_suf_time, color_code,key_flag,
remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by,
update_time
from pro_route_process
where route_id = #{routeId} and order_num = #{orderNum}
</select>
<select id="checkProcessExists" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult">
select top 1 record_id, route_id, process_id, process_code, process_name,
order_num, next_process_id, next_process_code, next_process_name,
link_type, default_pre_time, default_suf_time, color_code,key_flag,
remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by,
update_time
from pro_route_process
where route_id = #{routeId} and process_id = #{processId}
</select>
<select id="checkUpdateFlagUnique" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult">
select top 1 record_id, route_id, process_id, process_code, process_name,
order_num, next_process_id, next_process_code, next_process_name,
link_type, default_pre_time, default_suf_time, color_code,key_flag,
remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by,
update_time
from pro_route_process
where route_id = #{routeId} and key_flag = 'Y'
</select>
<select id="findPreProcess" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult">
select top 1 record_id, route_id, process_id, process_code, process_name,
order_num, next_process_id, next_process_code, next_process_name,
link_type, default_pre_time, default_suf_time, color_code,key_flag,
remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by,
update_time
from pro_route_process
where route_id = #{routeId}
<choose>
<when test="orderNum != null "> and order_num &lt; #{orderNum}</when>
<otherwise>
AND order_num &lt; (
SELECT top 1 order_num
FROM pro_route_process
WHERE route_id = #{routeId}
)
</otherwise>
</choose>
ORDER BY order_num DESC
</select>
<select id="findNextProcess" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult">
select top 1 record_id, route_id, process_id, process_code, process_name, order_num,
next_process_id, next_process_code, next_process_name, link_type, default_pre_time,
default_suf_time, color_code,key_flag, remark, attr1, attr2, attr3, attr4, create_by,
create_time, update_by, update_time from pro_route_process
where route_id = #{routeId}
<choose>
<when test="orderNum != null "> and order_num &gt; #{orderNum}</when>
<otherwise>
AND order_num &gt; (
SELECT top 1 order_num
FROM pro_route_process
WHERE route_id = #{routeId}
)
</otherwise>
</choose>
ORDER BY order_num ASC
</select>
<insert id="insertProRouteProcess" parameterType="ProRouteProcess" useGeneratedKeys="true" keyProperty="recordId">
insert into pro_route_process
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="recordId != null and recordId != ''">record_id,</if>
<if test="routeId != null">route_id,</if>
<if test="processId != null">process_id,</if>
<if test="processCode != null">process_code,</if>
<if test="processName != null">process_name,</if>
<if test="orderNum != null">order_num,</if>
<if test="nextProcessId != null">next_process_id,</if>
<if test="nextProcessCode != null">next_process_code,</if>
<if test="nextProcessName != null">next_process_name,</if>
<if test="linkType != null">link_type,</if>
<if test="defaultPreTime != null">default_pre_time,</if>
<if test="defaultSufTime != null">default_suf_time,</if>
<if test="colorCode != null">color_code,</if>
<if test="keyFlag !=null">key_flag,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordId != null and recordId != ''">#{recordId},</if>
<if test="routeId != null">#{routeId},</if>
<if test="processId != null">#{processId},</if>
<if test="processCode != null">#{processCode},</if>
<if test="processName != null">#{processName},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="nextProcessId != null">#{nextProcessId},</if>
<if test="nextProcessCode != null">#{nextProcessCode},</if>
<if test="nextProcessName != null">#{nextProcessName},</if>
<if test="linkType != null">#{linkType},</if>
<if test="defaultPreTime != null">#{defaultPreTime},</if>
<if test="defaultSufTime != null">#{defaultSufTime},</if>
<if test="colorCode != null">#{colorCode},</if>
<if test="keyFlag !=null">#{keyFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</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>
</trim>
</insert>
<update id="updateProRouteProcess" parameterType="ProRouteProcess">
update pro_route_process
<trim prefix="SET" suffixOverrides=",">
<if test="routeId != null">route_id = #{routeId},</if>
<if test="processId != null">process_id = #{processId},</if>
<if test="processCode != null">process_code = #{processCode},</if>
<if test="processName != null">process_name = #{processName},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="nextProcessId != null">next_process_id = #{nextProcessId},</if>
<if test="nextProcessCode != null">next_process_code = #{nextProcessCode},</if>
<if test="nextProcessName != null">next_process_name = #{nextProcessName},</if>
<if test="linkType != null">link_type = #{linkType},</if>
<if test="defaultPreTime != null">default_pre_time = #{defaultPreTime},</if>
<if test="defaultSufTime != null">default_suf_time = #{defaultSufTime},</if>
<if test="keyFlag !=null">key_flag = #{keyFlag},</if>
<if test="colorCode != null">color_code = #{colorCode},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</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>
</trim>
where record_id = #{recordId}
</update>
<delete id="deleteProRouteProcessByRecordId" parameterType="String">
delete from pro_route_process where record_id = #{recordId}
</delete>
<delete id="deleteProRouteProcessByRecordIds" parameterType="String">
delete from pro_route_process where record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")">
#{recordId}
</foreach>
</delete>
<delete id="deleteByRouteId" parameterType="String">
delete from pro_route_process where route_id = #{routeId}
</delete>
</mapper>
Loading…
Cancel
Save