设备管理-检查项维护V2(关联设备)
parent
d6e558f422
commit
eb7ad777ec
@ -0,0 +1,181 @@
|
||||
package com.op.device.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.op.common.core.annotation.Excel;
|
||||
import com.op.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 检查项/设备关联对象 equ_item_equipment
|
||||
*
|
||||
* @author wws
|
||||
* @date 2023-10-12
|
||||
*/
|
||||
public class EquItemEquipment extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private String id;
|
||||
|
||||
/** 关联code */
|
||||
@Excel(name = "关联code")
|
||||
private String connCode;
|
||||
|
||||
/** 检查项code */
|
||||
@Excel(name = "检查项code")
|
||||
private String itemCode;
|
||||
|
||||
/** 设备code */
|
||||
@Excel(name = "设备code")
|
||||
private String equipmentCode;
|
||||
|
||||
/** 工厂 */
|
||||
@Excel(name = "工厂")
|
||||
private String factoryCode;
|
||||
|
||||
/** 备用字段1 */
|
||||
@Excel(name = "备用字段1")
|
||||
private String attr1;
|
||||
|
||||
/** 备用字段2 */
|
||||
@Excel(name = "备用字段2")
|
||||
private String attr2;
|
||||
|
||||
/** 备用字段3 */
|
||||
@Excel(name = "备用字段3")
|
||||
private String attr3;
|
||||
|
||||
/** 删除标识 */
|
||||
private String delFlag;
|
||||
|
||||
/** 创建人 */
|
||||
@Excel(name = "创建人")
|
||||
private String createdBy;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date createdTime;
|
||||
|
||||
/** 更新人 */
|
||||
@Excel(name = "更新人")
|
||||
private String updatedBy;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date updatedTime;
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setConnCode(String connCode) {
|
||||
this.connCode = connCode;
|
||||
}
|
||||
|
||||
public String getConnCode() {
|
||||
return connCode;
|
||||
}
|
||||
public void setItemCode(String itemCode) {
|
||||
this.itemCode = itemCode;
|
||||
}
|
||||
|
||||
public String getItemCode() {
|
||||
return itemCode;
|
||||
}
|
||||
public void setEquipmentCode(String equipmentCode) {
|
||||
this.equipmentCode = equipmentCode;
|
||||
}
|
||||
|
||||
public String getEquipmentCode() {
|
||||
return equipmentCode;
|
||||
}
|
||||
public void setFactoryCode(String factoryCode) {
|
||||
this.factoryCode = factoryCode;
|
||||
}
|
||||
|
||||
public String getFactoryCode() {
|
||||
return factoryCode;
|
||||
}
|
||||
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(String attr3) {
|
||||
this.attr3 = attr3;
|
||||
}
|
||||
|
||||
public String getAttr3() {
|
||||
return attr3;
|
||||
}
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
public void setCreatedTime(Date createdTime) {
|
||||
this.createdTime = createdTime;
|
||||
}
|
||||
|
||||
public Date getCreatedTime() {
|
||||
return createdTime;
|
||||
}
|
||||
public void setUpdatedBy(String updatedBy) {
|
||||
this.updatedBy = updatedBy;
|
||||
}
|
||||
|
||||
public String getUpdatedBy() {
|
||||
return updatedBy;
|
||||
}
|
||||
public void setUpdatedTime(Date updatedTime) {
|
||||
this.updatedTime = updatedTime;
|
||||
}
|
||||
|
||||
public Date getUpdatedTime() {
|
||||
return updatedTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("connCode", getConnCode())
|
||||
.append("itemCode", getItemCode())
|
||||
.append("equipmentCode", getEquipmentCode())
|
||||
.append("factoryCode", getFactoryCode())
|
||||
.append("attr1", getAttr1())
|
||||
.append("attr2", getAttr2())
|
||||
.append("attr3", getAttr3())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createdBy", getCreatedBy())
|
||||
.append("createdTime", getCreatedTime())
|
||||
.append("updatedBy", getUpdatedBy())
|
||||
.append("updatedTime", getUpdatedTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package com.op.device.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.op.device.domain.EquItemEquipment;
|
||||
|
||||
/**
|
||||
* 检查项/设备关联Mapper接口
|
||||
*
|
||||
* @author wws
|
||||
* @date 2023-10-12
|
||||
*/
|
||||
public interface EquItemEquipmentMapper {
|
||||
/**
|
||||
* 查询检查项/设备关联
|
||||
*
|
||||
* @param id 检查项/设备关联主键
|
||||
* @return 检查项/设备关联
|
||||
*/
|
||||
public EquItemEquipment selectEquItemEquipmentById(String id);
|
||||
|
||||
/**
|
||||
* 查询检查项/设备关联列表
|
||||
*
|
||||
* @param equItemEquipment 检查项/设备关联
|
||||
* @return 检查项/设备关联集合
|
||||
*/
|
||||
public List<EquItemEquipment> selectEquItemEquipmentList(EquItemEquipment equItemEquipment);
|
||||
|
||||
/**
|
||||
* 新增检查项/设备关联
|
||||
*
|
||||
* @param equItemEquipment 检查项/设备关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEquItemEquipment(EquItemEquipment equItemEquipment);
|
||||
|
||||
/**
|
||||
* 修改检查项/设备关联
|
||||
*
|
||||
* @param equItemEquipment 检查项/设备关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEquItemEquipment(EquItemEquipment equItemEquipment);
|
||||
|
||||
/**
|
||||
* 删除检查项/设备关联
|
||||
*
|
||||
* @param id 检查项/设备关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEquItemEquipmentById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除检查项/设备关联
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEquItemEquipmentByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 获取流水号
|
||||
* @return
|
||||
*/
|
||||
int selectSerialNumber();
|
||||
|
||||
/**
|
||||
* 通过检查项code查询关联设备code列表
|
||||
* @param itemCode
|
||||
* @return
|
||||
*/
|
||||
List<String> selectEquipmentCodeList(String itemCode);
|
||||
|
||||
/**
|
||||
* 通过检查项code删除关联信息
|
||||
* @param itemCode
|
||||
*/
|
||||
void deleteEquItemEquipmentByItemCode(String itemCode);
|
||||
|
||||
/**
|
||||
* 逻辑删除-通过itemId删除设备关联信息
|
||||
* @param itemId
|
||||
*/
|
||||
void delEquItemEquipmentByItemId(String itemId);
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
<?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.op.device.mapper.EquItemEquipmentMapper">
|
||||
|
||||
<resultMap type="EquItemEquipment" id="EquItemEquipmentResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="connCode" column="conn_code" />
|
||||
<result property="itemCode" column="item_code" />
|
||||
<result property="equipmentCode" column="equipment_code" />
|
||||
<result property="factoryCode" column="factory_code" />
|
||||
<result property="attr1" column="attr1" />
|
||||
<result property="attr2" column="attr2" />
|
||||
<result property="attr3" column="attr3" />
|
||||
<result property="delFlag" column="del_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" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEquItemEquipmentVo">
|
||||
select id, conn_code, item_code, equipment_code, factory_code, attr1, attr2, attr3, del_flag, created_by, created_time, updated_by, updated_time from equ_item_equipment
|
||||
</sql>
|
||||
|
||||
<select id="selectEquItemEquipmentList" parameterType="EquItemEquipment" resultMap="EquItemEquipmentResult">
|
||||
<include refid="selectEquItemEquipmentVo"/>
|
||||
<where>
|
||||
<if test="connCode != null and connCode != ''"> and conn_code = #{connCode}</if>
|
||||
<if test="itemCode != null and itemCode != ''"> and item_code = #{itemCode}</if>
|
||||
<if test="equipmentCode != null and equipmentCode != ''"> and equipment_code = #{equipmentCode}</if>
|
||||
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
|
||||
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
|
||||
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
|
||||
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</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>
|
||||
</where>
|
||||
and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectEquItemEquipmentById" parameterType="String" resultMap="EquItemEquipmentResult">
|
||||
<include refid="selectEquItemEquipmentVo"/>
|
||||
where id = #{id} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectSerialNumber" resultType="java.lang.Integer">
|
||||
SELECT COUNT(id)+1 AS serialNum
|
||||
FROM equ_item_equipment
|
||||
WHERE CONVERT(date, GETDATE()) = CONVERT(date,created_time) and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectEquipmentCodeList" resultType="java.lang.String">
|
||||
select equipment_code AS 'equipmentCode' from equ_item_equipment where item_code = #{itemCode} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertEquItemEquipment" parameterType="EquItemEquipment">
|
||||
insert into equ_item_equipment
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="connCode != null and connCode != ''">conn_code,</if>
|
||||
<if test="itemCode != null and itemCode != ''">item_code,</if>
|
||||
<if test="equipmentCode != null and equipmentCode != ''">equipment_code,</if>
|
||||
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
|
||||
<if test="attr1 != null">attr1,</if>
|
||||
<if test="attr2 != null">attr2,</if>
|
||||
<if test="attr3 != null">attr3,</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||
<if test="createdBy != null and createdBy != ''">created_by,</if>
|
||||
<if test="createdTime != null">created_time,</if>
|
||||
<if test="updatedBy != null and updatedBy != ''">updated_by,</if>
|
||||
<if test="updatedTime != null">updated_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="connCode != null and connCode != ''">#{connCode},</if>
|
||||
<if test="itemCode != null and itemCode != ''">#{itemCode},</if>
|
||||
<if test="equipmentCode != null and equipmentCode != ''">#{equipmentCode},</if>
|
||||
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
|
||||
<if test="attr1 != null">#{attr1},</if>
|
||||
<if test="attr2 != null">#{attr2},</if>
|
||||
<if test="attr3 != null">#{attr3},</if>
|
||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||
<if test="createdBy != null and createdBy != ''">#{createdBy},</if>
|
||||
<if test="createdTime != null">#{createdTime},</if>
|
||||
<if test="updatedBy != null and updatedBy != ''">#{updatedBy},</if>
|
||||
<if test="updatedTime != null">#{updatedTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEquItemEquipment" parameterType="EquItemEquipment">
|
||||
update equ_item_equipment
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="connCode != null and connCode != ''">conn_code = #{connCode},</if>
|
||||
<if test="itemCode != null and itemCode != ''">item_code = #{itemCode},</if>
|
||||
<if test="equipmentCode != null and equipmentCode != ''">equipment_code = #{equipmentCode},</if>
|
||||
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
|
||||
<if test="attr1 != null">attr1 = #{attr1},</if>
|
||||
<if test="attr2 != null">attr2 = #{attr2},</if>
|
||||
<if test="attr3 != null">attr3 = #{attr3},</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||
<if test="createdBy != null and createdBy != ''">created_by = #{createdBy},</if>
|
||||
<if test="createdTime != null">created_time = #{createdTime},</if>
|
||||
<if test="updatedBy != null and updatedBy != ''">updated_by = #{updatedBy},</if>
|
||||
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
|
||||
</trim>
|
||||
where id = #{id} and del_flag = '0'
|
||||
</update>
|
||||
|
||||
<delete id="deleteEquItemEquipmentById" parameterType="String">
|
||||
delete from equ_item_equipment where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEquItemEquipmentByIds" parameterType="String">
|
||||
delete from equ_item_equipment where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEquItemEquipmentByItemCode">
|
||||
delete from equ_item_equipment where item_code = #{itemCode}
|
||||
</delete>
|
||||
|
||||
<delete id="delEquItemEquipmentByItemId">
|
||||
update equ_item_equipment
|
||||
set del_flag = '1'
|
||||
where item_code =
|
||||
(select item_code from equ_check_item where item_id = #{itemId})
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue