SOP后台代码

This commit is contained in:
JinLu.Yin 2022-07-26 15:48:45 +08:00
parent 1f31f62394
commit af7f5bcf33
6 changed files with 655 additions and 0 deletions

View File

@ -0,0 +1,104 @@
package com.ktg.mes.md.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.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.md.domain.MdProdutSop;
import com.ktg.mes.md.service.IMdProdutSopService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* 产品SOPController
*
* @author yinjinlu
* @date 2022-07-26
*/
@RestController
@RequestMapping("/mes/md/sop")
public class MdProdutSopController extends BaseController
{
@Autowired
private IMdProdutSopService mdProdutSopService;
/**
* 查询产品SOP列表
*/
@PreAuthorize("@ss.hasPermi('mes:md:sop:list')")
@GetMapping("/list")
public TableDataInfo list(MdProdutSop mdProdutSop)
{
startPage();
List<MdProdutSop> list = mdProdutSopService.selectMdProdutSopList(mdProdutSop);
return getDataTable(list);
}
/**
* 导出产品SOP列表
*/
@PreAuthorize("@ss.hasPermi('mes:md:sop:export')")
@Log(title = "产品SOP", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MdProdutSop mdProdutSop)
{
List<MdProdutSop> list = mdProdutSopService.selectMdProdutSopList(mdProdutSop);
ExcelUtil<MdProdutSop> util = new ExcelUtil<MdProdutSop>(MdProdutSop.class);
util.exportExcel(response, list, "产品SOP数据");
}
/**
* 获取产品SOP详细信息
*/
@PreAuthorize("@ss.hasPermi('mes:md:sop:query')")
@GetMapping(value = "/{sopId}")
public AjaxResult getInfo(@PathVariable("sopId") Long sopId)
{
return AjaxResult.success(mdProdutSopService.selectMdProdutSopBySopId(sopId));
}
/**
* 新增产品SOP
*/
@PreAuthorize("@ss.hasPermi('mes:md:sop:add')")
@Log(title = "产品SOP", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MdProdutSop mdProdutSop)
{
return toAjax(mdProdutSopService.insertMdProdutSop(mdProdutSop));
}
/**
* 修改产品SOP
*/
@PreAuthorize("@ss.hasPermi('mes:md:sop:edit')")
@Log(title = "产品SOP", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MdProdutSop mdProdutSop)
{
return toAjax(mdProdutSopService.updateMdProdutSop(mdProdutSop));
}
/**
* 删除产品SOP
*/
@PreAuthorize("@ss.hasPermi('mes:md:sop:remove')")
@Log(title = "产品SOP", businessType = BusinessType.DELETE)
@DeleteMapping("/{sopIds}")
public AjaxResult remove(@PathVariable Long[] sopIds)
{
return toAjax(mdProdutSopService.deleteMdProdutSopBySopIds(sopIds));
}
}

View File

@ -0,0 +1,206 @@
package com.ktg.mes.md.domain;
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;
/**
* 产品SOP对象 md_produt_sop
*
* @author yinjinlu
* @date 2022-07-26
*/
public class MdProdutSop extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 记录ID */
private Long sopId;
/** 物料产品ID */
@Excel(name = "物料产品ID")
private Long itemId;
/** 排列顺序 */
@Excel(name = "排列顺序")
private Integer orderNum;
/** 对应的工序 */
@Excel(name = "对应的工序")
private Long processId;
/** 工序编号 */
@Excel(name = "工序编号")
private String processCode;
/** 工序名称 */
@Excel(name = "工序名称")
private String processName;
/** 标题 */
@Excel(name = "标题")
private String sopTitle;
/** 详细描述 */
@Excel(name = "详细描述")
private String sopDescription;
/** 图片地址 */
@Excel(name = "图片地址")
private String sopUrl;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private Long attr3;
/** 预留字段4 */
private Long attr4;
public void setSopId(Long sopId)
{
this.sopId = sopId;
}
public Long getSopId()
{
return sopId;
}
public void setItemId(Long itemId)
{
this.itemId = itemId;
}
public Long getItemId()
{
return itemId;
}
public void setOrderNum(Integer orderNum)
{
this.orderNum = orderNum;
}
public Integer getOrderNum()
{
return orderNum;
}
public void setProcessId(Long processId)
{
this.processId = processId;
}
public Long getProcessId()
{
return processId;
}
public void setProcessCode(String processCode)
{
this.processCode = processCode;
}
public String getProcessCode()
{
return processCode;
}
public void setProcessName(String processName)
{
this.processName = processName;
}
public String getProcessName()
{
return processName;
}
public void setSopTitle(String sopTitle)
{
this.sopTitle = sopTitle;
}
public String getSopTitle()
{
return sopTitle;
}
public void setSopDescription(String sopDescription)
{
this.sopDescription = sopDescription;
}
public String getSopDescription()
{
return sopDescription;
}
public void setSopUrl(String sopUrl)
{
this.sopUrl = sopUrl;
}
public String getSopUrl()
{
return sopUrl;
}
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("sopId", getSopId())
.append("itemId", getItemId())
.append("orderNum", getOrderNum())
.append("processId", getProcessId())
.append("processCode", getProcessCode())
.append("processName", getProcessName())
.append("sopTitle", getSopTitle())
.append("sopDescription", getSopDescription())
.append("sopUrl", getSopUrl())
.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();
}
}

View File

@ -0,0 +1,61 @@
package com.ktg.mes.md.mapper;
import java.util.List;
import com.ktg.mes.md.domain.MdProdutSop;
/**
* 产品SOPMapper接口
*
* @author yinjinlu
* @date 2022-07-26
*/
public interface MdProdutSopMapper
{
/**
* 查询产品SOP
*
* @param sopId 产品SOP主键
* @return 产品SOP
*/
public MdProdutSop selectMdProdutSopBySopId(Long sopId);
/**
* 查询产品SOP列表
*
* @param mdProdutSop 产品SOP
* @return 产品SOP集合
*/
public List<MdProdutSop> selectMdProdutSopList(MdProdutSop mdProdutSop);
/**
* 新增产品SOP
*
* @param mdProdutSop 产品SOP
* @return 结果
*/
public int insertMdProdutSop(MdProdutSop mdProdutSop);
/**
* 修改产品SOP
*
* @param mdProdutSop 产品SOP
* @return 结果
*/
public int updateMdProdutSop(MdProdutSop mdProdutSop);
/**
* 删除产品SOP
*
* @param sopId 产品SOP主键
* @return 结果
*/
public int deleteMdProdutSopBySopId(Long sopId);
/**
* 批量删除产品SOP
*
* @param sopIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteMdProdutSopBySopIds(Long[] sopIds);
}

View File

@ -0,0 +1,61 @@
package com.ktg.mes.md.service;
import java.util.List;
import com.ktg.mes.md.domain.MdProdutSop;
/**
* 产品SOPService接口
*
* @author yinjinlu
* @date 2022-07-26
*/
public interface IMdProdutSopService
{
/**
* 查询产品SOP
*
* @param sopId 产品SOP主键
* @return 产品SOP
*/
public MdProdutSop selectMdProdutSopBySopId(Long sopId);
/**
* 查询产品SOP列表
*
* @param mdProdutSop 产品SOP
* @return 产品SOP集合
*/
public List<MdProdutSop> selectMdProdutSopList(MdProdutSop mdProdutSop);
/**
* 新增产品SOP
*
* @param mdProdutSop 产品SOP
* @return 结果
*/
public int insertMdProdutSop(MdProdutSop mdProdutSop);
/**
* 修改产品SOP
*
* @param mdProdutSop 产品SOP
* @return 结果
*/
public int updateMdProdutSop(MdProdutSop mdProdutSop);
/**
* 批量删除产品SOP
*
* @param sopIds 需要删除的产品SOP主键集合
* @return 结果
*/
public int deleteMdProdutSopBySopIds(Long[] sopIds);
/**
* 删除产品SOP信息
*
* @param sopId 产品SOP主键
* @return 结果
*/
public int deleteMdProdutSopBySopId(Long sopId);
}

View File

@ -0,0 +1,96 @@
package com.ktg.mes.md.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.md.mapper.MdProdutSopMapper;
import com.ktg.mes.md.domain.MdProdutSop;
import com.ktg.mes.md.service.IMdProdutSopService;
/**
* 产品SOPService业务层处理
*
* @author yinjinlu
* @date 2022-07-26
*/
@Service
public class MdProdutSopServiceImpl implements IMdProdutSopService
{
@Autowired
private MdProdutSopMapper mdProdutSopMapper;
/**
* 查询产品SOP
*
* @param sopId 产品SOP主键
* @return 产品SOP
*/
@Override
public MdProdutSop selectMdProdutSopBySopId(Long sopId)
{
return mdProdutSopMapper.selectMdProdutSopBySopId(sopId);
}
/**
* 查询产品SOP列表
*
* @param mdProdutSop 产品SOP
* @return 产品SOP
*/
@Override
public List<MdProdutSop> selectMdProdutSopList(MdProdutSop mdProdutSop)
{
return mdProdutSopMapper.selectMdProdutSopList(mdProdutSop);
}
/**
* 新增产品SOP
*
* @param mdProdutSop 产品SOP
* @return 结果
*/
@Override
public int insertMdProdutSop(MdProdutSop mdProdutSop)
{
mdProdutSop.setCreateTime(DateUtils.getNowDate());
return mdProdutSopMapper.insertMdProdutSop(mdProdutSop);
}
/**
* 修改产品SOP
*
* @param mdProdutSop 产品SOP
* @return 结果
*/
@Override
public int updateMdProdutSop(MdProdutSop mdProdutSop)
{
mdProdutSop.setUpdateTime(DateUtils.getNowDate());
return mdProdutSopMapper.updateMdProdutSop(mdProdutSop);
}
/**
* 批量删除产品SOP
*
* @param sopIds 需要删除的产品SOP主键
* @return 结果
*/
@Override
public int deleteMdProdutSopBySopIds(Long[] sopIds)
{
return mdProdutSopMapper.deleteMdProdutSopBySopIds(sopIds);
}
/**
* 删除产品SOP信息
*
* @param sopId 产品SOP主键
* @return 结果
*/
@Override
public int deleteMdProdutSopBySopId(Long sopId)
{
return mdProdutSopMapper.deleteMdProdutSopBySopId(sopId);
}
}

View File

@ -0,0 +1,127 @@
<?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.md.mapper.MdProdutSopMapper">
<resultMap type="MdProdutSop" id="MdProdutSopResult">
<result property="sopId" column="sop_id" />
<result property="itemId" column="item_id" />
<result property="orderNum" column="order_num" />
<result property="processId" column="process_id" />
<result property="processCode" column="process_code" />
<result property="processName" column="process_name" />
<result property="sopTitle" column="sop_title" />
<result property="sopDescription" column="sop_description" />
<result property="sopUrl" column="sop_url" />
<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="selectMdProdutSopVo">
select sop_id, item_id, order_num, process_id, process_code, process_name, sop_title, sop_description, sop_url, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_produt_sop
</sql>
<select id="selectMdProdutSopList" parameterType="MdProdutSop" resultMap="MdProdutSopResult">
<include refid="selectMdProdutSopVo"/>
<where>
<if test="itemId != null "> and item_id = #{itemId}</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="processId != null "> and process_id = #{processId}</if>
<if test="processCode != null and processCode != ''"> and process_code = #{processCode}</if>
<if test="processName != null and processName != ''"> and process_name like concat('%', #{processName}, '%')</if>
<if test="sopTitle != null and sopTitle != ''"> and sop_title = #{sopTitle}</if>
<if test="sopDescription != null and sopDescription != ''"> and sop_description = #{sopDescription}</if>
<if test="sopUrl != null and sopUrl != ''"> and sop_url = #{sopUrl}</if>
</where>
</select>
<select id="selectMdProdutSopBySopId" parameterType="Long" resultMap="MdProdutSopResult">
<include refid="selectMdProdutSopVo"/>
where sop_id = #{sopId}
</select>
<insert id="insertMdProdutSop" parameterType="MdProdutSop" useGeneratedKeys="true" keyProperty="sopId">
insert into md_produt_sop
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="itemId != null">item_id,</if>
<if test="orderNum != null">order_num,</if>
<if test="processId != null">process_id,</if>
<if test="processCode != null">process_code,</if>
<if test="processName != null">process_name,</if>
<if test="sopTitle != null">sop_title,</if>
<if test="sopDescription != null">sop_description,</if>
<if test="sopUrl != null">sop_url,</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="itemId != null">#{itemId},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="processId != null">#{processId},</if>
<if test="processCode != null">#{processCode},</if>
<if test="processName != null">#{processName},</if>
<if test="sopTitle != null">#{sopTitle},</if>
<if test="sopDescription != null">#{sopDescription},</if>
<if test="sopUrl != null">#{sopUrl},</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="updateMdProdutSop" parameterType="MdProdutSop">
update md_produt_sop
<trim prefix="SET" suffixOverrides=",">
<if test="itemId != null">item_id = #{itemId},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="processId != null">process_id = #{processId},</if>
<if test="processCode != null">process_code = #{processCode},</if>
<if test="processName != null">process_name = #{processName},</if>
<if test="sopTitle != null">sop_title = #{sopTitle},</if>
<if test="sopDescription != null">sop_description = #{sopDescription},</if>
<if test="sopUrl != null">sop_url = #{sopUrl},</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 sop_id = #{sopId}
</update>
<delete id="deleteMdProdutSopBySopId" parameterType="Long">
delete from md_produt_sop where sop_id = #{sopId}
</delete>
<delete id="deleteMdProdutSopBySopIds" parameterType="String">
delete from md_produt_sop where sop_id in
<foreach item="sopId" collection="array" open="(" separator="," close=")">
#{sopId}
</foreach>
</delete>
</mapper>