点检计划设备清单

This commit is contained in:
JinLu.Yin 2022-06-17 21:16:42 +08:00
parent edb3190734
commit 9c21fc6f87
7 changed files with 756 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.DvCheckMachinery;
import com.ktg.mes.dv.service.IDvCheckMachineryService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* 点检设备Controller
*
* @author yinjinlu
* @date 2022-06-17
*/
@RestController
@RequestMapping("/mes/dv/checkmachinery")
public class DvCheckMachineryController extends BaseController
{
@Autowired
private IDvCheckMachineryService dvCheckMachineryService;
/**
* 查询点检设备列表
*/
@PreAuthorize("@ss.hasPermi('mes:dv:checkmachinery:list')")
@GetMapping("/list")
public TableDataInfo list(DvCheckMachinery dvCheckMachinery)
{
startPage();
List<DvCheckMachinery> list = dvCheckMachineryService.selectDvCheckMachineryList(dvCheckMachinery);
return getDataTable(list);
}
/**
* 导出点检设备列表
*/
@PreAuthorize("@ss.hasPermi('mes:dv:checkmachinery:export')")
@Log(title = "点检设备", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DvCheckMachinery dvCheckMachinery)
{
List<DvCheckMachinery> list = dvCheckMachineryService.selectDvCheckMachineryList(dvCheckMachinery);
ExcelUtil<DvCheckMachinery> util = new ExcelUtil<DvCheckMachinery>(DvCheckMachinery.class);
util.exportExcel(response, list, "点检设备数据");
}
/**
* 获取点检设备详细信息
*/
@PreAuthorize("@ss.hasPermi('mes:dv:checkmachinery:query')")
@GetMapping(value = "/{recordId}")
public AjaxResult getInfo(@PathVariable("recordId") Long recordId)
{
return AjaxResult.success(dvCheckMachineryService.selectDvCheckMachineryByRecordId(recordId));
}
/**
* 新增点检设备
*/
@PreAuthorize("@ss.hasPermi('mes:dv:checkmachinery:add')")
@Log(title = "点检设备", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DvCheckMachinery dvCheckMachinery)
{
if(UserConstants.NOT_UNIQUE.equals(dvCheckMachineryService.checkMachineryUnique(dvCheckMachinery))){
return AjaxResult.error("设备已设置过点检计划!");
}
return toAjax(dvCheckMachineryService.insertDvCheckMachinery(dvCheckMachinery));
}
/**
* 修改点检设备
*/
@PreAuthorize("@ss.hasPermi('mes:dv:checkmachinery:edit')")
@Log(title = "点检设备", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DvCheckMachinery dvCheckMachinery)
{
if(UserConstants.NOT_UNIQUE.equals(dvCheckMachineryService.checkMachineryUnique(dvCheckMachinery))){
return AjaxResult.error("设备已设置过点检计划!");
}
return toAjax(dvCheckMachineryService.updateDvCheckMachinery(dvCheckMachinery));
}
/**
* 删除点检设备
*/
@PreAuthorize("@ss.hasPermi('mes:dv:checkmachinery:remove')")
@Log(title = "点检设备", businessType = BusinessType.DELETE)
@DeleteMapping("/{recordIds}")
public AjaxResult remove(@PathVariable Long[] recordIds)
{
return toAjax(dvCheckMachineryService.deleteDvCheckMachineryByRecordIds(recordIds));
}
}

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_check_machinery
*
* @author yinjinlu
* @date 2022-06-17
*/
public class DvCheckMachinery extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 流水号 */
private Long recordId;
/** 计划ID */
@Excel(name = "计划ID")
private Long planId;
/** 设备ID */
@Excel(name = "设备ID")
private Long machineryId;
/** 设备编码 */
@Excel(name = "设备编码")
private String machineryCode;
/** 设备名称 */
@Excel(name = "设备名称")
private String machineryName;
/** 品牌 */
@Excel(name = "品牌")
private String machineryBrand;
/** 规格型号 */
@Excel(name = "规格型号")
private String machinerySpec;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private Long attr3;
/** 预留字段4 */
private Long attr4;
public void setRecordId(Long recordId)
{
this.recordId = recordId;
}
public Long getRecordId()
{
return recordId;
}
public void setPlanId(Long planId)
{
this.planId = planId;
}
public Long getPlanId()
{
return planId;
}
public void setMachineryId(Long machineryId)
{
this.machineryId = machineryId;
}
public Long getMachineryId()
{
return machineryId;
}
public void setMachineryCode(String machineryCode)
{
this.machineryCode = machineryCode;
}
public String getMachineryCode()
{
return machineryCode;
}
public void setMachineryName(String machineryName)
{
this.machineryName = machineryName;
}
public String getMachineryName()
{
return machineryName;
}
public void setMachineryBrand(String machineryBrand)
{
this.machineryBrand = machineryBrand;
}
public String getMachineryBrand()
{
return machineryBrand;
}
public void setMachinerySpec(String machinerySpec)
{
this.machinerySpec = machinerySpec;
}
public String getMachinerySpec()
{
return machinerySpec;
}
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("recordId", getRecordId())
.append("planId", getPlanId())
.append("machineryId", getMachineryId())
.append("machineryCode", getMachineryCode())
.append("machineryName", getMachineryName())
.append("machineryBrand", getMachineryBrand())
.append("machinerySpec", getMachinerySpec())
.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,63 @@
package com.ktg.mes.dv.mapper;
import java.util.List;
import com.ktg.mes.dv.domain.DvCheckMachinery;
/**
* 点检设备Mapper接口
*
* @author yinjinlu
* @date 2022-06-17
*/
public interface DvCheckMachineryMapper
{
/**
* 查询点检设备
*
* @param recordId 点检设备主键
* @return 点检设备
*/
public DvCheckMachinery selectDvCheckMachineryByRecordId(Long recordId);
/**
* 查询点检设备列表
*
* @param dvCheckMachinery 点检设备
* @return 点检设备集合
*/
public List<DvCheckMachinery> selectDvCheckMachineryList(DvCheckMachinery dvCheckMachinery);
public DvCheckMachinery checkMachineryUnique(DvCheckMachinery dvCheckMachinery);
/**
* 新增点检设备
*
* @param dvCheckMachinery 点检设备
* @return 结果
*/
public int insertDvCheckMachinery(DvCheckMachinery dvCheckMachinery);
/**
* 修改点检设备
*
* @param dvCheckMachinery 点检设备
* @return 结果
*/
public int updateDvCheckMachinery(DvCheckMachinery dvCheckMachinery);
/**
* 删除点检设备
*
* @param recordId 点检设备主键
* @return 结果
*/
public int deleteDvCheckMachineryByRecordId(Long recordId);
/**
* 批量删除点检设备
*
* @param recordIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteDvCheckMachineryByRecordIds(Long[] recordIds);
}

View File

@ -0,0 +1,63 @@
package com.ktg.mes.dv.service;
import java.util.List;
import com.ktg.mes.dv.domain.DvCheckMachinery;
/**
* 点检设备Service接口
*
* @author yinjinlu
* @date 2022-06-17
*/
public interface IDvCheckMachineryService
{
/**
* 查询点检设备
*
* @param recordId 点检设备主键
* @return 点检设备
*/
public DvCheckMachinery selectDvCheckMachineryByRecordId(Long recordId);
/**
* 查询点检设备列表
*
* @param dvCheckMachinery 点检设备
* @return 点检设备集合
*/
public List<DvCheckMachinery> selectDvCheckMachineryList(DvCheckMachinery dvCheckMachinery);
public String checkMachineryUnique(DvCheckMachinery dvCheckMachinery);
/**
* 新增点检设备
*
* @param dvCheckMachinery 点检设备
* @return 结果
*/
public int insertDvCheckMachinery(DvCheckMachinery dvCheckMachinery);
/**
* 修改点检设备
*
* @param dvCheckMachinery 点检设备
* @return 结果
*/
public int updateDvCheckMachinery(DvCheckMachinery dvCheckMachinery);
/**
* 批量删除点检设备
*
* @param recordIds 需要删除的点检设备主键集合
* @return 结果
*/
public int deleteDvCheckMachineryByRecordIds(Long[] recordIds);
/**
* 删除点检设备信息
*
* @param recordId 点检设备主键
* @return 结果
*/
public int deleteDvCheckMachineryByRecordId(Long recordId);
}

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.DvCheckMachineryMapper;
import com.ktg.mes.dv.domain.DvCheckMachinery;
import com.ktg.mes.dv.service.IDvCheckMachineryService;
/**
* 点检设备Service业务层处理
*
* @author yinjinlu
* @date 2022-06-17
*/
@Service
public class DvCheckMachineryServiceImpl implements IDvCheckMachineryService
{
@Autowired
private DvCheckMachineryMapper dvCheckMachineryMapper;
/**
* 查询点检设备
*
* @param recordId 点检设备主键
* @return 点检设备
*/
@Override
public DvCheckMachinery selectDvCheckMachineryByRecordId(Long recordId)
{
return dvCheckMachineryMapper.selectDvCheckMachineryByRecordId(recordId);
}
/**
* 查询点检设备列表
*
* @param dvCheckMachinery 点检设备
* @return 点检设备
*/
@Override
public List<DvCheckMachinery> selectDvCheckMachineryList(DvCheckMachinery dvCheckMachinery)
{
return dvCheckMachineryMapper.selectDvCheckMachineryList(dvCheckMachinery);
}
@Override
public String checkMachineryUnique(DvCheckMachinery dvCheckMachinery) {
DvCheckMachinery machinery = dvCheckMachineryMapper.checkMachineryUnique(dvCheckMachinery);
Long recordId = dvCheckMachinery.getRecordId()==null?-1L:dvCheckMachinery.getRecordId();
if(StringUtils.isNotNull(machinery) && machinery.getRecordId().longValue() == recordId.longValue()){
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 新增点检设备
*
* @param dvCheckMachinery 点检设备
* @return 结果
*/
@Override
public int insertDvCheckMachinery(DvCheckMachinery dvCheckMachinery)
{
dvCheckMachinery.setCreateTime(DateUtils.getNowDate());
return dvCheckMachineryMapper.insertDvCheckMachinery(dvCheckMachinery);
}
/**
* 修改点检设备
*
* @param dvCheckMachinery 点检设备
* @return 结果
*/
@Override
public int updateDvCheckMachinery(DvCheckMachinery dvCheckMachinery)
{
dvCheckMachinery.setUpdateTime(DateUtils.getNowDate());
return dvCheckMachineryMapper.updateDvCheckMachinery(dvCheckMachinery);
}
/**
* 批量删除点检设备
*
* @param recordIds 需要删除的点检设备主键
* @return 结果
*/
@Override
public int deleteDvCheckMachineryByRecordIds(Long[] recordIds)
{
return dvCheckMachineryMapper.deleteDvCheckMachineryByRecordIds(recordIds);
}
/**
* 删除点检设备信息
*
* @param recordId 点检设备主键
* @return 结果
*/
@Override
public int deleteDvCheckMachineryByRecordId(Long recordId)
{
return dvCheckMachineryMapper.deleteDvCheckMachineryByRecordId(recordId);
}
}

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.DvCheckPlanMapper;
import com.ktg.mes.dv.domain.DvCheckPlan;
import com.ktg.mes.dv.service.IDvCheckPlanService;
/**
* 设备点检计划头Service业务层处理
*
* @author yinjinlu
* @date 2022-06-16
*/
@Service
public class DvCheckPlanServiceImpl implements IDvCheckPlanService
{
@Autowired
private DvCheckPlanMapper dvCheckPlanMapper;
/**
* 查询设备点检计划头
*
* @param planId 设备点检计划头主键
* @return 设备点检计划头
*/
@Override
public DvCheckPlan selectDvCheckPlanByPlanId(Long planId)
{
return dvCheckPlanMapper.selectDvCheckPlanByPlanId(planId);
}
/**
* 查询设备点检计划头列表
*
* @param dvCheckPlan 设备点检计划头
* @return 设备点检计划头
*/
@Override
public List<DvCheckPlan> selectDvCheckPlanList(DvCheckPlan dvCheckPlan)
{
return dvCheckPlanMapper.selectDvCheckPlanList(dvCheckPlan);
}
@Override
public String checkPlanCodeUnique(DvCheckPlan dvCheckPlan) {
DvCheckPlan plan = dvCheckPlanMapper.checkPlanCodeUnique(dvCheckPlan);
Long planId = dvCheckPlan.getPlanId()==null?-1L:dvCheckPlan.getPlanId();
if(StringUtils.isNotNull(plan) && plan.getPlanId().longValue()==planId.longValue()){
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 新增设备点检计划头
*
* @param dvCheckPlan 设备点检计划头
* @return 结果
*/
@Override
public int insertDvCheckPlan(DvCheckPlan dvCheckPlan)
{
dvCheckPlan.setCreateTime(DateUtils.getNowDate());
return dvCheckPlanMapper.insertDvCheckPlan(dvCheckPlan);
}
/**
* 修改设备点检计划头
*
* @param dvCheckPlan 设备点检计划头
* @return 结果
*/
@Override
public int updateDvCheckPlan(DvCheckPlan dvCheckPlan)
{
dvCheckPlan.setUpdateTime(DateUtils.getNowDate());
return dvCheckPlanMapper.updateDvCheckPlan(dvCheckPlan);
}
/**
* 批量删除设备点检计划头
*
* @param planIds 需要删除的设备点检计划头主键
* @return 结果
*/
@Override
public int deleteDvCheckPlanByPlanIds(Long[] planIds)
{
return dvCheckPlanMapper.deleteDvCheckPlanByPlanIds(planIds);
}
/**
* 删除设备点检计划头信息
*
* @param planId 设备点检计划头主键
* @return 结果
*/
@Override
public int deleteDvCheckPlanByPlanId(Long planId)
{
return dvCheckPlanMapper.deleteDvCheckPlanByPlanId(planId);
}
}

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.DvCheckMachineryMapper">
<resultMap type="DvCheckMachinery" id="DvCheckMachineryResult">
<result property="recordId" column="record_id" />
<result property="planId" column="plan_id" />
<result property="machineryId" column="machinery_id" />
<result property="machineryCode" column="machinery_code" />
<result property="machineryName" column="machinery_name" />
<result property="machineryBrand" column="machinery_brand" />
<result property="machinerySpec" column="machinery_spec" />
<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="selectDvCheckMachineryVo">
select record_id, plan_id, machinery_id, machinery_code, machinery_name, machinery_brand, machinery_spec, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from dv_check_machinery
</sql>
<select id="selectDvCheckMachineryList" parameterType="DvCheckMachinery" resultMap="DvCheckMachineryResult">
<include refid="selectDvCheckMachineryVo"/>
<where>
<if test="planId != null "> and plan_id = #{planId}</if>
<if test="machineryId != null "> and machinery_id = #{machineryId}</if>
<if test="machineryCode != null and machineryCode != ''"> and machinery_code = #{machineryCode}</if>
<if test="machineryName != null and machineryName != ''"> and machinery_name like concat('%', #{machineryName}, '%')</if>
<if test="machineryBrand != null and machineryBrand != ''"> and machinery_brand = #{machineryBrand}</if>
<if test="machinerySpec != null and machinerySpec != ''"> and machinery_spec = #{machinerySpec}</if>
</where>
</select>
<select id="selectDvCheckMachineryByRecordId" parameterType="Long" resultMap="DvCheckMachineryResult">
<include refid="selectDvCheckMachineryVo"/>
where record_id = #{recordId}
</select>
<select id="checkMachineryUnique" parameterType="DvCheckMachinery" resultMap="DvCheckMachineryResult">
<include refid="selectDvCheckMachineryVo"/>
where machinery_id = #{machineryId}
</select>
<insert id="insertDvCheckMachinery" parameterType="DvCheckMachinery" useGeneratedKeys="true" keyProperty="recordId">
insert into dv_check_machinery
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planId != null">plan_id,</if>
<if test="machineryId != null">machinery_id,</if>
<if test="machineryCode != null and machineryCode != ''">machinery_code,</if>
<if test="machineryName != null and machineryName != ''">machinery_name,</if>
<if test="machineryBrand != null">machinery_brand,</if>
<if test="machinerySpec != null">machinery_spec,</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="planId != null">#{planId},</if>
<if test="machineryId != null">#{machineryId},</if>
<if test="machineryCode != null and machineryCode != ''">#{machineryCode},</if>
<if test="machineryName != null and machineryName != ''">#{machineryName},</if>
<if test="machineryBrand != null">#{machineryBrand},</if>
<if test="machinerySpec != null">#{machinerySpec},</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="updateDvCheckMachinery" parameterType="DvCheckMachinery">
update dv_check_machinery
<trim prefix="SET" suffixOverrides=",">
<if test="planId != null">plan_id = #{planId},</if>
<if test="machineryId != null">machinery_id = #{machineryId},</if>
<if test="machineryCode != null and machineryCode != ''">machinery_code = #{machineryCode},</if>
<if test="machineryName != null and machineryName != ''">machinery_name = #{machineryName},</if>
<if test="machineryBrand != null">machinery_brand = #{machineryBrand},</if>
<if test="machinerySpec != null">machinery_spec = #{machinerySpec},</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 record_id = #{recordId}
</update>
<delete id="deleteDvCheckMachineryByRecordId" parameterType="Long">
delete from dv_check_machinery where record_id = #{recordId}
</delete>
<delete id="deleteDvCheckMachineryByRecordIds" parameterType="String">
delete from dv_check_machinery where record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")">
#{recordId}
</foreach>
</delete>
</mapper>