仓库信息字段更新1215
This commit is contained in:
@@ -8,6 +8,10 @@ import com.zg.framework.web.domain.BaseEntity;
|
||||
/**
|
||||
* 设备信息对象 device_info
|
||||
*
|
||||
* ✅ 大小仓模型:
|
||||
* - device_info 只落库:warehouse_code(小仓编码)
|
||||
* - parentWarehouseCode / parentWarehouseName 仅联查展示 & 查询过滤,不落库
|
||||
*
|
||||
* @author zg
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@@ -25,19 +29,26 @@ public class DeviceInfo extends BaseEntity {
|
||||
@Excel(name = "设备端口")
|
||||
private Long port;
|
||||
|
||||
/** 所属仓库ID */
|
||||
// @Excel(name = "所属仓库ID")
|
||||
private String warehouseId;
|
||||
/** ✅ 所属小仓编码(落库字段) */
|
||||
private String warehouseCode;
|
||||
|
||||
/** 所属场景ID */
|
||||
// @Excel(name = "所属场景ID")
|
||||
/** 所属场景编码(落库字段) */
|
||||
private String sceneId;
|
||||
|
||||
/** 仓库名称(非数据库字段) */
|
||||
@Excel(name = "仓库名称")
|
||||
/** ======= 非数据库字段 ======= */
|
||||
|
||||
/** ✅ 所属大仓编码(仅查询过滤/展示,不落库) */
|
||||
private String parentWarehouseCode;
|
||||
|
||||
/** 大仓名称(联查字段) */
|
||||
@Excel(name = "大仓名称")
|
||||
private String parentWarehouseName;
|
||||
|
||||
/** 小仓名称(联查字段) */
|
||||
@Excel(name = "小仓名称")
|
||||
private String warehouseName;
|
||||
|
||||
/** 场景名称(非数据库字段) */
|
||||
/** 场景名称(联查字段) */
|
||||
@Excel(name = "场景名称")
|
||||
private String sceneName;
|
||||
|
||||
@@ -45,70 +56,37 @@ public class DeviceInfo extends BaseEntity {
|
||||
@Excel(name = "是否删除", readConverterExp = "0=否,1=是")
|
||||
private String isDelete;
|
||||
|
||||
// Getter & Setter
|
||||
public void setDeviceId(Long deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
// ===== Getter & Setter =====
|
||||
|
||||
public Long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
public Long getDeviceId() { return deviceId; }
|
||||
public void setDeviceId(Long deviceId) { this.deviceId = deviceId; }
|
||||
|
||||
public void setIpAddress(String ipAddress) {
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
public String getIpAddress() { return ipAddress; }
|
||||
public void setIpAddress(String ipAddress) { this.ipAddress = ipAddress; }
|
||||
|
||||
public String getIpAddress() {
|
||||
return ipAddress;
|
||||
}
|
||||
public Long getPort() { return port; }
|
||||
public void setPort(Long port) { this.port = port; }
|
||||
|
||||
public void setPort(Long port) {
|
||||
this.port = port;
|
||||
}
|
||||
public String getWarehouseCode() { return warehouseCode; }
|
||||
public void setWarehouseCode(String warehouseCode) { this.warehouseCode = warehouseCode; }
|
||||
|
||||
public Long getPort() {
|
||||
return port;
|
||||
}
|
||||
public String getSceneId() { return sceneId; }
|
||||
public void setSceneId(String sceneId) { this.sceneId = sceneId; }
|
||||
|
||||
public void setWarehouseId(String warehouseId) {
|
||||
this.warehouseId = warehouseId;
|
||||
}
|
||||
public String getParentWarehouseCode() { return parentWarehouseCode; }
|
||||
public void setParentWarehouseCode(String parentWarehouseCode) { this.parentWarehouseCode = parentWarehouseCode; }
|
||||
|
||||
public String getWarehouseId() {
|
||||
return warehouseId;
|
||||
}
|
||||
public String getParentWarehouseName() { return parentWarehouseName; }
|
||||
public void setParentWarehouseName(String parentWarehouseName) { this.parentWarehouseName = parentWarehouseName; }
|
||||
|
||||
public void setSceneId(String sceneId) {
|
||||
this.sceneId = sceneId;
|
||||
}
|
||||
public String getWarehouseName() { return warehouseName; }
|
||||
public void setWarehouseName(String warehouseName) { this.warehouseName = warehouseName; }
|
||||
|
||||
public String getSceneId() {
|
||||
return sceneId;
|
||||
}
|
||||
public String getSceneName() { return sceneName; }
|
||||
public void setSceneName(String sceneName) { this.sceneName = sceneName; }
|
||||
|
||||
public void setWarehouseName(String warehouseName) {
|
||||
this.warehouseName = warehouseName;
|
||||
}
|
||||
|
||||
public String getWarehouseName() {
|
||||
return warehouseName;
|
||||
}
|
||||
|
||||
public void setSceneName(String sceneName) {
|
||||
this.sceneName = sceneName;
|
||||
}
|
||||
|
||||
public String getSceneName() {
|
||||
return sceneName;
|
||||
}
|
||||
|
||||
public void setIsDelete(String isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
public String getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
public String getIsDelete() { return isDelete; }
|
||||
public void setIsDelete(String isDelete) { this.isDelete = isDelete; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@@ -116,9 +94,11 @@ public class DeviceInfo extends BaseEntity {
|
||||
.append("deviceId", getDeviceId())
|
||||
.append("ipAddress", getIpAddress())
|
||||
.append("port", getPort())
|
||||
.append("warehouseId", getWarehouseId())
|
||||
.append("sceneId", getSceneId())
|
||||
.append("warehouseCode", getWarehouseCode())
|
||||
.append("parentWarehouseCode", getParentWarehouseCode())
|
||||
.append("parentWarehouseName", getParentWarehouseName())
|
||||
.append("warehouseName", getWarehouseName())
|
||||
.append("sceneId", getSceneId())
|
||||
.append("sceneName", getSceneName())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
|
||||
@@ -2,21 +2,25 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.zg.project.information.mapper.DeviceInfoMapper">
|
||||
|
||||
<resultMap type="DeviceInfo" id="DeviceInfoResult">
|
||||
<result property="deviceId" column="device_id" />
|
||||
<result property="ipAddress" column="ip_address" />
|
||||
<result property="port" column="port" />
|
||||
<result property="warehouseId" column="warehouse_id" />
|
||||
<result property="sceneId" column="scene_id" />
|
||||
<result property="warehouseName" column="warehouse_name" />
|
||||
<result property="sceneName" column="scene_name" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="isDelete" column="is_delete" />
|
||||
<resultMap type="com.zg.project.information.domain.DeviceInfo" id="DeviceInfoResult">
|
||||
<result property="deviceId" column="device_id"/>
|
||||
<result property="ipAddress" column="ip_address"/>
|
||||
<result property="port" column="port"/>
|
||||
<result property="warehouseCode" column="warehouse_code"/>
|
||||
<result property="sceneId" column="scene_id"/>
|
||||
<result property="warehouseName" column="warehouse_name"/>
|
||||
<result property="parentWarehouseCode" column="parent_warehouse_code"/>
|
||||
<result property="parentWarehouseName" column="parent_warehouse_name"/>
|
||||
<result property="sceneName" column="scene_name"/>
|
||||
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="isDelete" column="is_delete"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeviceInfoVo">
|
||||
@@ -24,88 +28,129 @@
|
||||
d.device_id,
|
||||
d.ip_address,
|
||||
d.port,
|
||||
d.warehouse_id,
|
||||
d.warehouse_code,
|
||||
d.scene_id,
|
||||
w.warehouse_name AS warehouse_name,
|
||||
s.scene_name AS scene_name,
|
||||
|
||||
w.warehouse_name,
|
||||
w.parent_warehouse_code,
|
||||
w.parent_warehouse_name,
|
||||
|
||||
s.scene_name,
|
||||
|
||||
d.create_by,
|
||||
d.create_time,
|
||||
d.update_by,
|
||||
d.update_time,
|
||||
d.is_delete
|
||||
FROM device_info d
|
||||
LEFT JOIN warehouse_info w ON d.warehouse_id = w.warehouse_code
|
||||
LEFT JOIN scene_mapping s ON d.scene_id = s.scene_code
|
||||
LEFT JOIN warehouse_info w
|
||||
ON d.warehouse_code = w.warehouse_code
|
||||
LEFT JOIN scene_mapping_bak s
|
||||
ON d.scene_id = s.scene_code
|
||||
</sql>
|
||||
|
||||
<select id="selectDeviceInfoList" parameterType="DeviceInfo" resultMap="DeviceInfoResult">
|
||||
<!-- 列表 -->
|
||||
<select id="selectDeviceInfoList"
|
||||
parameterType="com.zg.project.information.domain.DeviceInfo"
|
||||
resultMap="DeviceInfoResult">
|
||||
|
||||
<include refid="selectDeviceInfoVo"/>
|
||||
|
||||
<where>
|
||||
<if test="ipAddress != null and ipAddress != ''"> and d.ip_address = #{ipAddress}</if>
|
||||
<if test="port != null "> and d.port = #{port}</if>
|
||||
<if test="warehouseId != null "> and d.warehouse_id = #{warehouseId}</if>
|
||||
<if test="sceneId != null "> and d.scene_id = #{sceneId}</if>
|
||||
<if test="isDelete != null and isDelete != ''"> and d.is_delete = #{isDelete}</if>
|
||||
<!-- 默认未删除 -->
|
||||
<choose>
|
||||
<when test="isDelete != null and isDelete != ''">
|
||||
AND d.is_delete = #{isDelete}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND d.is_delete = '0'
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
<if test="ipAddress != null and ipAddress != ''">
|
||||
AND d.ip_address = #{ipAddress}
|
||||
</if>
|
||||
|
||||
<if test="port != null">
|
||||
AND d.port = #{port}
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
AND d.warehouse_code = #{warehouseCode}
|
||||
</if>
|
||||
|
||||
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">
|
||||
AND w.parent_warehouse_code = #{parentWarehouseCode}
|
||||
</if>
|
||||
|
||||
<if test="sceneId != null and sceneId != ''">
|
||||
AND d.scene_id = #{sceneId}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
ORDER BY d.device_id DESC
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceInfoByDeviceId" parameterType="Long" resultMap="DeviceInfoResult">
|
||||
<!-- 详情 -->
|
||||
<select id="selectDeviceInfoByDeviceId"
|
||||
parameterType="java.lang.Long"
|
||||
resultMap="DeviceInfoResult">
|
||||
<include refid="selectDeviceInfoVo"/>
|
||||
WHERE d.device_id = #{deviceId}
|
||||
</select>
|
||||
|
||||
<insert id="insertDeviceInfo" parameterType="DeviceInfo">
|
||||
insert into device_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceId != null">device_id,</if>
|
||||
<if test="ipAddress != null">ip_address,</if>
|
||||
<if test="port != null">port,</if>
|
||||
<if test="warehouseId != null">warehouse_id,</if>
|
||||
<if test="sceneId != null">scene_id,</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>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceId != null">#{deviceId},</if>
|
||||
<if test="ipAddress != null">#{ipAddress},</if>
|
||||
<if test="port != null">#{port},</if>
|
||||
<if test="warehouseId != null">#{warehouseId},</if>
|
||||
<if test="sceneId != null">#{sceneId},</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>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
</trim>
|
||||
<!-- 新增 -->
|
||||
<insert id="insertDeviceInfo" parameterType="com.zg.project.information.domain.DeviceInfo">
|
||||
INSERT INTO device_info (
|
||||
ip_address,
|
||||
port,
|
||||
warehouse_code,
|
||||
scene_id,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
is_delete
|
||||
) VALUES (
|
||||
#{ipAddress},
|
||||
#{port},
|
||||
#{warehouseCode},
|
||||
#{sceneId},
|
||||
#{createBy},
|
||||
#{createTime},
|
||||
#{updateBy},
|
||||
#{updateTime},
|
||||
<choose>
|
||||
<when test="isDelete != null and isDelete != ''">#{isDelete}</when>
|
||||
<otherwise>'0'</otherwise>
|
||||
</choose>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateDeviceInfo" parameterType="DeviceInfo">
|
||||
update device_info
|
||||
<!-- 修改 -->
|
||||
<update id="updateDeviceInfo" parameterType="com.zg.project.information.domain.DeviceInfo">
|
||||
UPDATE device_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
|
||||
<if test="ipAddress != null and ipAddress != ''">ip_address = #{ipAddress},</if>
|
||||
<if test="port != null">port = #{port},</if>
|
||||
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
|
||||
<if test="sceneId != null">scene_id = #{sceneId},</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="warehouseCode != null and warehouseCode != ''">warehouse_code = #{warehouseCode},</if>
|
||||
<if test="sceneId != null and sceneId != ''">scene_id = #{sceneId},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="isDelete != null and isDelete != ''">is_delete = #{isDelete},</if>
|
||||
</trim>
|
||||
where device_id = #{deviceId}
|
||||
WHERE device_id = #{deviceId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDeviceInfoByDeviceId" parameterType="Long">
|
||||
delete from device_info where device_id = #{deviceId}
|
||||
<delete id="deleteDeviceInfoByDeviceId" parameterType="java.lang.Long">
|
||||
DELETE FROM device_info WHERE device_id = #{deviceId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDeviceInfoByDeviceIds" parameterType="String">
|
||||
delete from device_info where device_id in
|
||||
<delete id="deleteDeviceInfoByDeviceIds" parameterType="Long">
|
||||
DELETE FROM device_info
|
||||
WHERE device_id IN
|
||||
<foreach item="deviceId" collection="array" open="(" separator="," close=")">
|
||||
#{deviceId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1052,7 +1052,9 @@
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
AND ri.cangku = #{warehouseCode}
|
||||
</if>
|
||||
|
||||
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">
|
||||
AND wh.parent_warehouse_code = #{parentWarehouseCode}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND ri.rk_time <![CDATA[ >= ]]> #{startTime}
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user