工装夹具台账
This commit is contained in:
parent
d6338c0ee9
commit
6dccafc999
@ -83,4 +83,9 @@ public class UserConstants
|
||||
public static final String ITEM_CODE ="ITEM_CODE";
|
||||
public static final String MACHINERY_TYPE_CODE="MACHINERY_TYPE_CODE";
|
||||
|
||||
/**
|
||||
* 维护类型
|
||||
*/
|
||||
public static final String MAINTEN_TYPE_REGULAR="REGULAR";
|
||||
public static final String MAINTEN_TYPE_USAGE="USAGE";
|
||||
}
|
||||
|
@ -0,0 +1,131 @@
|
||||
package com.ktg.mes.tm.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.mes.tm.domain.TmToolType;
|
||||
import com.ktg.mes.tm.service.ITmToolTypeService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
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.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.mes.tm.domain.TmTool;
|
||||
import com.ktg.mes.tm.service.ITmToolService;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 工装夹具清单Controller
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2022-05-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/mes/tm/tool")
|
||||
public class TmToolController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ITmToolService tmToolService;
|
||||
|
||||
@Autowired
|
||||
private ITmToolTypeService tmToolTypeService;
|
||||
|
||||
/**
|
||||
* 查询工装夹具清单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:tm:tool:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TmTool tmTool)
|
||||
{
|
||||
startPage();
|
||||
List<TmTool> list = tmToolService.selectTmToolList(tmTool);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出工装夹具清单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:tm:tool:export')")
|
||||
@Log(title = "工装夹具清单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TmTool tmTool)
|
||||
{
|
||||
List<TmTool> list = tmToolService.selectTmToolList(tmTool);
|
||||
ExcelUtil<TmTool> util = new ExcelUtil<TmTool>(TmTool.class);
|
||||
util.exportExcel(response, list, "工装夹具清单数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工装夹具清单详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:tm:tool:query')")
|
||||
@GetMapping(value = "/{toolId}")
|
||||
public AjaxResult getInfo(@PathVariable("toolId") Long toolId)
|
||||
{
|
||||
return AjaxResult.success(tmToolService.selectTmToolByToolId(toolId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工装夹具清单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:tm:tool:add')")
|
||||
@Log(title = "工装夹具清单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TmTool tmTool)
|
||||
{
|
||||
if(UserConstants.NOT_UNIQUE.equals(tmToolService.checkToolCodeUnique(tmTool))){
|
||||
return AjaxResult.error("此工装夹具编码已存在!");
|
||||
}
|
||||
|
||||
TmToolType type = tmToolTypeService.selectTmToolTypeByToolTypeId(tmTool.getToolTypeId());
|
||||
tmTool.setToolTypeCode(type.getToolTypeCode());
|
||||
tmTool.setToolTypeName(type.getToolTypeName());
|
||||
tmTool.setCodeFlag(type.getCodeFlag());
|
||||
return toAjax(tmToolService.insertTmTool(tmTool));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工装夹具清单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:tm:tool:edit')")
|
||||
@Log(title = "工装夹具清单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody TmTool tmTool)
|
||||
{
|
||||
if(UserConstants.NOT_UNIQUE.equals(tmToolService.checkToolCodeUnique(tmTool))){
|
||||
return AjaxResult.error("此工装夹具编码已存在!");
|
||||
}
|
||||
TmToolType type = tmToolTypeService.selectTmToolTypeByToolTypeId(tmTool.getToolTypeId());
|
||||
tmTool.setToolTypeCode(type.getToolTypeCode());
|
||||
tmTool.setToolTypeName(type.getToolTypeName());
|
||||
tmTool.setCodeFlag(type.getCodeFlag());
|
||||
if(UserConstants.MAINTEN_TYPE_REGULAR.equals(tmTool.getMaintenType())){
|
||||
tmTool.setNextMaintenPeriod(null);
|
||||
}else{
|
||||
tmTool.setNextMaintenDate(null);
|
||||
}
|
||||
return toAjax(tmToolService.updateTmTool(tmTool));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工装夹具清单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:tm:tool:remove')")
|
||||
@Log(title = "工装夹具清单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{toolIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] toolIds)
|
||||
{
|
||||
return toAjax(tmToolService.deleteTmToolByToolIds(toolIds));
|
||||
}
|
||||
}
|
@ -48,6 +48,15 @@ public class TmToolTypeController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('mes:tm:tooltype:list')")
|
||||
@GetMapping("/listAll")
|
||||
public AjaxResult listAll(){
|
||||
TmToolType tmToolType = new TmToolType();
|
||||
List<TmToolType> list = tmToolTypeService.selectTmToolTypeList(tmToolType);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出工装夹具类型列表
|
||||
*/
|
||||
|
293
ktg-mes/src/main/java/com/ktg/mes/tm/domain/TmTool.java
Normal file
293
ktg-mes/src/main/java/com/ktg/mes/tm/domain/TmTool.java
Normal file
@ -0,0 +1,293 @@
|
||||
package com.ktg.mes.tm.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ktg.common.annotation.Excel;
|
||||
import com.ktg.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 工装夹具清单对象 tm_tool
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2022-05-11
|
||||
*/
|
||||
public class TmTool extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 工装夹具ID */
|
||||
private Long toolId;
|
||||
|
||||
/** 工装夹具编码 */
|
||||
@Excel(name = "工装夹具编码")
|
||||
private String toolCode;
|
||||
|
||||
/** 工装夹具名称 */
|
||||
@Excel(name = "工装夹具名称")
|
||||
private String toolName;
|
||||
|
||||
/** 品牌 */
|
||||
@Excel(name = "品牌")
|
||||
private String brand;
|
||||
|
||||
/** 型号 */
|
||||
@Excel(name = "型号")
|
||||
private String spec;
|
||||
|
||||
/** 工装夹具类型ID */
|
||||
@Excel(name = "工装夹具类型ID")
|
||||
private Long toolTypeId;
|
||||
|
||||
/** 工装夹具类型编码 */
|
||||
@Excel(name = "工装夹具类型编码")
|
||||
private String toolTypeCode;
|
||||
|
||||
/** 工装夹具类型名称 */
|
||||
@Excel(name = "工装夹具类型名称")
|
||||
private String toolTypeName;
|
||||
|
||||
/** 是否单独编码管理 */
|
||||
@Excel(name = "是否单独编码管理")
|
||||
private String codeFlag;
|
||||
|
||||
/** 数量 */
|
||||
@Excel(name = "数量")
|
||||
private Long quantity;
|
||||
|
||||
/** 可用数量 */
|
||||
@Excel(name = "可用数量")
|
||||
private Long quantityAvail;
|
||||
|
||||
/** 保养维护类型 */
|
||||
@Excel(name = "保养维护类型")
|
||||
private String maintenType;
|
||||
|
||||
/** 下一次保养周期 */
|
||||
@Excel(name = "下一次保养周期")
|
||||
private Long nextMaintenPeriod;
|
||||
|
||||
/** 下一次保养日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "下一次保养日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date nextMaintenDate;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
/** 预留字段1 */
|
||||
private String attr1;
|
||||
|
||||
/** 预留字段2 */
|
||||
private String attr2;
|
||||
|
||||
/** 预留字段3 */
|
||||
private Long attr3;
|
||||
|
||||
/** 预留字段4 */
|
||||
private Long attr4;
|
||||
|
||||
public void setToolId(Long toolId)
|
||||
{
|
||||
this.toolId = toolId;
|
||||
}
|
||||
|
||||
public Long getToolId()
|
||||
{
|
||||
return toolId;
|
||||
}
|
||||
public void setToolCode(String toolCode)
|
||||
{
|
||||
this.toolCode = toolCode;
|
||||
}
|
||||
|
||||
public String getToolCode()
|
||||
{
|
||||
return toolCode;
|
||||
}
|
||||
public void setToolName(String toolName)
|
||||
{
|
||||
this.toolName = toolName;
|
||||
}
|
||||
|
||||
public String getToolName()
|
||||
{
|
||||
return toolName;
|
||||
}
|
||||
public void setBrand(String brand)
|
||||
{
|
||||
this.brand = brand;
|
||||
}
|
||||
|
||||
public String getBrand()
|
||||
{
|
||||
return brand;
|
||||
}
|
||||
public void setSpec(String spec)
|
||||
{
|
||||
this.spec = spec;
|
||||
}
|
||||
|
||||
public String getSpec()
|
||||
{
|
||||
return spec;
|
||||
}
|
||||
public void setToolTypeId(Long toolTypeId)
|
||||
{
|
||||
this.toolTypeId = toolTypeId;
|
||||
}
|
||||
|
||||
public Long getToolTypeId()
|
||||
{
|
||||
return toolTypeId;
|
||||
}
|
||||
public void setToolTypeCode(String toolTypeCode)
|
||||
{
|
||||
this.toolTypeCode = toolTypeCode;
|
||||
}
|
||||
|
||||
public String getToolTypeCode()
|
||||
{
|
||||
return toolTypeCode;
|
||||
}
|
||||
public void setToolTypeName(String toolTypeName)
|
||||
{
|
||||
this.toolTypeName = toolTypeName;
|
||||
}
|
||||
|
||||
public String getToolTypeName()
|
||||
{
|
||||
return toolTypeName;
|
||||
}
|
||||
public void setCodeFlag(String codeFlag)
|
||||
{
|
||||
this.codeFlag = codeFlag;
|
||||
}
|
||||
|
||||
public String getCodeFlag()
|
||||
{
|
||||
return codeFlag;
|
||||
}
|
||||
public void setQuantity(Long quantity)
|
||||
{
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public Long getQuantity()
|
||||
{
|
||||
return quantity;
|
||||
}
|
||||
public void setQuantityAvail(Long quantityAvail)
|
||||
{
|
||||
this.quantityAvail = quantityAvail;
|
||||
}
|
||||
|
||||
public Long getQuantityAvail()
|
||||
{
|
||||
return quantityAvail;
|
||||
}
|
||||
public void setMaintenType(String maintenType)
|
||||
{
|
||||
this.maintenType = maintenType;
|
||||
}
|
||||
|
||||
public String getMaintenType()
|
||||
{
|
||||
return maintenType;
|
||||
}
|
||||
public void setNextMaintenPeriod(Long nextMaintenPeriod)
|
||||
{
|
||||
this.nextMaintenPeriod = nextMaintenPeriod;
|
||||
}
|
||||
|
||||
public Long getNextMaintenPeriod()
|
||||
{
|
||||
return nextMaintenPeriod;
|
||||
}
|
||||
public void setNextMaintenDate(Date nextMaintenDate)
|
||||
{
|
||||
this.nextMaintenDate = nextMaintenDate;
|
||||
}
|
||||
|
||||
public Date getNextMaintenDate()
|
||||
{
|
||||
return nextMaintenDate;
|
||||
}
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
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(Long attr3)
|
||||
{
|
||||
this.attr3 = attr3;
|
||||
}
|
||||
|
||||
public Long getAttr3()
|
||||
{
|
||||
return attr3;
|
||||
}
|
||||
public void setAttr4(Long attr4)
|
||||
{
|
||||
this.attr4 = attr4;
|
||||
}
|
||||
|
||||
public Long getAttr4()
|
||||
{
|
||||
return attr4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("toolId", getToolId())
|
||||
.append("toolCode", getToolCode())
|
||||
.append("toolName", getToolName())
|
||||
.append("brand", getBrand())
|
||||
.append("spec", getSpec())
|
||||
.append("toolTypeId", getToolTypeId())
|
||||
.append("toolTypeCode", getToolTypeCode())
|
||||
.append("toolTypeName", getToolTypeName())
|
||||
.append("codeFlag", getCodeFlag())
|
||||
.append("quantity", getQuantity())
|
||||
.append("quantityAvail", getQuantityAvail())
|
||||
.append("maintenType", getMaintenType())
|
||||
.append("nextMaintenPeriod", getNextMaintenPeriod())
|
||||
.append("nextMaintenDate", getNextMaintenDate())
|
||||
.append("status", getStatus())
|
||||
.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,63 @@
|
||||
package com.ktg.mes.tm.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ktg.mes.tm.domain.TmTool;
|
||||
|
||||
/**
|
||||
* 工装夹具清单Mapper接口
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2022-05-11
|
||||
*/
|
||||
public interface TmToolMapper
|
||||
{
|
||||
/**
|
||||
* 查询工装夹具清单
|
||||
*
|
||||
* @param toolId 工装夹具清单主键
|
||||
* @return 工装夹具清单
|
||||
*/
|
||||
public TmTool selectTmToolByToolId(Long toolId);
|
||||
|
||||
/**
|
||||
* 查询工装夹具清单列表
|
||||
*
|
||||
* @param tmTool 工装夹具清单
|
||||
* @return 工装夹具清单集合
|
||||
*/
|
||||
public List<TmTool> selectTmToolList(TmTool tmTool);
|
||||
|
||||
public TmTool checkToolCodeUnique(TmTool tmTool);
|
||||
|
||||
/**
|
||||
* 新增工装夹具清单
|
||||
*
|
||||
* @param tmTool 工装夹具清单
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTmTool(TmTool tmTool);
|
||||
|
||||
/**
|
||||
* 修改工装夹具清单
|
||||
*
|
||||
* @param tmTool 工装夹具清单
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTmTool(TmTool tmTool);
|
||||
|
||||
/**
|
||||
* 删除工装夹具清单
|
||||
*
|
||||
* @param toolId 工装夹具清单主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTmToolByToolId(Long toolId);
|
||||
|
||||
/**
|
||||
* 批量删除工装夹具清单
|
||||
*
|
||||
* @param toolIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTmToolByToolIds(Long[] toolIds);
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.ktg.mes.tm.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ktg.mes.tm.domain.TmTool;
|
||||
|
||||
/**
|
||||
* 工装夹具清单Service接口
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2022-05-11
|
||||
*/
|
||||
public interface ITmToolService
|
||||
{
|
||||
/**
|
||||
* 查询工装夹具清单
|
||||
*
|
||||
* @param toolId 工装夹具清单主键
|
||||
* @return 工装夹具清单
|
||||
*/
|
||||
public TmTool selectTmToolByToolId(Long toolId);
|
||||
|
||||
/**
|
||||
* 查询工装夹具清单列表
|
||||
*
|
||||
* @param tmTool 工装夹具清单
|
||||
* @return 工装夹具清单集合
|
||||
*/
|
||||
public List<TmTool> selectTmToolList(TmTool tmTool);
|
||||
|
||||
public String checkToolCodeUnique(TmTool tmTool);
|
||||
|
||||
/**
|
||||
* 新增工装夹具清单
|
||||
*
|
||||
* @param tmTool 工装夹具清单
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTmTool(TmTool tmTool);
|
||||
|
||||
/**
|
||||
* 修改工装夹具清单
|
||||
*
|
||||
* @param tmTool 工装夹具清单
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTmTool(TmTool tmTool);
|
||||
|
||||
/**
|
||||
* 批量删除工装夹具清单
|
||||
*
|
||||
* @param toolIds 需要删除的工装夹具清单主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTmToolByToolIds(Long[] toolIds);
|
||||
|
||||
/**
|
||||
* 删除工装夹具清单信息
|
||||
*
|
||||
* @param toolId 工装夹具清单主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTmToolByToolId(Long toolId);
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
package com.ktg.mes.tm.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.utils.DateUtils;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ktg.mes.tm.mapper.TmToolMapper;
|
||||
import com.ktg.mes.tm.domain.TmTool;
|
||||
import com.ktg.mes.tm.service.ITmToolService;
|
||||
|
||||
/**
|
||||
* 工装夹具清单Service业务层处理
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2022-05-11
|
||||
*/
|
||||
@Service
|
||||
public class TmToolServiceImpl implements ITmToolService
|
||||
{
|
||||
@Autowired
|
||||
private TmToolMapper tmToolMapper;
|
||||
|
||||
/**
|
||||
* 查询工装夹具清单
|
||||
*
|
||||
* @param toolId 工装夹具清单主键
|
||||
* @return 工装夹具清单
|
||||
*/
|
||||
@Override
|
||||
public TmTool selectTmToolByToolId(Long toolId)
|
||||
{
|
||||
return tmToolMapper.selectTmToolByToolId(toolId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工装夹具清单列表
|
||||
*
|
||||
* @param tmTool 工装夹具清单
|
||||
* @return 工装夹具清单
|
||||
*/
|
||||
@Override
|
||||
public List<TmTool> selectTmToolList(TmTool tmTool)
|
||||
{
|
||||
return tmToolMapper.selectTmToolList(tmTool);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String checkToolCodeUnique(TmTool tmTool) {
|
||||
if(StringUtils.isNotNull(tmTool.getToolCode())){
|
||||
TmTool tool = tmToolMapper.checkToolCodeUnique(tmTool);
|
||||
Long toolId = tmTool.getToolId()==null?-1L:tmTool.getToolId();
|
||||
if(StringUtils.isNotNull(tool) && tool.getToolId().longValue()!=toolId.longValue()){
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工装夹具清单
|
||||
*
|
||||
* @param tmTool 工装夹具清单
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTmTool(TmTool tmTool)
|
||||
{
|
||||
tmTool.setCreateTime(DateUtils.getNowDate());
|
||||
return tmToolMapper.insertTmTool(tmTool);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工装夹具清单
|
||||
*
|
||||
* @param tmTool 工装夹具清单
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTmTool(TmTool tmTool)
|
||||
{
|
||||
tmTool.setUpdateTime(DateUtils.getNowDate());
|
||||
return tmToolMapper.updateTmTool(tmTool);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除工装夹具清单
|
||||
*
|
||||
* @param toolIds 需要删除的工装夹具清单主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTmToolByToolIds(Long[] toolIds)
|
||||
{
|
||||
return tmToolMapper.deleteTmToolByToolIds(toolIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工装夹具清单信息
|
||||
*
|
||||
* @param toolId 工装夹具清单主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTmToolByToolId(Long toolId)
|
||||
{
|
||||
return tmToolMapper.deleteTmToolByToolId(toolId);
|
||||
}
|
||||
}
|
164
ktg-mes/src/main/resources/mapper/tm/TmToolMapper.xml
Normal file
164
ktg-mes/src/main/resources/mapper/tm/TmToolMapper.xml
Normal file
@ -0,0 +1,164 @@
|
||||
<?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.ktg.mes.tm.mapper.TmToolMapper">
|
||||
|
||||
<resultMap type="TmTool" id="TmToolResult">
|
||||
<result property="toolId" column="tool_id" />
|
||||
<result property="toolCode" column="tool_code" />
|
||||
<result property="toolName" column="tool_name" />
|
||||
<result property="brand" column="brand" />
|
||||
<result property="spec" column="spec" />
|
||||
<result property="toolTypeId" column="tool_type_id" />
|
||||
<result property="toolTypeCode" column="tool_type_code" />
|
||||
<result property="toolTypeName" column="tool_type_name" />
|
||||
<result property="codeFlag" column="code_flag" />
|
||||
<result property="quantity" column="quantity" />
|
||||
<result property="quantityAvail" column="quantity_avail" />
|
||||
<result property="maintenType" column="mainten_type" />
|
||||
<result property="nextMaintenPeriod" column="next_mainten_period" />
|
||||
<result property="nextMaintenDate" column="next_mainten_date" />
|
||||
<result property="status" column="status" />
|
||||
<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="selectTmToolVo">
|
||||
select tool_id, tool_code, tool_name, brand, spec, tool_type_id, tool_type_code, tool_type_name, code_flag, quantity, quantity_avail, mainten_type, next_mainten_period, next_mainten_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from tm_tool
|
||||
</sql>
|
||||
|
||||
<select id="selectTmToolList" parameterType="TmTool" resultMap="TmToolResult">
|
||||
<include refid="selectTmToolVo"/>
|
||||
<where>
|
||||
<if test="toolCode != null and toolCode != ''"> and tool_code = #{toolCode}</if>
|
||||
<if test="toolName != null and toolName != ''"> and tool_name like concat('%', #{toolName}, '%')</if>
|
||||
<if test="brand != null and brand != ''"> and brand = #{brand}</if>
|
||||
<if test="spec != null and spec != ''"> and spec = #{spec}</if>
|
||||
<if test="toolTypeId != null "> and tool_type_id = #{toolTypeId}</if>
|
||||
<if test="toolTypeCode != null and toolTypeCode != ''"> and tool_type_code = #{toolTypeCode}</if>
|
||||
<if test="toolTypeName != null and toolTypeName != ''"> and tool_type_name like concat('%', #{toolTypeName}, '%')</if>
|
||||
<if test="codeFlag != null and codeFlag != ''"> and code_flag = #{codeFlag}</if>
|
||||
<if test="quantity != null "> and quantity = #{quantity}</if>
|
||||
<if test="quantityAvail != null "> and quantity_avail = #{quantityAvail}</if>
|
||||
<if test="maintenType != null and maintenType != ''"> and mainten_type = #{maintenType}</if>
|
||||
<if test="nextMaintenPeriod != null "> and next_mainten_period = #{nextMaintenPeriod}</if>
|
||||
<if test="nextMaintenDate != null "> and next_mainten_date = #{nextMaintenDate}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTmToolByToolId" parameterType="Long" resultMap="TmToolResult">
|
||||
<include refid="selectTmToolVo"/>
|
||||
where tool_id = #{toolId}
|
||||
</select>
|
||||
|
||||
<select id="checkToolCodeUnique" parameterType="TmTool" resultMap="TmToolResult">
|
||||
<include refid="selectTmToolVo"/>
|
||||
where tool_code = #{toolCode} limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertTmTool" parameterType="TmTool" useGeneratedKeys="true" keyProperty="toolId">
|
||||
insert into tm_tool
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="toolCode != null and toolCode != ''">tool_code,</if>
|
||||
<if test="toolName != null and toolName != ''">tool_name,</if>
|
||||
<if test="brand != null">brand,</if>
|
||||
<if test="spec != null">spec,</if>
|
||||
<if test="toolTypeId != null">tool_type_id,</if>
|
||||
<if test="toolTypeCode != null">tool_type_code,</if>
|
||||
<if test="toolTypeName != null">tool_type_name,</if>
|
||||
<if test="codeFlag != null and codeFlag != ''">code_flag,</if>
|
||||
<if test="quantity != null">quantity,</if>
|
||||
<if test="quantityAvail != null">quantity_avail,</if>
|
||||
<if test="maintenType != null">mainten_type,</if>
|
||||
<if test="nextMaintenPeriod != null">next_mainten_period,</if>
|
||||
<if test="nextMaintenDate != null">next_mainten_date,</if>
|
||||
<if test="status != null">status,</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="toolCode != null and toolCode != ''">#{toolCode},</if>
|
||||
<if test="toolName != null and toolName != ''">#{toolName},</if>
|
||||
<if test="brand != null">#{brand},</if>
|
||||
<if test="spec != null">#{spec},</if>
|
||||
<if test="toolTypeId != null">#{toolTypeId},</if>
|
||||
<if test="toolTypeCode != null">#{toolTypeCode},</if>
|
||||
<if test="toolTypeName != null">#{toolTypeName},</if>
|
||||
<if test="codeFlag != null and codeFlag != ''">#{codeFlag},</if>
|
||||
<if test="quantity != null">#{quantity},</if>
|
||||
<if test="quantityAvail != null">#{quantityAvail},</if>
|
||||
<if test="maintenType != null">#{maintenType},</if>
|
||||
<if test="nextMaintenPeriod != null">#{nextMaintenPeriod},</if>
|
||||
<if test="nextMaintenDate != null">#{nextMaintenDate},</if>
|
||||
<if test="status != null">#{status},</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="updateTmTool" parameterType="TmTool">
|
||||
update tm_tool
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="toolCode != null and toolCode != ''">tool_code = #{toolCode},</if>
|
||||
<if test="toolName != null and toolName != ''">tool_name = #{toolName},</if>
|
||||
<if test="brand != null">brand = #{brand},</if>
|
||||
<if test="spec != null">spec = #{spec},</if>
|
||||
<if test="toolTypeId != null">tool_type_id = #{toolTypeId},</if>
|
||||
<if test="toolTypeCode != null">tool_type_code = #{toolTypeCode},</if>
|
||||
<if test="toolTypeName != null">tool_type_name = #{toolTypeName},</if>
|
||||
<if test="codeFlag != null and codeFlag != ''">code_flag = #{codeFlag},</if>
|
||||
<if test="quantity != null">quantity = #{quantity},</if>
|
||||
<if test="quantityAvail != null">quantity_avail = #{quantityAvail},</if>
|
||||
<if test="maintenType != null">mainten_type = #{maintenType},</if>
|
||||
<if test="nextMaintenPeriod != null">next_mainten_period = #{nextMaintenPeriod},</if>
|
||||
<if test="nextMaintenDate != null">next_mainten_date = #{nextMaintenDate},</if>
|
||||
<if test="nextMaintenPeriod == null">next_mainten_period = null,</if>
|
||||
<if test="nextMaintenDate == null">next_mainten_date = null,</if>
|
||||
<if test="status != null">status = #{status},</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 tool_id = #{toolId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTmToolByToolId" parameterType="Long">
|
||||
delete from tm_tool where tool_id = #{toolId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTmToolByToolIds" parameterType="String">
|
||||
delete from tm_tool where tool_id in
|
||||
<foreach item="toolId" collection="array" open="(" separator="," close=")">
|
||||
#{toolId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user