线体管理功能

master
shaoyong 1 year ago
parent b5cd9e76f2
commit 3dd63e2288

@ -0,0 +1,109 @@
package com.op.mes.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.nacos.shaded.com.google.protobuf.Internal;
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;
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.MesLine;
import com.op.mes.service.IMesLineService;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo;
/**
* 线Controller
*
* @author Open Platform
* @date 2024-04-02
*/
@RestController
@RequestMapping("/mesLine")
public class MesLineController extends BaseController {
@Autowired
private IMesLineService mesLineService;
/**
* 线
*/
@RequiresPermissions("mes:mesLine:list")
@GetMapping("/list")
public TableDataInfo list(MesLine mesLine) {
startPage();
List<MesLine> list = mesLineService.selectMesLineList(mesLine);
return getDataTable(list);
}
/**
* 线
*/
@RequiresPermissions("mes:mesLine:export")
@Log(title = "线体管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MesLine mesLine) {
List<MesLine> list = mesLineService.selectMesLineList(mesLine);
ExcelUtil<MesLine> util = new ExcelUtil<MesLine>(MesLine. class);
util.exportExcel(response, list, "线体管理数据");
}
/**
* 线
*/
@RequiresPermissions("mes:mesLine:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(mesLineService.selectMesLineById(id));
}
/**
* 线
*/
@RequiresPermissions("mes:mesLine:add")
@Log(title = "线体管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MesLine mesLine) {
return toAjax(mesLineService.insertMesLine(mesLine));
}
/**
* 线
*/
@RequiresPermissions("mes:mesLine:edit")
@Log(title = "线体管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MesLine mesLine) {
return toAjax(mesLineService.updateMesLine(mesLine));
}
/**
* 线
*/
@RequiresPermissions("mes:mesLine:remove")
@Log(title = "线体管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(mesLineService.deleteMesLineByIds(ids));
}
/**
* 线
*/
@GetMapping("/selectLineBody")
public TableDataInfo selectLineBody(MesLine mesLine) {
startPage();
List<MesLine> list = mesLineService.selectLineBody(mesLine);
return getDataTable(list);
}
}

@ -0,0 +1,202 @@
package com.op.mes.domain;
import java.math.BigDecimal;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
/**
* 线 mes_line
*
* @author Open Platform
* @date 2024-04-02
*/
public class MesLine extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 线
*/
@Excel(name = "线体编码")
private String lineCode;
/**
* 线
*/
@Excel(name = "线体名称")
private String lineName;
/**
*
*/
@Excel(name = "标准用人")
private Long useMan;
/**
*
*/
@Excel(name = "标准效率")
private BigDecimal efficiency;
/**
*
*/
@Excel(name = "检验工具")
private String attr1;
/**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String attr2;
/**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String attr3;
/**
* 1
*/
@Excel(name = "预留字段1")
private String attr4;
/**
*
*/
@Excel(name = "工厂编码")
private String factoryCode;
/**
* 10
*/
private String delFlag;
private List<String> processList;
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setLineCode(String lineCode) {
this.lineCode = lineCode;
}
public String getLineCode() {
return lineCode;
}
public void setLineName(String lineName) {
this.lineName = lineName;
}
public String getLineName() {
return lineName;
}
public void setUseMan(Long useMan) {
this.useMan = useMan;
}
public Long getUseMan() {
return useMan;
}
public void setEfficiency(BigDecimal efficiency) {
this.efficiency = efficiency;
}
public BigDecimal getEfficiency() {
return efficiency;
}
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;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag() {
return delFlag;
}
public List<String> getProcessList() {
return processList;
}
public void setProcessList(List<String> processList) {
this.processList = processList;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("lineCode", getLineCode())
.append("lineName", getLineName())
.append("useMan", getUseMan())
.append("efficiency", getEfficiency())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("factoryCode", getFactoryCode())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,182 @@
package com.op.mes.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
/**
* 线 mes_line_process
*
* @author Open Platform
* @date 2024-04-07
*/
public class MesLineProcess extends BaseEntity {
private static final long serialVersionUID=1L;
/** id */
private String id;
/** 父级id */
@Excel(name = "父级id")
private String belongTo;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String processCode;
/** 工艺名称 */
@Excel(name = "工艺名称")
private String processName;
/** 数量 */
@Excel(name = "数量")
private BigDecimal quality;
/** 检验工具 */
@Excel(name = "检验工具")
private String attr1;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String attr2;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String attr3;
/** 预留字段1 */
@Excel(name = "预留字段1")
private String attr4;
/** 工厂编码 */
@Excel(name = "工厂编码")
private String factoryCode;
/** 删除标识1删除0正常 */
private String delFlag;
/** 所属线体编码 */
@Excel(name = "所属线体编码")
private String lineCode;
/** 所属线体名称 */
@Excel(name = "所属线体名称")
private String lineName;
public void setId(String id){
this.id = id;
}
public String getId(){
return id;
}
public void setBelongTo(String belongTo){
this.belongTo = belongTo;
}
public String getBelongTo(){
return belongTo;
}
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 setQuality(BigDecimal quality){
this.quality = quality;
}
public BigDecimal getQuality(){
return quality;
}
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;
}
public void setFactoryCode(String factoryCode){
this.factoryCode = factoryCode;
}
public String getFactoryCode(){
return factoryCode;
}
public void setDelFlag(String delFlag){
this.delFlag = delFlag;
}
public String getDelFlag(){
return delFlag;
}
public void setLineCode(String lineCode){
this.lineCode = lineCode;
}
public String getLineCode(){
return lineCode;
}
public void setLineName(String lineName){
this.lineName = lineName;
}
public String getLineName(){
return lineName;
}
@Override
public String toString(){
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id",getId())
.append("belongTo",getBelongTo())
.append("processCode",getProcessCode())
.append("processName",getProcessName())
.append("quality",getQuality())
.append("attr1",getAttr1())
.append("attr2",getAttr2())
.append("attr3",getAttr3())
.append("attr4",getAttr4())
.append("createBy",getCreateBy())
.append("createTime",getCreateTime())
.append("updateBy",getUpdateBy())
.append("updateTime",getUpdateTime())
.append("factoryCode",getFactoryCode())
.append("delFlag",getDelFlag())
.append("lineCode",getLineCode())
.append("lineName",getLineName())
.toString();
}
}

@ -0,0 +1,67 @@
package com.op.mes.mapper;
import java.util.List;
import com.op.mes.domain.MesLine;
import org.apache.ibatis.annotations.Mapper;
/**
* 线Mapper
*
* @author Open Platform
* @date 2024-04-02
*/
@Mapper
public interface MesLineMapper {
/**
* 线
*
* @param id 线
* @return 线
*/
public MesLine selectMesLineById(String id);
/**
* 线
*
* @param mesLine 线
* @return 线
*/
public List<MesLine> selectMesLineList(MesLine mesLine);
/**
* 线
*
* @param mesLine 线
* @return
*/
public int insertMesLine(MesLine mesLine);
/**
* 线
*
* @param mesLine 线
* @return
*/
public int updateMesLine(MesLine mesLine);
/**
* 线
*
* @param id 线
* @return
*/
public int deleteMesLineById(String id);
/**
* 线
*
* @param ids
* @return
*/
public int deleteMesLineByIds(String[] ids);
/**
* 线
*/
public List<MesLine> selectLineBody(MesLine mesLine);
}

@ -0,0 +1,67 @@
package com.op.mes.mapper;
import java.util.List;
import com.op.mes.domain.MesLineProcess;
import org.apache.ibatis.annotations.Mapper;
/**
* 线Mapper
*
* @author Open Platform
* @date 2024-04-07
*/
@Mapper
public interface MesLineProcessMapper {
/**
* 线
*
* @param id 线
* @return 线
*/
public MesLineProcess selectMesLineProcessById(String id);
public List<MesLineProcess> selectMesLineProcessByBelongTo(String belongTo);
/**
* 线
*
* @param mesLineProcess 线
* @return 线
*/
public List<MesLineProcess> selectMesLineProcessList(MesLineProcess mesLineProcess);
/**
* 线
*
* @param mesLineProcess 线
* @return
*/
public int insertMesLineProcess(MesLineProcess mesLineProcess);
/**
* 线
*
* @param mesLineProcess 线
* @return
*/
public int updateMesLineProcess(MesLineProcess mesLineProcess);
/**
* 线
*
* @param id 线
* @return
*/
public int deleteMesLineProcessById(String id);
/**
* 线
*
* @param ids
* @return
*/
public int deleteMesLineProcessByIds(String[] ids);
public int deleteMesLineProcessByBelongTo(String belongTo);
}

@ -0,0 +1,64 @@
package com.op.mes.service;
import java.util.List;
import com.op.mes.domain.MesLineProcess;
/**
* 线Service
*
* @author Open Platform
* @date 2024-04-07
*/
public interface IMesLineProcessService {
/**
* 线
*
* @param id 线
* @return 线
*/
public MesLineProcess selectMesLineProcessById(String id);
public List<MesLineProcess> selectMesLineProcessByBelongTo(String belongTo);
/**
* 线
*
* @param mesLineProcess 线
* @return 线
*/
public List<MesLineProcess> selectMesLineProcessList(MesLineProcess mesLineProcess);
/**
* 线
*
* @param mesLineProcess 线
* @return
*/
public int insertMesLineProcess(MesLineProcess mesLineProcess);
/**
* 线
*
* @param mesLineProcess 线
* @return
*/
public int updateMesLineProcess(MesLineProcess mesLineProcess);
/**
* 线
*
* @param ids 线
* @return
*/
public int deleteMesLineProcessByIds(String[] ids);
/**
* 线
*
* @param id 线
* @return
*/
public int deleteMesLineProcessById(String id);
public int deleteMesLineProcessByBelongTo(String belongTo);
}

@ -0,0 +1,66 @@
package com.op.mes.service;
import java.util.List;
import com.op.mes.domain.MesLine;
/**
* 线Service
*
* @author Open Platform
* @date 2024-04-02
*/
public interface IMesLineService {
/**
* 线
*
* @param id 线
* @return 线
*/
public MesLine selectMesLineById(String id);
/**
* 线
*
* @param mesLine 线
* @return 线
*/
public List<MesLine> selectMesLineList(MesLine mesLine);
/**
* 线
*
* @param mesLine 线
* @return
*/
public int insertMesLine(MesLine mesLine);
/**
* 线
*
* @param mesLine 线
* @return
*/
public int updateMesLine(MesLine mesLine);
/**
* 线
*
* @param ids 线
* @return
*/
public int deleteMesLineByIds(String[] ids);
/**
* 线
*
* @param id 线
* @return
*/
public int deleteMesLineById(String id);
/**
* 线
*/
public List<MesLine> selectLineBody(MesLine mesLine);
}

@ -0,0 +1,110 @@
package com.op.mes.service.impl;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.mes.mapper.MesLineProcessMapper;
import com.op.mes.domain.MesLineProcess;
import com.op.mes.service.IMesLineProcessService;
/**
* 线Service
*
* @author Open Platform
* @date 2024-04-07
*/
@Service
public class MesLineProcessServiceImpl implements IMesLineProcessService {
@Autowired
private MesLineProcessMapper mesLineProcessMapper;
/**
* 线
*
* @param id 线
* @return 线
*/
@Override
@DS("#header.poolName")
public MesLineProcess selectMesLineProcessById(String id) {
return mesLineProcessMapper.selectMesLineProcessById(id);
}
@Override
public List<MesLineProcess> selectMesLineProcessByBelongTo(String belongTo) {
return mesLineProcessMapper.selectMesLineProcessByBelongTo(belongTo);
}
/**
* 线
*
* @param mesLineProcess 线
* @return 线
*/
@Override
@DS("#header.poolName")
public List<MesLineProcess> selectMesLineProcessList(MesLineProcess mesLineProcess) {
return mesLineProcessMapper.selectMesLineProcessList(mesLineProcess);
}
/**
* 线
*
* @param mesLineProcess 线
* @return
*/
@Override
@DS("#header.poolName")
public int insertMesLineProcess(MesLineProcess mesLineProcess) {
mesLineProcess.setId(IdUtils.fastSimpleUUID());
mesLineProcess.setCreateTime(DateUtils.getNowDate());
mesLineProcess.setCreateBy(SecurityUtils.getUsername());
return mesLineProcessMapper.insertMesLineProcess(mesLineProcess);
}
/**
* 线
*
* @param mesLineProcess 线
* @return
*/
@Override
@DS("#header.poolName")
public int updateMesLineProcess(MesLineProcess mesLineProcess) {
mesLineProcess.setUpdateTime(DateUtils.getNowDate());
return mesLineProcessMapper.updateMesLineProcess(mesLineProcess);
}
/**
* 线
*
* @param ids 线
* @return
*/
@Override
public int deleteMesLineProcessByIds(String[] ids) {
return mesLineProcessMapper.deleteMesLineProcessByIds(ids);
}
/**
* 线
*
* @param id 线
* @return
*/
@Override
public int deleteMesLineProcessById(String id) {
return mesLineProcessMapper.deleteMesLineProcessById(id);
}
@Override
@DS("#header.poolName")
public int deleteMesLineProcessByBelongTo(String belongTo) {
return mesLineProcessMapper.deleteMesLineProcessByBelongTo(belongTo);
}
}

@ -0,0 +1,164 @@
package com.op.mes.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.mes.domain.MesLineProcess;
import com.op.mes.service.IMesLineProcessService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.mes.mapper.MesLineMapper;
import com.op.mes.domain.MesLine;
import com.op.mes.service.IMesLineService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
* 线Service
*
* @author Open Platform
* @date 2024-04-02
*/
@Service
public class MesLineServiceImpl implements IMesLineService {
@Autowired
private MesLineMapper mesLineMapper;
@Autowired
private IMesLineProcessService mesLineProcessService;
/**
* 线
*
* @param id 线
* @return 线
*/
@Override
@DS("#header.poolName")
public MesLine selectMesLineById(String id) {
//查询时回显线体工艺数据
List<MesLineProcess> mesList = mesLineProcessService.selectMesLineProcessByBelongTo(id);
List<String> processList = mesList.stream().map(MesLineProcess::getProcessName).collect(Collectors.toList());
MesLine mesLine = mesLineMapper.selectMesLineById(id);
//设置线体数据
if (!CollectionUtils.isEmpty(processList)) {
mesLine.setProcessList(processList);
}
return mesLine;
}
/**
* 线
*
* @param mesLine 线
* @return 线
*/
@Override
@DS("#header.poolName")
public List<MesLine> selectMesLineList(MesLine mesLine) {
return mesLineMapper.selectMesLineList(mesLine);
}
/**
* 线
*
* @param mesLine 线
* @return
*/
@Override
@DS("#header.poolName")
public int insertMesLine(MesLine mesLine) {
mesLine.setCreateTime(DateUtils.getNowDate());
mesLine.setCreateBy(SecurityUtils.getUsername());
mesLine.setId(IdUtils.fastSimpleUUID());
// 获取工厂编码
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
String factoryCode = request.getHeader(key.substring(8)).replace("ds_", "");
mesLine.setFactoryCode(factoryCode);
return mesLineMapper.insertMesLine(mesLine);
}
/**
* 线
*
* @param mesLine 线
* @return
*/
@Override
@DS("#header.poolName")
@Transactional(propagation = Propagation.REQUIRED)
public int updateMesLine(MesLine mesLine) {
mesLine.setUpdateTime(DateUtils.getNowDate());
mesLine.setUpdateBy(SecurityUtils.getUsername());
List<String> processList = mesLine.getProcessList();
int flag = 0;
if (!CollectionUtils.isEmpty(processList)) {
//删除旧的工艺项
mesLineProcessService.deleteMesLineProcessByBelongTo(mesLine.getId());
String belongTo = mesLine.getId();
String lineCode = mesLine.getLineCode();
String lineName = mesLine.getLineName();
// 获取工厂编码
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
String factoryCode = request.getHeader(key.substring(8)).replace("ds_", "");
for (String processName : processList ) {
MesLineProcess mesLineProcess = new MesLineProcess();
mesLineProcess.setBelongTo(belongTo);
mesLineProcess.setProcessName(processName);
mesLineProcess.setLineCode(lineCode);
mesLineProcess.setLineName(lineName);
mesLineProcess.setFactoryCode(factoryCode);
flag += mesLineProcessService.insertMesLineProcess(mesLineProcess);
}
}else {
return 0;
}
if (flag > 0){
return mesLineMapper.updateMesLine(mesLine);
}else {
return 0;
}
}
/**
* 线
*
* @param ids 线
* @return
*/
@Override
@DS("#header.poolName")
public int deleteMesLineByIds(String[] ids) {
return mesLineMapper.deleteMesLineByIds(ids);
}
/**
* 线
*
* @param id 线
* @return
*/
@Override
public int deleteMesLineById(String id) {
return mesLineMapper.deleteMesLineById(id);
}
@Override
@DS("#header.poolName")
public List<MesLine> selectLineBody(MesLine mesLine) {
return mesLineMapper.selectLineBody(mesLine);
}
}

@ -0,0 +1,150 @@
<?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.MesLineMapper">
<resultMap type="MesLine" id="MesLineResult">
<result property="id" column="id"/>
<result property="lineCode" column="line_code"/>
<result property="lineName" column="line_name"/>
<result property="useMan" column="use_man"/>
<result property="efficiency" column="efficiency"/>
<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="factoryCode" column="factory_code"/>
<result property="delFlag" column="del_flag"/>
</resultMap>
<sql id="selectMesLineVo">
select id, line_code, line_name, use_man, efficiency, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag from mes_line
</sql>
<select id="selectMesLineList" parameterType="MesLine" resultMap="MesLineResult">
<include refid="selectMesLineVo"/>
<where>
<if test="lineCode != null and lineCode != ''">
and line_code = #{lineCode}
</if>
<if test="lineName != null and lineName != ''">
and line_name like concat('%', #{lineName}, '%')
</if>
<if test="useMan != null ">
and use_man = #{useMan}
</if>
<if test="efficiency != null ">
and efficiency = #{efficiency}
</if>
<if test="attr1 != null and attr1 != ''">
and attr1 = #{attr1}
</if>
<if test="attr2 != null and attr2 != ''">
and attr2 = #{attr2}
</if>
<if test="attr3 != null and attr3 != ''">
and attr3 = #{attr3}
</if>
<if test="attr4 != null and attr4 != ''">
and attr4 = #{attr4}
</if>
<if test="factoryCode != null and factoryCode != ''">
and factory_code = #{factoryCode}
</if>
and del_flag = '0'
</where>
</select>
<select id="selectMesLineById" parameterType="String"
resultMap="MesLineResult">
<include refid="selectMesLineVo"/>
where id = #{id}
</select>
<insert id="insertMesLine" parameterType="MesLine">
insert into mes_line
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="lineCode != null">line_code,</if>
<if test="lineName != null">line_name,</if>
<if test="useMan != null">use_man,</if>
<if test="efficiency != null">efficiency,</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="factoryCode != null">factory_code,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="lineCode != null">#{lineCode},</if>
<if test="lineName != null">#{lineName},</if>
<if test="useMan != null">#{useMan},</if>
<if test="efficiency != null">#{efficiency},</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="factoryCode != null">#{factoryCode},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateMesLine" parameterType="MesLine">
update mes_line
<trim prefix="SET" suffixOverrides=",">
<if test="lineCode != null">line_code = #{lineCode},</if>
<if test="lineName != null">line_name = #{lineName},</if>
<if test="useMan != null">use_man = #{useMan},</if>
<if test="efficiency != null">efficiency = #{efficiency},</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="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="delFlag != null">del_flag =#{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMesLineById" parameterType="String">
update mes_line set del_flag = '1' where id = #{id}
</delete>
<delete id="deleteMesLineByIds" parameterType="String">
update mes_line set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectLineBody" parameterType="MesLine" resultMap="MesLineResult" >
select equipment_code line_code,
equipment_name line_name
from base_equipment
where del_flag = '0'
<if test="lineCode != null and lineCode != ''">
and equipment_code = #{lineCode}
</if>
<if test="lineName != null and lineName != ''">
and equipment_name like concat('%', #{lineName}, '%')
</if>
</select>
</mapper>

@ -0,0 +1,226 @@
<?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.MesLineProcessMapper">
<resultMap type="MesLineProcess" id="MesLineProcessResult">
<result property="id" column="id"/>
<result property="belongTo" column="belong_to"/>
<result property="processCode" column="process_code"/>
<result property="processName" column="process_name"/>
<result property="quality" column="quality"/>
<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="factoryCode" column="factory_code"/>
<result property="delFlag" column="del_flag"/>
<result property="lineCode" column="line_code"/>
<result property="lineName" column="line_name"/>
</resultMap>
<sql id="selectMesLineProcessVo">
select id, belong_to, process_code, process_name, quality, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag, line_code, line_name from mes_line_process
</sql>
<select id="selectMesLineProcessList" parameterType="MesLineProcess" resultMap="MesLineProcessResult">
<include refid="selectMesLineProcessVo"/>
<where>
<if test="belongTo != null and belongTo != ''">
and belong_to = #{belongTo}
</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="quality != null ">
and quality = #{quality}
</if>
<if test="attr1 != null and attr1 != ''">
and attr1 = #{attr1}
</if>
<if test="attr2 != null and attr2 != ''">
and attr2 = #{attr2}
</if>
<if test="attr3 != null and attr3 != ''">
and attr3 = #{attr3}
</if>
<if test="attr4 != null and attr4 != ''">
and attr4 = #{attr4}
</if>
<if test="factoryCode != null and factoryCode != ''">
and factory_code = #{factoryCode}
</if>
<if test="lineCode != null and lineCode != ''">
and line_code = #{lineCode}
</if>
<if test="lineName != null and lineName != ''">
and line_name like concat('%', #{lineName}, '%')
</if>
</where>
</select>
<select id="selectMesLineProcessById" parameterType="String"
resultMap="MesLineProcessResult">
<include refid="selectMesLineProcessVo"/>
where id = #{id}
</select>
<select id="selectMesLineProcessByBelongTo" parameterType="String"
resultMap="MesLineProcessResult">
<include refid="selectMesLineProcessVo"/>
where belong_to = #{belongTo}
</select>
<insert id="insertMesLineProcess" parameterType="MesLineProcess">
insert into mes_line_process
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,
</if>
<if test="belongTo != null">belong_to,
</if>
<if test="processCode != null">process_code,
</if>
<if test="processName != null">process_name,
</if>
<if test="quality != null">quality,
</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="factoryCode != null">factory_code,
</if>
<if test="delFlag != null">del_flag,
</if>
<if test="lineCode != null">line_code,
</if>
<if test="lineName != null">line_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},
</if>
<if test="belongTo != null">#{belongTo},
</if>
<if test="processCode != null">#{processCode},
</if>
<if test="processName != null">#{processName},
</if>
<if test="quality != null">#{quality},
</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="factoryCode != null">#{factoryCode},
</if>
<if test="delFlag != null">#{delFlag},
</if>
<if test="lineCode != null">#{lineCode},
</if>
<if test="lineName != null">#{lineName},
</if>
</trim>
</insert>
<update id="updateMesLineProcess" parameterType="MesLineProcess">
update mes_line_process
<trim prefix="SET" suffixOverrides=",">
<if test="belongTo != null">belong_to =
#{belongTo},
</if>
<if test="processCode != null">process_code =
#{processCode},
</if>
<if test="processName != null">process_name =
#{processName},
</if>
<if test="quality != null">quality =
#{quality},
</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="factoryCode != null">factory_code =
#{factoryCode},
</if>
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
<if test="lineCode != null">line_code =
#{lineCode},
</if>
<if test="lineName != null">line_name =
#{lineName},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMesLineProcessById" parameterType="String">
delete from mes_line_process where id = #{id}
</delete>
<delete id="deleteMesLineProcessByIds" parameterType="String">
delete from mes_line_process where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteMesLineProcessByBelongTo" parameterType="String">
delete from mes_line_process where belong_to = #{belongTo}
</delete>
</mapper>
Loading…
Cancel
Save