开发BOM管理

master
baogq 6 years ago
parent 23c79df198
commit d7c1081508

@ -0,0 +1,169 @@
package com.ruoyi.web.controller.baseinfo;
import java.util.List;
import com.ruoyi.baseinfo.domain.BaseMaterialInfo;
import com.ruoyi.baseinfo.service.IBaseMaterialInfoService;
import com.ruoyi.baseinfo.service.IBaseMaterialtypeInfoService;
import com.ruoyi.system.domain.SysDept;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.baseinfo.domain.BaseBomInfo;
import com.ruoyi.baseinfo.service.IBaseBomInfoService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* BOMController
*
* @author CaesarBao
* @date 2020-11-04
*/
@Controller
@RequestMapping("/baseinfo/bominfo")
public class BaseBomInfoController extends BaseController
{
private String prefix = "baseinfo/bominfo";
@Autowired
private IBaseBomInfoService baseBomInfoService;
@Autowired
private IBaseMaterialtypeInfoService baseMaterialtypeInfoService;
@Autowired
private IBaseMaterialInfoService baseMaterialInfoService;
@RequiresPermissions("baseinfo:bominfo:view")
@GetMapping()
public String bominfo()
{
return prefix + "/bominfo";
}
/**
* BOM
*/
// @RequiresPermissions("baseinfo:bominfo:list")
// @PostMapping("/list")
// @ResponseBody
// public TableDataInfo list1(BaseBomInfo baseBomInfo)
// {
// startPage();
// List<BaseBomInfo> list = baseBomInfoService.selectBaseBomInfoList(baseBomInfo);
// return getDataTable(list);
// }
@RequiresPermissions("baseinfo:bominfo:list")
@PostMapping("/list")
@ResponseBody
public List<BaseBomInfo> list(BaseBomInfo baseBomInfo)
{
List<BaseBomInfo> list = baseBomInfoService.selectBaseBomInfoList(baseBomInfo);
return list;
}
/**
* BOM
*/
@RequiresPermissions("baseinfo:bominfo:export")
@Log(title = "BOM基础信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(BaseBomInfo baseBomInfo)
{
List<BaseBomInfo> list = baseBomInfoService.selectBaseBomInfoList(baseBomInfo);
ExcelUtil<BaseBomInfo> util = new ExcelUtil<BaseBomInfo>(BaseBomInfo.class);
return util.exportExcel(list, "bominfo");
}
/**
* BOM
*/
@GetMapping("/add")
public String add(ModelMap mmap)
{
BaseMaterialInfo BaseMaterialInfo = new BaseMaterialInfo();
mmap.put("cbmaterialtypeInfo",baseMaterialtypeInfoService.selectAddBaseMaterialtypeInfoList());
mmap.put("cbmaterialInfo",baseMaterialInfoService.selectBaseMaterialInfoList(BaseMaterialInfo));
return prefix + "/addproduct";
}
/**
* BOM
*/
@RequiresPermissions("baseinfo:bominfo:addproduct")
@Log(title = "BOM基础信息", businessType = BusinessType.INSERT)
@PostMapping("/addproduct")
@ResponseBody
public AjaxResult addSaveproduct(BaseBomInfo baseBomInfo)
{
baseBomInfo.setpId(0L);
return toAjax(baseBomInfoService.insertBaseBomInfo(baseBomInfo));
}
/**
* BOM
*/
@GetMapping("/add/{parentId}")
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
{
BaseMaterialInfo BaseMaterialInfo = new BaseMaterialInfo();
mmap.put("parent", baseBomInfoService.selectBaseBomInfoById(parentId));
mmap.put("cbmaterialtypeInfo",baseMaterialtypeInfoService.selectAddBaseMaterialtypeInfoList());
mmap.put("cbmaterialInfo",baseMaterialInfoService.selectBaseMaterialInfoList(BaseMaterialInfo));
return prefix + "/add";
}
/**
* BOM
*/
@RequiresPermissions("baseinfo:bominfo:add")
@Log(title = "BOM基础信息", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(BaseBomInfo baseBomInfo)
{
return toAjax(baseBomInfoService.insertBaseBomInfo(baseBomInfo));
}
/**
* BOM
*/
@GetMapping("/edit/{objid}")
public String edit(@PathVariable("objid") Long objid, ModelMap mmap)
{
BaseBomInfo baseBomInfo = baseBomInfoService.selectBaseBomInfoById(objid);
mmap.put("baseBomInfo", baseBomInfo);
return prefix + "/edit";
}
/**
* BOM
*/
@RequiresPermissions("baseinfo:bominfo:edit")
@Log(title = "BOM基础信息", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(BaseBomInfo baseBomInfo)
{
return toAjax(baseBomInfoService.updateBaseBomInfo(baseBomInfo));
}
/**
* BOM
*/
@RequiresPermissions("baseinfo:bominfo:remove")
@Log(title = "BOM基础信息", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(baseBomInfoService.deleteBaseBomInfoByIds(ids));
}
}

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增BOM基础信息')" />
<th:block th:include="include :: jasny-bootstrap-css" />
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-bominfo-add">
<!-- <div class="form-group"> -->
<!-- <label class="col-sm-3 control-label">父节点ID</label>-->
<!-- <div class="col-sm-8">-->
<!-- <input name="pId" class="form-control" type="text">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label">上级物料:</label>
<div class="col-sm-8">
<div class="input-group">
<input name="materialName" class="form-control" type="text" readonly="true" th:value="${parent.materialName}">
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料类型ID</label>
<div class="col-sm-8">
<select name="materialTypeId" id="workingProcedureId" class="form-control ">
<option value="">--请选择物料类型--</option>
<option name="cbmaterialtypeInfo" th:each="materialTypeId:${cbmaterialtypeInfo}" th:value="${materialTypeId.materialTypeId}" th:text="${materialTypeId.materialTypeName}" th:disabled="${materialTypeId.status == '1'}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料ID</label>
<div class="col-sm-8">
<select name="materialId" id="materialId" class="form-control ">
<option value="">--请选择物料类型--</option>
<option name="cbmaterialInfo" th:each="materialId:${cbmaterialInfo}" th:value="${materialId.materialId}" th:text="${materialId.materialName}" th:disabled="${materialId.status == '1'}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: jasny-bootstrap-js" />
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
var prefix = ctx + "baseinfo/bominfo"
$("#form-bominfo-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-bominfo-add').serialize());
}
}
</script>
</body>
</html>

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增BOM基础信息')" />
<th:block th:include="include :: jasny-bootstrap-css" />
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-bominfo-add">
<!-- <div class="form-group"> -->
<!-- <label class="col-sm-3 control-label">父节点ID</label>-->
<!-- <div class="col-sm-8">-->
<!-- <input name="pId" class="form-control" type="text">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="col-sm-3 control-label">上级物料:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <div class="input-group">-->
<!-- <input name="materialName" class="form-control" type="text" readonly="true" th:value="${parent.materialName}">-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label">物料类型ID</label>
<div class="col-sm-8">
<select name="materialTypeId" id="workingProcedureId" class="form-control ">
<option value="">--请选择物料类型--</option>
<option name="cbmaterialtypeInfo" th:each="materialTypeId:${cbmaterialtypeInfo}" th:value="${materialTypeId.materialTypeId}" th:text="${materialTypeId.materialTypeName}" th:disabled="${materialTypeId.status == '1'}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料ID</label>
<div class="col-sm-8">
<select name="materialId" id="materialId" class="form-control ">
<option value="">--请选择物料类型--</option>
<option name="cbmaterialInfo" th:each="materialId:${cbmaterialInfo}" th:value="${materialId.materialId}" th:text="${materialId.materialName}" th:disabled="${materialId.status == '1'}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: jasny-bootstrap-js" />
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
var prefix = ctx + "baseinfo/bominfo"
$("#form-bominfo-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/addproduct", $('#form-bominfo-add').serialize());
}
}
</script>
</body>
</html>

@ -0,0 +1,130 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('BOM基础信息列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>父节点ID</label>
<input type="text" name="pId"/>
</li>
<li>
<label>物料类型:</label>
<select name="materialTypeId">
<option value="">所有</option>
</select>
</li>
<li>
<label>物料ID</label>
<select name="materialId">
<option value="">所有</option>
</select>
</li>
<li>
<label>状态标志:</label>
<select name="status" th:with="type=${@dict.getType('sys_status_info')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="baseinfo:bominfo:add">
<i class="fa fa-plus"></i> 添加产品
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="baseinfo:bominfo:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="baseinfo:bominfo:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="baseinfo:bominfo:export">
<i class="fa fa-download"></i> 导出
</a>
<a class="btn btn-info" id="expandAllBtn">
<i class="fa fa-exchange"></i> 展开/折叠
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-tree-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var addFlag = [[${@permission.hasPermi('baseinfo:bominfo:add')}]];
var editFlag = [[${@permission.hasPermi('baseinfo:bominfo:edit')}]];
var removeFlag = [[${@permission.hasPermi('baseinfo:bominfo:remove')}]];
var statusDatas = [[${@dict.getType('sys_status_info')}]];
var prefix = ctx + "baseinfo/bominfo";
$(function() {
var options = {
code: "bomId",
parentCode: "pId",
uniqueId: "bomId",
url: prefix + "/list",
createUrl: prefix + "/add/{id}",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove/{id}",
modalName: "BOM",
columns: [{
field: 'selectItem',
radio: true
},
{
field: 'materialTypeName',
title: '物料类型',
align: "left"
},
{
field: 'materialName',
title: '物料名称',
align: "left"
},
{
field: 'status',
title: '状态标志',
align: "left",
formatter: function(value, row, index) {
return $.table.selectDictLabel(statusDatas, value);
}
},
{
field: 'remark',
title: '备注',
align: "left"
},
{
title: '操作',
align: "left",
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.bomId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.bomId + '\')"><i class="fa fa-plus"></i>新增</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.bomId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}
]
};
$.treeTable.init(options);
});
</script>
</body>
</html>

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改BOM基础信息')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-bominfo-edit" th:object="${baseBomInfo}">
<input name="objid" th:field="*{objid}" type="hidden">
<!-- <div class="form-group"> -->
<!-- <label class="col-sm-3 control-label">父节点ID</label>-->
<!-- <div class="col-sm-8">-->
<!-- <input name="pId" th:field="*{pId}" class="form-control" type="text">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label">物料类型ID</label>
<div class="col-sm-8">
<select name="materialTypeId" class="form-control m-b">
<option value="">所有</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料ID</label>
<div class="col-sm-8">
<select name="materialId" class="form-control m-b">
<option value="">所有</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">状态标志:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_status_info')}">
<input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
<label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "baseinfo/bominfo";
$("#form-bominfo-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-bominfo-edit').serialize());
}
}
</script>
</body>
</html>

@ -2,6 +2,8 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增设备基础信息')" />
<th:block th:include="include :: jasny-bootstrap-css" />
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -48,6 +50,8 @@
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: jasny-bootstrap-js" />
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
var prefix = ctx + "baseinfo/deviceinfo"
$("#form-deviceinfo-add").validate({

@ -0,0 +1,119 @@
package com.ruoyi.baseinfo.domain;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* BOM base_bom_info
*
* @author CaesarBao
* @date 2020-11-04
*/
@Data
public class BaseBomInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long bomId;
/** 父节点ID */
@Excel(name = "父节点ID")
private Long pId;
/** 物料类型ID */
@Excel(name = "物料类型ID")
private String materialTypeId;
/** 物料ID */
@Excel(name = "物料ID")
private String materialId;
/** 状态标志0代表可用 1代表停用 */
@Excel(name = "状态标志", readConverterExp = "0=代表可用,1=代表停用")
private String status;
/** 删除标志0代表存在 1代表删除 */
private String delFlag;
private String materialTypeName;
private String materialName;
public void setBomId(Long objid)
{
this.bomId = objid;
}
public Long getBomId()
{
return bomId;
}
public void setpId(Long pId)
{
this.pId = pId;
}
public Long getpId()
{
return pId;
}
public void setMaterialTypeId(String materialTypeId)
{
this.materialTypeId = materialTypeId;
}
public String getMaterialTypeId()
{
return materialTypeId;
}
public void setMaterialId(String materialId)
{
this.materialId = materialId;
}
public String getMaterialId()
{
return materialId;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("bomId", getBomId())
.append("pId", getpId())
.append("materialTypeId", getMaterialTypeId())
.append("materialId", getMaterialId())
.append("status", getStatus())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.baseinfo.mapper;
import java.util.List;
import com.ruoyi.baseinfo.domain.BaseBomInfo;
/**
* BOMMapper
*
* @author CaesarBao
* @date 2020-11-04
*/
public interface BaseBomInfoMapper
{
/**
* BOM
*
* @param objid BOMID
* @return BOM
*/
public BaseBomInfo selectBaseBomInfoById(Long objid);
/**
* BOM
*
* @param baseBomInfo BOM
* @return BOM
*/
public List<BaseBomInfo> selectBaseBomInfoList(BaseBomInfo baseBomInfo);
/**
* BOM
*
* @param baseBomInfo BOM
* @return
*/
public int insertBaseBomInfo(BaseBomInfo baseBomInfo);
/**
* BOM
*
* @param baseBomInfo BOM
* @return
*/
public int updateBaseBomInfo(BaseBomInfo baseBomInfo);
/**
* BOM
*
* @param objid BOMID
* @return
*/
public int deleteBaseBomInfoById(Long objid);
/**
* BOM
*
* @param objids ID
* @return
*/
public int deleteBaseBomInfoByIds(String[] objids);
}

@ -0,0 +1,61 @@
package com.ruoyi.baseinfo.service;
import java.util.List;
import com.ruoyi.baseinfo.domain.BaseBomInfo;
/**
* BOMService
*
* @author CaesarBao
* @date 2020-11-04
*/
public interface IBaseBomInfoService
{
/**
* BOM
*
* @param objid BOMID
* @return BOM
*/
public BaseBomInfo selectBaseBomInfoById(Long objid);
/**
* BOM
*
* @param baseBomInfo BOM
* @return BOM
*/
public List<BaseBomInfo> selectBaseBomInfoList(BaseBomInfo baseBomInfo);
/**
* BOM
*
* @param baseBomInfo BOM
* @return
*/
public int insertBaseBomInfo(BaseBomInfo baseBomInfo);
/**
* BOM
*
* @param baseBomInfo BOM
* @return
*/
public int updateBaseBomInfo(BaseBomInfo baseBomInfo);
/**
* BOM
*
* @param ids ID
* @return
*/
public int deleteBaseBomInfoByIds(String ids);
/**
* BOM
*
* @param objid BOMID
* @return
*/
public int deleteBaseBomInfoById(Long objid);
}

@ -0,0 +1,97 @@
package com.ruoyi.baseinfo.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.baseinfo.mapper.BaseBomInfoMapper;
import com.ruoyi.baseinfo.domain.BaseBomInfo;
import com.ruoyi.baseinfo.service.IBaseBomInfoService;
import com.ruoyi.common.core.text.Convert;
/**
* BOMService
*
* @author CaesarBao
* @date 2020-11-04
*/
@Service
public class BaseBomInfoServiceImpl implements IBaseBomInfoService
{
@Autowired
private BaseBomInfoMapper baseBomInfoMapper;
/**
* BOM
*
* @param objid BOMID
* @return BOM
*/
@Override
public BaseBomInfo selectBaseBomInfoById(Long objid)
{
return baseBomInfoMapper.selectBaseBomInfoById(objid);
}
/**
* BOM
*
* @param baseBomInfo BOM
* @return BOM
*/
@Override
public List<BaseBomInfo> selectBaseBomInfoList(BaseBomInfo baseBomInfo)
{
return baseBomInfoMapper.selectBaseBomInfoList(baseBomInfo);
}
/**
* BOM
*
* @param baseBomInfo BOM
* @return
*/
@Override
public int insertBaseBomInfo(BaseBomInfo baseBomInfo)
{
baseBomInfo.setCreateTime(DateUtils.getNowDate());
return baseBomInfoMapper.insertBaseBomInfo(baseBomInfo);
}
/**
* BOM
*
* @param baseBomInfo BOM
* @return
*/
@Override
public int updateBaseBomInfo(BaseBomInfo baseBomInfo)
{
baseBomInfo.setUpdateTime(DateUtils.getNowDate());
return baseBomInfoMapper.updateBaseBomInfo(baseBomInfo);
}
/**
* BOM
*
* @param ids ID
* @return
*/
@Override
public int deleteBaseBomInfoByIds(String ids)
{
return baseBomInfoMapper.deleteBaseBomInfoByIds(Convert.toStrArray(ids));
}
/**
* BOM
*
* @param objid BOMID
* @return
*/
@Override
public int deleteBaseBomInfoById(Long objid)
{
return baseBomInfoMapper.deleteBaseBomInfoById(objid);
}
}

@ -0,0 +1,105 @@
<?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.ruoyi.baseinfo.mapper.BaseBomInfoMapper">
<resultMap type="BaseBomInfo" id="BaseBomInfoResult">
<result property="bomId" column="bom_id" />
<result property="pId" column="p_id" />
<result property="materialTypeId" column="material_type_id" />
<result property="materialId" column="material_id" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<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="delFlag" column="del_flag" />
<result property="materialTypeName" column="material_type_name" />
<result property="materialName" column="material_name" />
</resultMap>
<sql id="selectBaseBomInfoVo">
select bom_id, p_id, material_type_id, material_id, status, remark, create_by, create_time, update_by, update_time, del_flag from base_bom_info
</sql>
<select id="selectBaseBomInfoList" parameterType="BaseBomInfo" resultMap="BaseBomInfoResult">
select t1.bom_id, t1.p_id, t1.material_type_id,t2.material_type_name, t1.material_id,t3.material_name, t1.status, t1.remark, t1.create_by, t1.create_time, t1.update_by, t1.update_time, t1.del_flag from base_bom_info t1
left join dbo.base_materialtype_info t2 on t1.material_type_id = t2.material_type_id
left join dbo.base_material_info t3 on t1.material_id = t3.material_id
<where>
<if test="pId != null and pId != ''"> and p_id = #{pId}</if>
<if test="materialTypeId != null and materialTypeId != ''"> and material_type_id = #{materialTypeId}</if>
<if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectBaseBomInfoById" parameterType="Long" resultMap="BaseBomInfoResult">
select t1.bom_id, t1.p_id, t1.material_type_id,t2.material_type_name, t1.material_id,t3.material_name, t1.status, t1.remark, t1.create_by, t1.create_time, t1.update_by, t1.update_time, t1.del_flag from base_bom_info t1
left join dbo.base_materialtype_info t2 on t1.material_type_id = t2.material_type_id
left join dbo.base_material_info t3 on t1.material_id = t3.material_id
where t1.bom_id = #{bomId}
</select>
<insert id="insertBaseBomInfo" parameterType="BaseBomInfo">
insert into base_bom_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="bomId != null">bom_id,</if>
<if test="pId != null">p_id,</if>
<if test="materialTypeId != null">material_type_id,</if>
<if test="materialId != null">material_id,</if>
<if test="status != null">status,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="bomId != null">#{bom_id},</if>
<if test="pId != null">#{pId},</if>
<if test="materialTypeId != null">#{materialTypeId},</if>
<if test="materialId != null">#{materialId},</if>
<if test="status != null">#{status},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateBaseBomInfo" parameterType="BaseBomInfo">
update base_bom_info
<trim prefix="SET" suffixOverrides=",">
<if test="pId != null">p_id = #{pId},</if>
<if test="materialTypeId != null">material_type_id = #{materialTypeId},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where bom_id = #{bomId}
</update>
<delete id="deleteBaseBomInfoById" parameterType="Long">
delete from base_bom_info where bom_id = #{bomId}
</delete>
<delete id="deleteBaseBomInfoByIds" parameterType="String">
delete from base_bom_info where bom_id in
<foreach item="bomId" collection="array" open="(" separator="," close=")">
#{bomId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save