设备点检保养项目

This commit is contained in:
JinLu.Yin 2022-06-16 20:36:55 +08:00
parent f3cff11b33
commit 44b46d1b21
7 changed files with 654 additions and 0 deletions

View File

@ -0,0 +1,112 @@
package com.ktg.mes.dv.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants;
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.dv.domain.DvSubject;
import com.ktg.mes.dv.service.IDvSubjectService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* 设备点检保养项目Controller
*
* @author yinjinlu
* @date 2022-06-16
*/
@RestController
@RequestMapping("/mes/dv/dvsubject")
public class DvSubjectController extends BaseController
{
@Autowired
private IDvSubjectService dvSubjectService;
/**
* 查询设备点检保养项目列表
*/
@PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:list')")
@GetMapping("/list")
public TableDataInfo list(DvSubject dvSubject)
{
startPage();
List<DvSubject> list = dvSubjectService.selectDvSubjectList(dvSubject);
return getDataTable(list);
}
/**
* 导出设备点检保养项目列表
*/
@PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:export')")
@Log(title = "设备点检保养项目", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DvSubject dvSubject)
{
List<DvSubject> list = dvSubjectService.selectDvSubjectList(dvSubject);
ExcelUtil<DvSubject> util = new ExcelUtil<DvSubject>(DvSubject.class);
util.exportExcel(response, list, "设备点检保养项目数据");
}
/**
* 获取设备点检保养项目详细信息
*/
@PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:query')")
@GetMapping(value = "/{subjectId}")
public AjaxResult getInfo(@PathVariable("subjectId") Long subjectId)
{
return AjaxResult.success(dvSubjectService.selectDvSubjectBySubjectId(subjectId));
}
/**
* 新增设备点检保养项目
*/
@PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:add')")
@Log(title = "设备点检保养项目", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DvSubject dvSubject)
{
if(UserConstants.NOT_UNIQUE.equals(dvSubjectService.checkSubjectCodeUnique(dvSubject))){
return AjaxResult.error("项目编码已存在!");
}
return toAjax(dvSubjectService.insertDvSubject(dvSubject));
}
/**
* 修改设备点检保养项目
*/
@PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:edit')")
@Log(title = "设备点检保养项目", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DvSubject dvSubject)
{
if(UserConstants.NOT_UNIQUE.equals(dvSubjectService.checkSubjectCodeUnique(dvSubject))){
return AjaxResult.error("项目编码已存在!");
}
return toAjax(dvSubjectService.updateDvSubject(dvSubject));
}
/**
* 删除设备点检保养项目
*/
@PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:remove')")
@Log(title = "设备点检保养项目", businessType = BusinessType.DELETE)
@DeleteMapping("/{subjectIds}")
public AjaxResult remove(@PathVariable Long[] subjectIds)
{
return toAjax(dvSubjectService.deleteDvSubjectBySubjectIds(subjectIds));
}
}

View File

@ -0,0 +1,178 @@
package com.ktg.mes.dv.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;
/**
* 设备点检保养项目对象 dv_subject
*
* @author yinjinlu
* @date 2022-06-16
*/
public class DvSubject extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 项目ID */
private Long subjectId;
/** 项目编码 */
@Excel(name = "项目编码")
private String subjectCode;
/** 项目名称 */
@Excel(name = "项目名称")
private String subjectName;
/** 项目类型 */
@Excel(name = "项目类型")
private String subjectType;
/** 项目内容 */
@Excel(name = "项目内容")
private String subjectContent;
/** 标准 */
@Excel(name = "标准")
private String subjectStandard;
/** 是否启用 */
@Excel(name = "是否启用")
private String enableFlag;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private Long attr3;
/** 预留字段4 */
private Long attr4;
public void setSubjectId(Long subjectId)
{
this.subjectId = subjectId;
}
public Long getSubjectId()
{
return subjectId;
}
public void setSubjectCode(String subjectCode)
{
this.subjectCode = subjectCode;
}
public String getSubjectCode()
{
return subjectCode;
}
public void setSubjectName(String subjectName)
{
this.subjectName = subjectName;
}
public String getSubjectName()
{
return subjectName;
}
public void setSubjectType(String subjectType)
{
this.subjectType = subjectType;
}
public String getSubjectType()
{
return subjectType;
}
public void setSubjectContent(String subjectContent)
{
this.subjectContent = subjectContent;
}
public String getSubjectContent()
{
return subjectContent;
}
public void setSubjectStandard(String subjectStandard)
{
this.subjectStandard = subjectStandard;
}
public String getSubjectStandard()
{
return subjectStandard;
}
public void setEnableFlag(String enableFlag)
{
this.enableFlag = enableFlag;
}
public String getEnableFlag()
{
return enableFlag;
}
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("subjectId", getSubjectId())
.append("subjectCode", getSubjectCode())
.append("subjectName", getSubjectName())
.append("subjectType", getSubjectType())
.append("subjectContent", getSubjectContent())
.append("subjectStandard", getSubjectStandard())
.append("enableFlag", getEnableFlag())
.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,64 @@
package com.ktg.mes.dv.mapper;
import java.util.List;
import com.ktg.mes.dv.domain.DvSubject;
/**
* 设备点检保养项目Mapper接口
*
* @author yinjinlu
* @date 2022-06-16
*/
public interface DvSubjectMapper
{
/**
* 查询设备点检保养项目
*
* @param subjectId 设备点检保养项目主键
* @return 设备点检保养项目
*/
public DvSubject selectDvSubjectBySubjectId(Long subjectId);
/**
* 查询设备点检保养项目列表
*
* @param dvSubject 设备点检保养项目
* @return 设备点检保养项目集合
*/
public List<DvSubject> selectDvSubjectList(DvSubject dvSubject);
public DvSubject checkSubjectCodeUnique(DvSubject dvSubject);
/**
* 新增设备点检保养项目
*
* @param dvSubject 设备点检保养项目
* @return 结果
*/
public int insertDvSubject(DvSubject dvSubject);
/**
* 修改设备点检保养项目
*
* @param dvSubject 设备点检保养项目
* @return 结果
*/
public int updateDvSubject(DvSubject dvSubject);
/**
* 删除设备点检保养项目
*
* @param subjectId 设备点检保养项目主键
* @return 结果
*/
public int deleteDvSubjectBySubjectId(Long subjectId);
/**
* 批量删除设备点检保养项目
*
* @param subjectIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteDvSubjectBySubjectIds(Long[] subjectIds);
}

View File

@ -0,0 +1,68 @@
package com.ktg.mes.dv.service;
import java.util.List;
import com.ktg.mes.dv.domain.DvSubject;
/**
* 设备点检保养项目Service接口
*
* @author yinjinlu
* @date 2022-06-16
*/
public interface IDvSubjectService
{
/**
* 查询设备点检保养项目
*
* @param subjectId 设备点检保养项目主键
* @return 设备点检保养项目
*/
public DvSubject selectDvSubjectBySubjectId(Long subjectId);
/**
* 查询设备点检保养项目列表
*
* @param dvSubject 设备点检保养项目
* @return 设备点检保养项目集合
*/
public List<DvSubject> selectDvSubjectList(DvSubject dvSubject);
/**
* 检查项目编码是否重复
* @param dvSubject
* @return
*/
public String checkSubjectCodeUnique(DvSubject dvSubject);
/**
* 新增设备点检保养项目
*
* @param dvSubject 设备点检保养项目
* @return 结果
*/
public int insertDvSubject(DvSubject dvSubject);
/**
* 修改设备点检保养项目
*
* @param dvSubject 设备点检保养项目
* @return 结果
*/
public int updateDvSubject(DvSubject dvSubject);
/**
* 批量删除设备点检保养项目
*
* @param subjectIds 需要删除的设备点检保养项目主键集合
* @return 结果
*/
public int deleteDvSubjectBySubjectIds(Long[] subjectIds);
/**
* 删除设备点检保养项目信息
*
* @param subjectId 设备点检保养项目主键
* @return 结果
*/
public int deleteDvSubjectBySubjectId(Long subjectId);
}

View File

@ -0,0 +1,109 @@
package com.ktg.mes.dv.service.impl;
import java.util.List;
import com.ktg.common.constant.UserConstants;
import com.ktg.common.utils.DateUtils;
import com.ktg.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.dv.mapper.DvSubjectMapper;
import com.ktg.mes.dv.domain.DvSubject;
import com.ktg.mes.dv.service.IDvSubjectService;
/**
* 设备点检保养项目Service业务层处理
*
* @author yinjinlu
* @date 2022-06-16
*/
@Service
public class DvSubjectServiceImpl implements IDvSubjectService
{
@Autowired
private DvSubjectMapper dvSubjectMapper;
/**
* 查询设备点检保养项目
*
* @param subjectId 设备点检保养项目主键
* @return 设备点检保养项目
*/
@Override
public DvSubject selectDvSubjectBySubjectId(Long subjectId)
{
return dvSubjectMapper.selectDvSubjectBySubjectId(subjectId);
}
/**
* 查询设备点检保养项目列表
*
* @param dvSubject 设备点检保养项目
* @return 设备点检保养项目
*/
@Override
public List<DvSubject> selectDvSubjectList(DvSubject dvSubject)
{
return dvSubjectMapper.selectDvSubjectList(dvSubject);
}
@Override
public String checkSubjectCodeUnique(DvSubject dvSubject) {
DvSubject subject = dvSubjectMapper.checkSubjectCodeUnique(dvSubject);
Long subjectId = dvSubject.getSubjectId()==null?-1L:dvSubject.getSubjectId();
if(StringUtils.isNotNull(subject) && subject.getSubjectId().longValue() == subjectId.longValue()){
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 新增设备点检保养项目
*
* @param dvSubject 设备点检保养项目
* @return 结果
*/
@Override
public int insertDvSubject(DvSubject dvSubject)
{
dvSubject.setCreateTime(DateUtils.getNowDate());
return dvSubjectMapper.insertDvSubject(dvSubject);
}
/**
* 修改设备点检保养项目
*
* @param dvSubject 设备点检保养项目
* @return 结果
*/
@Override
public int updateDvSubject(DvSubject dvSubject)
{
dvSubject.setUpdateTime(DateUtils.getNowDate());
return dvSubjectMapper.updateDvSubject(dvSubject);
}
/**
* 批量删除设备点检保养项目
*
* @param subjectIds 需要删除的设备点检保养项目主键
* @return 结果
*/
@Override
public int deleteDvSubjectBySubjectIds(Long[] subjectIds)
{
return dvSubjectMapper.deleteDvSubjectBySubjectIds(subjectIds);
}
/**
* 删除设备点检保养项目信息
*
* @param subjectId 设备点检保养项目主键
* @return 结果
*/
@Override
public int deleteDvSubjectBySubjectId(Long subjectId)
{
return dvSubjectMapper.deleteDvSubjectBySubjectId(subjectId);
}
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants;
import com.ktg.mes.wm.domain.WmRtVendorLine;
import com.ktg.mes.wm.domain.tx.RtVendorTxBean;
import com.ktg.mes.wm.service.IStorageCoreService;
import com.ktg.mes.wm.service.IWmRtVendorLineService;

View File

@ -0,0 +1,122 @@
<?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.dv.mapper.DvSubjectMapper">
<resultMap type="DvSubject" id="DvSubjectResult">
<result property="subjectId" column="subject_id" />
<result property="subjectCode" column="subject_code" />
<result property="subjectName" column="subject_name" />
<result property="subjectType" column="subject_type" />
<result property="subjectContent" column="subject_content" />
<result property="subjectStandard" column="subject_standard" />
<result property="enableFlag" column="enable_flag" />
<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="selectDvSubjectVo">
select subject_id, subject_code, subject_name, subject_type, subject_content, subject_standard, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from dv_subject
</sql>
<select id="selectDvSubjectList" parameterType="DvSubject" resultMap="DvSubjectResult">
<include refid="selectDvSubjectVo"/>
<where>
<if test="subjectCode != null and subjectCode != ''"> and subject_code = #{subjectCode}</if>
<if test="subjectName != null and subjectName != ''"> and subject_name like concat('%', #{subjectName}, '%')</if>
<if test="subjectType != null and subjectType != ''"> and subject_type = #{subjectType}</if>
<if test="subjectContent != null and subjectContent != ''"> and subject_content = #{subjectContent}</if>
<if test="subjectStandard != null and subjectStandard != ''"> and subject_standard = #{subjectStandard}</if>
<if test="enableFlag != null and enableFlag != ''"> and enable_flag = #{enableFlag}</if>
</where>
</select>
<select id="selectDvSubjectBySubjectId" parameterType="Long" resultMap="DvSubjectResult">
<include refid="selectDvSubjectVo"/>
where subject_id = #{subjectId}
</select>
<select id="checkSubjectCodeUnique" parameterType="DvSubject" resultMap="DvSubjectResult">
<include refid="selectDvSubjectVo"/>
where subject_code = #{subjectCode}
</select>
<insert id="insertDvSubject" parameterType="DvSubject" useGeneratedKeys="true" keyProperty="subjectId">
insert into dv_subject
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="subjectCode != null and subjectCode != ''">subject_code,</if>
<if test="subjectName != null and subjectName != ''">subject_name,</if>
<if test="subjectType != null">subject_type,</if>
<if test="subjectContent != null and subjectContent != ''">subject_content,</if>
<if test="subjectStandard != null">subject_standard,</if>
<if test="enableFlag != null and enableFlag != ''">enable_flag,</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="subjectCode != null and subjectCode != ''">#{subjectCode},</if>
<if test="subjectName != null and subjectName != ''">#{subjectName},</if>
<if test="subjectType != null">#{subjectType},</if>
<if test="subjectContent != null and subjectContent != ''">#{subjectContent},</if>
<if test="subjectStandard != null">#{subjectStandard},</if>
<if test="enableFlag != null and enableFlag != ''">#{enableFlag},</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="updateDvSubject" parameterType="DvSubject">
update dv_subject
<trim prefix="SET" suffixOverrides=",">
<if test="subjectCode != null and subjectCode != ''">subject_code = #{subjectCode},</if>
<if test="subjectName != null and subjectName != ''">subject_name = #{subjectName},</if>
<if test="subjectType != null">subject_type = #{subjectType},</if>
<if test="subjectContent != null and subjectContent != ''">subject_content = #{subjectContent},</if>
<if test="subjectStandard != null">subject_standard = #{subjectStandard},</if>
<if test="enableFlag != null and enableFlag != ''">enable_flag = #{enableFlag},</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 subject_id = #{subjectId}
</update>
<delete id="deleteDvSubjectBySubjectId" parameterType="Long">
delete from dv_subject where subject_id = #{subjectId}
</delete>
<delete id="deleteDvSubjectBySubjectIds" parameterType="String">
delete from dv_subject where subject_id in
<foreach item="subjectId" collection="array" open="(" separator="," close=")">
#{subjectId}
</foreach>
</delete>
</mapper>