change - add产线、工位
parent
3d49b9774d
commit
72f5419739
@ -0,0 +1,116 @@
|
||||
package com.os.mes.base.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
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.os.common.annotation.Log;
|
||||
import com.os.common.core.controller.BaseController;
|
||||
import com.os.common.core.domain.AjaxResult;
|
||||
import com.os.common.enums.BusinessType;
|
||||
import com.os.mes.base.domain.BaseProductLine;
|
||||
import com.os.mes.base.service.IBaseProductLineService;
|
||||
import com.os.common.utils.poi.ExcelUtil;
|
||||
import com.os.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 产线/工位信息Controller
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-05-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/mes/base/baseProductLine")
|
||||
public class BaseProductLineController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBaseProductLineService baseProductLineService;
|
||||
|
||||
/**
|
||||
* 查询产线/工位信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes/base:baseProductLine:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BaseProductLine baseProductLine)
|
||||
{
|
||||
startPage();
|
||||
List<BaseProductLine> list = baseProductLineService.selectBaseProductLineList(baseProductLine);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产线/工位信息下拉框列表
|
||||
*/
|
||||
@GetMapping("/getBaseProductLineList")
|
||||
public AjaxResult getBaseProductLineList(BaseProductLine baseProductLine)
|
||||
{
|
||||
List<BaseProductLine> list = baseProductLineService.selectBaseProductLineList(baseProductLine);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出产线/工位信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes/base:baseProductLine:export')")
|
||||
@Log(title = "产线/工位信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BaseProductLine baseProductLine)
|
||||
{
|
||||
List<BaseProductLine> list = baseProductLineService.selectBaseProductLineList(baseProductLine);
|
||||
ExcelUtil<BaseProductLine> util = new ExcelUtil<BaseProductLine>(BaseProductLine.class);
|
||||
util.exportExcel(response, list, "产线/工位信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产线/工位信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes/base:baseProductLine:query')")
|
||||
@GetMapping(value = "/{objId}")
|
||||
public AjaxResult getInfo(@PathVariable("objId") Long objId)
|
||||
{
|
||||
return success(baseProductLineService.selectBaseProductLineByObjId(objId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产线/工位信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes/base:baseProductLine:add')")
|
||||
@Log(title = "产线/工位信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BaseProductLine baseProductLine)
|
||||
{
|
||||
baseProductLine.setCreateBy(getUsername());
|
||||
return toAjax(baseProductLineService.insertBaseProductLine(baseProductLine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产线/工位信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes/base:baseProductLine:edit')")
|
||||
@Log(title = "产线/工位信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BaseProductLine baseProductLine)
|
||||
{
|
||||
baseProductLine.setUpdateBy(getUsername());
|
||||
return toAjax(baseProductLineService.updateBaseProductLine(baseProductLine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产线/工位信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes/base:baseProductLine:remove')")
|
||||
@Log(title = "产线/工位信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{objIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] objIds)
|
||||
{
|
||||
return toAjax(baseProductLineService.deleteBaseProductLineByObjIds(objIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.os.mes.base.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.os.mes.base.domain.BaseProductLine;
|
||||
|
||||
/**
|
||||
* 产线/工位信息Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-05-10
|
||||
*/
|
||||
public interface BaseProductLineMapper
|
||||
{
|
||||
/**
|
||||
* 查询产线/工位信息
|
||||
*
|
||||
* @param objId 产线/工位信息主键
|
||||
* @return 产线/工位信息
|
||||
*/
|
||||
public BaseProductLine selectBaseProductLineByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询产线/工位信息列表
|
||||
*
|
||||
* @param baseProductLine 产线/工位信息
|
||||
* @return 产线/工位信息集合
|
||||
*/
|
||||
public List<BaseProductLine> selectBaseProductLineList(BaseProductLine baseProductLine);
|
||||
|
||||
/**
|
||||
* 新增产线/工位信息
|
||||
*
|
||||
* @param baseProductLine 产线/工位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseProductLine(BaseProductLine baseProductLine);
|
||||
|
||||
/**
|
||||
* 修改产线/工位信息
|
||||
*
|
||||
* @param baseProductLine 产线/工位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseProductLine(BaseProductLine baseProductLine);
|
||||
|
||||
/**
|
||||
* 删除产线/工位信息
|
||||
*
|
||||
* @param objId 产线/工位信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseProductLineByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 批量删除产线/工位信息
|
||||
*
|
||||
* @param objIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseProductLineByObjIds(Long[] objIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.os.mes.base.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.os.mes.base.domain.BaseProductLine;
|
||||
|
||||
/**
|
||||
* 产线/工位信息Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-05-10
|
||||
*/
|
||||
public interface IBaseProductLineService
|
||||
{
|
||||
/**
|
||||
* 查询产线/工位信息
|
||||
*
|
||||
* @param objId 产线/工位信息主键
|
||||
* @return 产线/工位信息
|
||||
*/
|
||||
public BaseProductLine selectBaseProductLineByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询产线/工位信息列表
|
||||
*
|
||||
* @param baseProductLine 产线/工位信息
|
||||
* @return 产线/工位信息集合
|
||||
*/
|
||||
public List<BaseProductLine> selectBaseProductLineList(BaseProductLine baseProductLine);
|
||||
|
||||
/**
|
||||
* 新增产线/工位信息
|
||||
*
|
||||
* @param baseProductLine 产线/工位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseProductLine(BaseProductLine baseProductLine);
|
||||
|
||||
/**
|
||||
* 修改产线/工位信息
|
||||
*
|
||||
* @param baseProductLine 产线/工位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseProductLine(BaseProductLine baseProductLine);
|
||||
|
||||
/**
|
||||
* 批量删除产线/工位信息
|
||||
*
|
||||
* @param objIds 需要删除的产线/工位信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseProductLineByObjIds(Long[] objIds);
|
||||
|
||||
/**
|
||||
* 删除产线/工位信息信息
|
||||
*
|
||||
* @param objId 产线/工位信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseProductLineByObjId(Long objId);
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package com.os.mes.base.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.os.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.os.mes.base.mapper.BaseProductLineMapper;
|
||||
import com.os.mes.base.domain.BaseProductLine;
|
||||
import com.os.mes.base.service.IBaseProductLineService;
|
||||
|
||||
/**
|
||||
* 产线/工位信息Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-05-10
|
||||
*/
|
||||
@Service
|
||||
public class BaseProductLineServiceImpl implements IBaseProductLineService
|
||||
{
|
||||
@Autowired
|
||||
private BaseProductLineMapper baseProductLineMapper;
|
||||
|
||||
/**
|
||||
* 查询产线/工位信息
|
||||
*
|
||||
* @param objId 产线/工位信息主键
|
||||
* @return 产线/工位信息
|
||||
*/
|
||||
@Override
|
||||
public BaseProductLine selectBaseProductLineByObjId(Long objId)
|
||||
{
|
||||
return baseProductLineMapper.selectBaseProductLineByObjId(objId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产线/工位信息列表
|
||||
*
|
||||
* @param baseProductLine 产线/工位信息
|
||||
* @return 产线/工位信息
|
||||
*/
|
||||
@Override
|
||||
public List<BaseProductLine> selectBaseProductLineList(BaseProductLine baseProductLine)
|
||||
{
|
||||
return baseProductLineMapper.selectBaseProductLineList(baseProductLine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产线/工位信息
|
||||
*
|
||||
* @param baseProductLine 产线/工位信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBaseProductLine(BaseProductLine baseProductLine)
|
||||
{
|
||||
baseProductLine.setCreateTime(DateUtils.getNowDate());
|
||||
return baseProductLineMapper.insertBaseProductLine(baseProductLine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产线/工位信息
|
||||
*
|
||||
* @param baseProductLine 产线/工位信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBaseProductLine(BaseProductLine baseProductLine)
|
||||
{
|
||||
baseProductLine.setUpdateTime(DateUtils.getNowDate());
|
||||
return baseProductLineMapper.updateBaseProductLine(baseProductLine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除产线/工位信息
|
||||
*
|
||||
* @param objIds 需要删除的产线/工位信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseProductLineByObjIds(Long[] objIds)
|
||||
{
|
||||
return baseProductLineMapper.deleteBaseProductLineByObjIds(objIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产线/工位信息信息
|
||||
*
|
||||
* @param objId 产线/工位信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseProductLineByObjId(Long objId)
|
||||
{
|
||||
return baseProductLineMapper.deleteBaseProductLineByObjId(objId);
|
||||
}
|
||||
}
|
@ -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.os.mes.base.mapper.BaseProductLineMapper">
|
||||
|
||||
<resultMap type="BaseProductLine" id="BaseProductLineResult">
|
||||
<result property="objId" column="obj_id"/>
|
||||
<result property="productLineCode" column="product_line_code"/>
|
||||
<result property="productLineName" column="product_line_name"/>
|
||||
<result property="stationCode" column="station_code"/>
|
||||
<result property="stationName" column="station_name"/>
|
||||
<result property="productLineType" column="product_line_type"/>
|
||||
<result property="plantCode" column="plant_code"/>
|
||||
<result property="factoryName" column="factory_name"/>
|
||||
<result property="isFlag" column="is_flag"/>
|
||||
<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="parentId" column="parent_id"/>
|
||||
<result property="stationType" column="station_type"/>
|
||||
<result property="workCenterCode" column="work_center_code"/>
|
||||
<result property="workCenterName" column="work_center_name"/>
|
||||
<result property="executionSort" column="execution_sort"/>
|
||||
<result property="capacityDay" column="capacity_day"/>
|
||||
<result property="capacityMonth" column="capacity_month"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBaseProductLineVo">
|
||||
select pl1.obj_id,
|
||||
pl1.product_line_code,
|
||||
pl1.product_line_name,
|
||||
pl2.product_line_code station_code,
|
||||
pl2.product_line_name station_name,
|
||||
pl1.product_line_type,
|
||||
pl1.plant_code,
|
||||
bf.factory_name,
|
||||
pl1.is_flag,
|
||||
pl1.create_by,
|
||||
pl1.create_time,
|
||||
pl1.update_by,
|
||||
pl1.update_time,
|
||||
pl1.parent_id,
|
||||
pl1.station_type,
|
||||
pl1.work_center_code,
|
||||
pl1.work_center_name,
|
||||
pl1.execution_sort,
|
||||
pl1.capacity_day,
|
||||
pl1.capacity_month
|
||||
from base_product_line pl1
|
||||
left join base_product_line pl2 on pl2.product_line_code = pl1.parent_id
|
||||
left join base_factory bf on bf.factory_code = pl1.plant_code
|
||||
</sql>
|
||||
|
||||
<select id="selectBaseProductLineList" parameterType="BaseProductLine" resultMap="BaseProductLineResult">
|
||||
<include refid="selectBaseProductLineVo"/>
|
||||
<where>
|
||||
<if test="productLineCode != null and productLineCode != ''">and pl1.product_line_code = #{productLineCode}
|
||||
</if>
|
||||
<if test="productLineName != null and productLineName != ''">and pl1.product_line_name like concat('%',
|
||||
#{productLineName}, '%')
|
||||
</if>
|
||||
<if test="productLineType != null and productLineType != ''">and pl1.product_line_type = #{productLineType}
|
||||
</if>
|
||||
<if test="plantCode != null and plantCode != ''">and pl1.plant_code = #{plantCode}</if>
|
||||
<if test="isFlag != null and isFlag != ''">and pl1.is_flag = #{isFlag}</if>
|
||||
<if test="createBy != null and createBy != ''">and pl1.create_by = #{createBy}</if>
|
||||
<if test="createTime != null ">and pl1.create_time = #{createTime}</if>
|
||||
<if test="updateBy != null and updateBy != ''">and pl1.update_by = #{updateBy}</if>
|
||||
<if test="updateTime != null ">and pl1.update_time = #{updateTime}</if>
|
||||
<if test="parentId != null and parentId != ''">and pl1.parent_id = #{parentId}</if>
|
||||
<if test="stationType != null and stationType != ''">and pl1.station_type = #{stationType}</if>
|
||||
<if test="workCenterCode != null and workCenterCode != ''">and pl1.work_center_code = #{workCenterCode}</if>
|
||||
<if test="workCenterName != null and workCenterName != ''">and pl1.work_center_name like concat('%',
|
||||
#{workCenterName}, '%')
|
||||
</if>
|
||||
<if test="executionSort != null and executionSort != ''">and pl1.execution_sort = #{executionSort}</if>
|
||||
<if test="capacityDay != null ">and pl1.capacity_day = #{capacityDay}</if>
|
||||
<if test="capacityMonth != null ">and pl1.capacity_month = #{capacityMonth}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBaseProductLineByObjId" parameterType="Long" resultMap="BaseProductLineResult">
|
||||
<include refid="selectBaseProductLineVo"/>
|
||||
where pl1.obj_id = #{objId}
|
||||
</select>
|
||||
|
||||
<insert id="insertBaseProductLine" parameterType="BaseProductLine" useGeneratedKeys="true" keyProperty="objId">
|
||||
insert into base_product_line
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="productLineCode != null">product_line_code,</if>
|
||||
<if test="productLineName != null">product_line_name,</if>
|
||||
<if test="productLineType != null">product_line_type,</if>
|
||||
<if test="plantCode != null">plant_code,</if>
|
||||
<if test="isFlag != null">is_flag,</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="parentId != null">parent_id,</if>
|
||||
<if test="stationType != null">station_type,</if>
|
||||
<if test="workCenterCode != null">work_center_code,</if>
|
||||
<if test="workCenterName != null">work_center_name,</if>
|
||||
<if test="executionSort != null">execution_sort,</if>
|
||||
<if test="capacityDay != null">capacity_day,</if>
|
||||
<if test="capacityMonth != null">capacity_month,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="productLineCode != null">#{productLineCode},</if>
|
||||
<if test="productLineName != null">#{productLineName},</if>
|
||||
<if test="productLineType != null">#{productLineType},</if>
|
||||
<if test="plantCode != null">#{plantCode},</if>
|
||||
<if test="isFlag != null">#{isFlag},</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="parentId != null">#{parentId},</if>
|
||||
<if test="stationType != null">#{stationType},</if>
|
||||
<if test="workCenterCode != null">#{workCenterCode},</if>
|
||||
<if test="workCenterName != null">#{workCenterName},</if>
|
||||
<if test="executionSort != null">#{executionSort},</if>
|
||||
<if test="capacityDay != null">#{capacityDay},</if>
|
||||
<if test="capacityMonth != null">#{capacityMonth},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBaseProductLine" parameterType="BaseProductLine">
|
||||
update base_product_line
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="productLineCode != null">product_line_code = #{productLineCode},</if>
|
||||
<if test="productLineName != null">product_line_name = #{productLineName},</if>
|
||||
<if test="productLineType != null">product_line_type = #{productLineType},</if>
|
||||
<if test="plantCode != null">plant_code = #{plantCode},</if>
|
||||
<if test="isFlag != null">is_flag = #{isFlag},</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="parentId != null">parent_id = #{parentId},</if>
|
||||
<if test="stationType != null">station_type = #{stationType},</if>
|
||||
<if test="workCenterCode != null">work_center_code = #{workCenterCode},</if>
|
||||
<if test="workCenterName != null">work_center_name = #{workCenterName},</if>
|
||||
<if test="executionSort != null">execution_sort = #{executionSort},</if>
|
||||
<if test="capacityDay != null">capacity_day = #{capacityDay},</if>
|
||||
<if test="capacityMonth != null">capacity_month = #{capacityMonth},</if>
|
||||
</trim>
|
||||
where obj_id = #{objId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBaseProductLineByObjId" parameterType="Long">
|
||||
delete
|
||||
from base_product_line
|
||||
where obj_id = #{objId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBaseProductLineByObjIds" parameterType="String">
|
||||
delete from base_product_line where obj_id in
|
||||
<foreach item="objId" collection="array" open="(" separator="," close=")">
|
||||
#{objId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue