开发BOM管理
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;
|
||||
|
||||
/**
|
||||
* BOM基础信息Controller
|
||||
*
|
||||
* @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,61 @@
|
||||
package com.ruoyi.baseinfo.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.baseinfo.domain.BaseBomInfo;
|
||||
|
||||
/**
|
||||
* BOM基础信息Mapper接口
|
||||
*
|
||||
* @author CaesarBao
|
||||
* @date 2020-11-04
|
||||
*/
|
||||
public interface BaseBomInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询BOM基础信息
|
||||
*
|
||||
* @param objid BOM基础信息ID
|
||||
* @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 BOM基础信息ID
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* BOM基础信息Service接口
|
||||
*
|
||||
* @author CaesarBao
|
||||
* @date 2020-11-04
|
||||
*/
|
||||
public interface IBaseBomInfoService
|
||||
{
|
||||
/**
|
||||
* 查询BOM基础信息
|
||||
*
|
||||
* @param objid BOM基础信息ID
|
||||
* @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 BOM基础信息ID
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* BOM基础信息Service业务层处理
|
||||
*
|
||||
* @author CaesarBao
|
||||
* @date 2020-11-04
|
||||
*/
|
||||
@Service
|
||||
public class BaseBomInfoServiceImpl implements IBaseBomInfoService
|
||||
{
|
||||
@Autowired
|
||||
private BaseBomInfoMapper baseBomInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询BOM基础信息
|
||||
*
|
||||
* @param objid BOM基础信息ID
|
||||
* @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 BOM基础信息ID
|
||||
* @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>
|
||||
Binary file not shown.
Loading…
Reference in New Issue