add - 工序维护
parent
acb0d08999
commit
7064a19957
@ -0,0 +1,103 @@
|
||||
package com.aucma.base.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.aucma.common.utils.DateUtils;
|
||||
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.aucma.common.annotation.Log;
|
||||
import com.aucma.common.core.controller.BaseController;
|
||||
import com.aucma.common.core.domain.AjaxResult;
|
||||
import com.aucma.common.enums.BusinessType;
|
||||
import com.aucma.base.domain.BaseProcessStation;
|
||||
import com.aucma.base.service.IBaseProcessStationService;
|
||||
import com.aucma.common.utils.poi.ExcelUtil;
|
||||
import com.aucma.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 生产工序/工位信息Controller
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2023-11-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/base/processStation" )
|
||||
public class BaseProcessStationController extends BaseController {
|
||||
@Autowired
|
||||
private IBaseProcessStationService baseProcessStationService;
|
||||
|
||||
/**
|
||||
* 查询生产工序/工位信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:processStation:list')" )
|
||||
@GetMapping("/list" )
|
||||
public TableDataInfo list(BaseProcessStation baseProcessStation) {
|
||||
startPage();
|
||||
List<BaseProcessStation> list = baseProcessStationService.selectBaseProcessStationList(baseProcessStation);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出生产工序/工位信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:processStation:export')" )
|
||||
@Log(title = "生产工序/工位信息" , businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export" )
|
||||
public void export(HttpServletResponse response, BaseProcessStation baseProcessStation) {
|
||||
List<BaseProcessStation> list = baseProcessStationService.selectBaseProcessStationList(baseProcessStation);
|
||||
ExcelUtil<BaseProcessStation> util = new ExcelUtil<BaseProcessStation>(BaseProcessStation. class);
|
||||
util.exportExcel(response, list, "生产工序/工位信息数据" );
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取生产工序/工位信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:processStation:query')" )
|
||||
@GetMapping(value = "/{objId}" )
|
||||
public AjaxResult getInfo(@PathVariable("objId" ) Long objId) {
|
||||
return success(baseProcessStationService.selectBaseProcessStationByObjId(objId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产工序/工位信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:processStation:add')" )
|
||||
@Log(title = "生产工序/工位信息" , businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BaseProcessStation baseProcessStation) {
|
||||
baseProcessStation.setCreatedBy(getUsername());
|
||||
baseProcessStation.setCreatedTime(DateUtils.getNowDate());
|
||||
return toAjax(baseProcessStationService.insertBaseProcessStation(baseProcessStation));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改生产工序/工位信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:processStation:edit')" )
|
||||
@Log(title = "生产工序/工位信息" , businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BaseProcessStation baseProcessStation) {
|
||||
baseProcessStation.setUpdatedBy(getUsername());
|
||||
baseProcessStation.setUpdatedTime(DateUtils.getNowDate());
|
||||
return toAjax(baseProcessStationService.updateBaseProcessStation(baseProcessStation));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除生产工序/工位信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:processStation:remove')" )
|
||||
@Log(title = "生产工序/工位信息" , businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{objIds}" )
|
||||
public AjaxResult remove(@PathVariable Long[] objIds) {
|
||||
return toAjax(baseProcessStationService.deleteBaseProcessStationByObjIds(objIds));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.aucma.base.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.aucma.base.domain.BaseProcessStation;
|
||||
|
||||
/**
|
||||
* 生产工序/工位信息Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2023-11-14
|
||||
*/
|
||||
public interface BaseProcessStationMapper {
|
||||
/**
|
||||
* 查询生产工序/工位信息
|
||||
*
|
||||
* @param objId 生产工序/工位信息主键
|
||||
* @return 生产工序/工位信息
|
||||
*/
|
||||
public BaseProcessStation selectBaseProcessStationByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询生产工序/工位信息列表
|
||||
*
|
||||
* @param baseProcessStation 生产工序/工位信息
|
||||
* @return 生产工序/工位信息集合
|
||||
*/
|
||||
public List<BaseProcessStation> selectBaseProcessStationList(BaseProcessStation baseProcessStation);
|
||||
|
||||
/**
|
||||
* 新增生产工序/工位信息
|
||||
*
|
||||
* @param baseProcessStation 生产工序/工位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseProcessStation(BaseProcessStation baseProcessStation);
|
||||
|
||||
/**
|
||||
* 修改生产工序/工位信息
|
||||
*
|
||||
* @param baseProcessStation 生产工序/工位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseProcessStation(BaseProcessStation baseProcessStation);
|
||||
|
||||
/**
|
||||
* 删除生产工序/工位信息
|
||||
*
|
||||
* @param objId 生产工序/工位信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseProcessStationByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 批量删除生产工序/工位信息
|
||||
*
|
||||
* @param objIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseProcessStationByObjIds(Long[] objIds);
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.aucma.base.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.aucma.base.domain.BaseProcessStation;
|
||||
|
||||
/**
|
||||
* 生产工序/工位信息Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2023-11-14
|
||||
*/
|
||||
public interface IBaseProcessStationService
|
||||
{
|
||||
/**
|
||||
* 查询生产工序/工位信息
|
||||
*
|
||||
* @param objId 生产工序/工位信息主键
|
||||
* @return 生产工序/工位信息
|
||||
*/
|
||||
public BaseProcessStation selectBaseProcessStationByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询生产工序/工位信息列表
|
||||
*
|
||||
* @param baseProcessStation 生产工序/工位信息
|
||||
* @return 生产工序/工位信息集合
|
||||
*/
|
||||
public List<BaseProcessStation> selectBaseProcessStationList(BaseProcessStation baseProcessStation);
|
||||
|
||||
/**
|
||||
* 新增生产工序/工位信息
|
||||
*
|
||||
* @param baseProcessStation 生产工序/工位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseProcessStation(BaseProcessStation baseProcessStation);
|
||||
|
||||
/**
|
||||
* 修改生产工序/工位信息
|
||||
*
|
||||
* @param baseProcessStation 生产工序/工位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseProcessStation(BaseProcessStation baseProcessStation);
|
||||
|
||||
/**
|
||||
* 批量删除生产工序/工位信息
|
||||
*
|
||||
* @param objIds 需要删除的生产工序/工位信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseProcessStationByObjIds(Long[] objIds);
|
||||
|
||||
/**
|
||||
* 删除生产工序/工位信息信息
|
||||
*
|
||||
* @param objId 生产工序/工位信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseProcessStationByObjId(Long objId);
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.aucma.base.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.aucma.base.mapper.BaseProcessStationMapper;
|
||||
import com.aucma.base.domain.BaseProcessStation;
|
||||
import com.aucma.base.service.IBaseProcessStationService;
|
||||
|
||||
/**
|
||||
* 生产工序/工位信息Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2023-11-14
|
||||
*/
|
||||
@Service
|
||||
public class BaseProcessStationServiceImpl implements IBaseProcessStationService
|
||||
{
|
||||
@Autowired
|
||||
private BaseProcessStationMapper baseProcessStationMapper;
|
||||
|
||||
/**
|
||||
* 查询生产工序/工位信息
|
||||
*
|
||||
* @param objId 生产工序/工位信息主键
|
||||
* @return 生产工序/工位信息
|
||||
*/
|
||||
@Override
|
||||
public BaseProcessStation selectBaseProcessStationByObjId(Long objId)
|
||||
{
|
||||
return baseProcessStationMapper.selectBaseProcessStationByObjId(objId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询生产工序/工位信息列表
|
||||
*
|
||||
* @param baseProcessStation 生产工序/工位信息
|
||||
* @return 生产工序/工位信息
|
||||
*/
|
||||
@Override
|
||||
public List<BaseProcessStation> selectBaseProcessStationList(BaseProcessStation baseProcessStation)
|
||||
{
|
||||
return baseProcessStationMapper.selectBaseProcessStationList(baseProcessStation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产工序/工位信息
|
||||
*
|
||||
* @param baseProcessStation 生产工序/工位信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBaseProcessStation(BaseProcessStation baseProcessStation)
|
||||
{
|
||||
return baseProcessStationMapper.insertBaseProcessStation(baseProcessStation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改生产工序/工位信息
|
||||
*
|
||||
* @param baseProcessStation 生产工序/工位信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBaseProcessStation(BaseProcessStation baseProcessStation)
|
||||
{
|
||||
return baseProcessStationMapper.updateBaseProcessStation(baseProcessStation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除生产工序/工位信息
|
||||
*
|
||||
* @param objIds 需要删除的生产工序/工位信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseProcessStationByObjIds(Long[] objIds)
|
||||
{
|
||||
return baseProcessStationMapper.deleteBaseProcessStationByObjIds(objIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除生产工序/工位信息信息
|
||||
*
|
||||
* @param objId 生产工序/工位信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseProcessStationByObjId(Long objId)
|
||||
{
|
||||
return baseProcessStationMapper.deleteBaseProcessStationByObjId(objId);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,156 @@
|
||||
<?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.aucma.base.mapper.BaseProcessStationMapper">
|
||||
|
||||
<resultMap type="BaseProcessStation" id="BaseProcessStationResult">
|
||||
<result property="objId" column="obj_id"/>
|
||||
<result property="processCode" column="process_code"/>
|
||||
<result property="processName" column="process_name"/>
|
||||
<result property="processType" column="process_type"/>
|
||||
<result property="productLineCode" column="product_line_code"/>
|
||||
<result property="productionTime" column="production_time"/>
|
||||
<result property="capacityDay" column="capacity_day"/>
|
||||
<result property="capacityMonth" column="capacity_month"/>
|
||||
<result property="isFlag" column="is_flag"/>
|
||||
<result property="createdBy" column="created_by"/>
|
||||
<result property="createdTime" column="created_time"/>
|
||||
<result property="updatedBy" column="updated_by"/>
|
||||
<result property="updatedTime" column="updated_time"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="stationName" column="stationName"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBaseProcessStationVo">
|
||||
select bps.obj_id,
|
||||
bps.process_code,
|
||||
bps.process_name,
|
||||
bps.process_type,
|
||||
bps.product_line_code,
|
||||
bps.production_time,
|
||||
bps.capacity_day,
|
||||
bps.capacity_month,
|
||||
bps.is_flag,
|
||||
bps.created_by,
|
||||
bps.created_time,
|
||||
bps.updated_by,
|
||||
bps.updated_time,
|
||||
bps.parent_id,
|
||||
st.station_name stationName
|
||||
from base_process_station bps
|
||||
LEFT JOIN (
|
||||
SELECT ST.PROCESS_CODE,
|
||||
LISTAGG(ST.STATION_CODE, ',') WITHIN GROUP (ORDER BY ST.PROCESS_CODE) AS station_code,
|
||||
LISTAGG(PL.PRODUCT_LINE_NAME, ',') WITHIN GROUP (ORDER BY ST.PROCESS_CODE) AS station_name
|
||||
FROM (SELECT PROCESS_CODE,
|
||||
TRIM(REGEXP_SUBSTR(PARENT_ID, '[^,]+', 1, LEVEL)) AS station_code
|
||||
FROM BASE_PROCESS_STATION
|
||||
CONNECT BY PRIOR PROCESS_CODE = PROCESS_CODE
|
||||
AND PRIOR DBMS_RANDOM.VALUE IS NOT NULL
|
||||
AND LENGTH(REGEXP_REPLACE(PARENT_ID, '[^,]+')) + 1 >= LEVEL
|
||||
ORDER BY PROCESS_CODE, LEVEL) ST
|
||||
LEFT JOIN BASE_PRODUCTLINE PL ON pl.PRODUCT_LINE_CODE = st.station_code
|
||||
GROUP BY ST.PROCESS_CODE
|
||||
) st ON st.PROCESS_CODE = bps.PROCESS_CODE
|
||||
</sql>
|
||||
|
||||
<select id="selectBaseProcessStationList" parameterType="BaseProcessStation" resultMap="BaseProcessStationResult">
|
||||
<include refid="selectBaseProcessStationVo"/>
|
||||
<where>
|
||||
<if test="processCode != null and processCode != ''">and bps.process_code = #{processCode}</if>
|
||||
<if test="processName != null and processName != ''">and bps.process_name like concat(concat('%',
|
||||
#{processName}), '%')
|
||||
</if>
|
||||
<if test="processType != null ">and bps.process_type = #{processType}</if>
|
||||
<if test="productLineCode != null and productLineCode != ''">and bps.product_line_code = #{productLineCode}
|
||||
</if>
|
||||
<if test="productionTime != null ">and bps.production_time = #{productionTime}</if>
|
||||
<if test="capacityDay != null ">and capacity_day = #{capacityDay}</if>
|
||||
<if test="capacityMonth != null ">and capacity_month = #{capacityMonth}</if>
|
||||
<if test="isFlag != null ">and is_flag = #{isFlag}</if>
|
||||
<if test="createdBy != null and createdBy != ''">and created_by = #{createdBy}</if>
|
||||
<if test="createdTime != null ">and created_time = #{createdTime}</if>
|
||||
<if test="updatedBy != null and updatedBy != ''">and updated_by = #{updatedBy}</if>
|
||||
<if test="updatedTime != null ">and updated_time = #{updatedTime}</if>
|
||||
<if test="parentId != null and parentId != ''">and bps.parent_id = #{parentId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBaseProcessStationByObjId" parameterType="Long" resultMap="BaseProcessStationResult">
|
||||
<include refid="selectBaseProcessStationVo"/>
|
||||
where bps.obj_id = #{objId}
|
||||
</select>
|
||||
|
||||
<insert id="insertBaseProcessStation" parameterType="BaseProcessStation">
|
||||
<selectKey keyProperty="objId" resultType="long" order="BEFORE">
|
||||
SELECT seq_base_process_station.NEXTVAL as objId FROM DUAL
|
||||
</selectKey>
|
||||
insert into base_process_station
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="objId != null">obj_id,</if>
|
||||
<if test="processCode != null">process_code,</if>
|
||||
<if test="processName != null">process_name,</if>
|
||||
<if test="processType != null">process_type,</if>
|
||||
<if test="productLineCode != null">product_line_code,</if>
|
||||
<if test="productionTime != null">production_time,</if>
|
||||
<if test="capacityDay != null">capacity_day,</if>
|
||||
<if test="capacityMonth != null">capacity_month,</if>
|
||||
<if test="isFlag != null">is_flag,</if>
|
||||
<if test="createdBy != null">created_by,</if>
|
||||
<if test="createdTime != null">created_time,</if>
|
||||
<if test="updatedBy != null">updated_by,</if>
|
||||
<if test="updatedTime != null">updated_time,</if>
|
||||
<if test="parentId != null">parent_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="objId != null">#{objId},</if>
|
||||
<if test="processCode != null">#{processCode},</if>
|
||||
<if test="processName != null">#{processName},</if>
|
||||
<if test="processType != null">#{processType},</if>
|
||||
<if test="productLineCode != null">#{productLineCode},</if>
|
||||
<if test="productionTime != null">#{productionTime},</if>
|
||||
<if test="capacityDay != null">#{capacityDay},</if>
|
||||
<if test="capacityMonth != null">#{capacityMonth},</if>
|
||||
<if test="isFlag != null">#{isFlag},</if>
|
||||
<if test="createdBy != null">#{createdBy},</if>
|
||||
<if test="createdTime != null">#{createdTime},</if>
|
||||
<if test="updatedBy != null">#{updatedBy},</if>
|
||||
<if test="updatedTime != null">#{updatedTime},</if>
|
||||
<if test="parentId != null">#{parentId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBaseProcessStation" parameterType="BaseProcessStation">
|
||||
update base_process_station
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="processCode != null">process_code = #{processCode},</if>
|
||||
<if test="processName != null">process_name = #{processName},</if>
|
||||
<if test="processType != null">process_type = #{processType},</if>
|
||||
<if test="productLineCode != null">product_line_code = #{productLineCode},</if>
|
||||
<if test="productionTime != null">production_time = #{productionTime},</if>
|
||||
<if test="capacityDay != null">capacity_day = #{capacityDay},</if>
|
||||
<if test="capacityMonth != null">capacity_month = #{capacityMonth},</if>
|
||||
<if test="isFlag != null">is_flag = #{isFlag},</if>
|
||||
<if test="createdBy != null">created_by = #{createdBy},</if>
|
||||
<if test="createdTime != null">created_time = #{createdTime},</if>
|
||||
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
|
||||
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
|
||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||
</trim>
|
||||
where obj_id = #{objId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBaseProcessStationByObjId" parameterType="Long">
|
||||
delete
|
||||
from base_process_station
|
||||
where obj_id = #{objId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBaseProcessStationByObjIds" parameterType="String">
|
||||
delete from base_process_station where obj_id in
|
||||
<foreach item="objId" collection="array" open="(" separator="," close=")">
|
||||
#{objId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue