Browse Source

网关管理增加项目和楼宇字段

zhc
zhczyx@163.com 2 weeks ago
parent
commit
e0805c3d00
  1. 3
      data-center-business-controller/src/main/resources/db/migration/V64__getewayclients_update.sql
  2. 3
      data-center-business-dao/src/main/java/com/techsor/datacenter/business/dao/ex/GatewayClientsMapperExt.java
  3. 42
      data-center-business-dao/src/main/resources/mappers/auto/GatewayClientsMapper.xml
  4. 21
      data-center-business-dao/src/main/resources/mappers/ex/GatewayClientsMapperExt.xml
  5. 6
      data-center-business-model/src/main/java/com/techsor/datacenter/business/dto/gateway/GatewayClientsAddParam.java
  6. 6
      data-center-business-model/src/main/java/com/techsor/datacenter/business/dto/gateway/GatewayClientsEditParam.java
  7. 37
      data-center-business-model/src/main/java/com/techsor/datacenter/business/dto/gateway/GatewayClientsQueryResponse.java
  8. 68
      data-center-business-model/src/main/java/com/techsor/datacenter/business/model/GatewayClients.java
  9. 120
      data-center-business-model/src/main/java/com/techsor/datacenter/business/model/GatewayClientsExample.java
  10. 2
      data-center-business-service/src/main/java/com/techsor/datacenter/business/service/GatewayClientsService.java
  11. 8
      data-center-business-service/src/main/java/com/techsor/datacenter/business/service/impl/GatewayClientsServiceImpl.java

3
data-center-business-controller/src/main/resources/db/migration/V64__getewayclients_update.sql

@ -0,0 +1,3 @@
ALTER TABLE `gateway_clients`
ADD COLUMN `project_id` BIGINT NULL DEFAULT 0 AFTER `alert_switch`,
ADD COLUMN `building_id` BIGINT NULL DEFAULT 0 AFTER `project_id`;

3
data-center-business-dao/src/main/java/com/techsor/datacenter/business/dao/ex/GatewayClientsMapperExt.java

@ -4,6 +4,7 @@ import com.techsor.datacenter.business.dao.auto.DeviceInfoMapper;
import com.techsor.datacenter.business.dao.auto.GatewayClientsMapper;
import com.techsor.datacenter.business.dto.device.DeviceSearchParams;
import com.techsor.datacenter.business.dto.gateway.GatewayClientsQueryParam;
import com.techsor.datacenter.business.dto.gateway.GatewayClientsQueryResponse;
import com.techsor.datacenter.business.model.DeviceInfo;
import com.techsor.datacenter.business.model.GatewayClients;
import com.techsor.datacenter.business.vo.asset.ApiDeviceInfoVO;
@ -21,6 +22,6 @@ import java.util.Map;
@Mapper
public interface GatewayClientsMapperExt extends GatewayClientsMapper {
List<GatewayClients> getListPage(@Param("param") GatewayClientsQueryParam param,@Param("companyId") Long companyId);
List<GatewayClientsQueryResponse> getListPage(@Param("param") GatewayClientsQueryParam param, @Param("companyId") Long companyId);
}

42
data-center-business-dao/src/main/resources/mappers/auto/GatewayClientsMapper.xml

@ -19,6 +19,8 @@
<result column="data_amount_threshold_alarm" jdbcType="INTEGER" property="dataAmountThresholdAlarm" />
<result column="data_accumulated_totals" jdbcType="INTEGER" property="dataAccumulatedTotals" />
<result column="alert_switch" jdbcType="INTEGER" property="alertSwitch" />
<result column="project_id" jdbcType="BIGINT" property="projectId" />
<result column="building_id" jdbcType="BIGINT" property="buildingId" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
@ -93,7 +95,7 @@
-->
id, client_id, client_name, address, online_status, last_updata_ts, create_ts, flag,
company_id, data_amount_threshold, data_amount_threshold_alarm, data_accumulated_totals,
alert_switch
alert_switch, project_id, building_id
</sql>
<select id="selectByExample" parameterType="com.techsor.datacenter.business.model.GatewayClientsExample" resultMap="BaseResultMap">
<!--
@ -154,12 +156,14 @@
online_status, last_updata_ts, create_ts,
flag, company_id, data_amount_threshold,
data_amount_threshold_alarm, data_accumulated_totals,
alert_switch)
alert_switch, project_id, building_id
)
values (#{clientId,jdbcType=VARCHAR}, #{clientName,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
#{onlineStatus,jdbcType=INTEGER}, #{lastUpdataTs,jdbcType=BIGINT}, #{createTs,jdbcType=BIGINT},
#{flag,jdbcType=INTEGER}, #{companyId,jdbcType=BIGINT}, #{dataAmountThreshold,jdbcType=INTEGER},
#{dataAmountThresholdAlarm,jdbcType=INTEGER}, #{dataAccumulatedTotals,jdbcType=INTEGER},
#{alertSwitch,jdbcType=INTEGER})
#{alertSwitch,jdbcType=INTEGER}, #{projectId,jdbcType=BIGINT}, #{buildingId,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="com.techsor.datacenter.business.model.GatewayClients">
<!--
@ -207,6 +211,12 @@
<if test="alertSwitch != null">
alert_switch,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="buildingId != null">
building_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="clientId != null">
@ -245,6 +255,12 @@
<if test="alertSwitch != null">
#{alertSwitch,jdbcType=INTEGER},
</if>
<if test="projectId != null">
#{projectId,jdbcType=BIGINT},
</if>
<if test="buildingId != null">
#{buildingId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.techsor.datacenter.business.model.GatewayClientsExample" resultType="java.lang.Long">
@ -303,6 +319,12 @@
<if test="record.alertSwitch != null">
alert_switch = #{record.alertSwitch,jdbcType=INTEGER},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=BIGINT},
</if>
<if test="record.buildingId != null">
building_id = #{record.buildingId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -326,7 +348,9 @@
data_amount_threshold = #{record.dataAmountThreshold,jdbcType=INTEGER},
data_amount_threshold_alarm = #{record.dataAmountThresholdAlarm,jdbcType=INTEGER},
data_accumulated_totals = #{record.dataAccumulatedTotals,jdbcType=INTEGER},
alert_switch = #{record.alertSwitch,jdbcType=INTEGER}
alert_switch = #{record.alertSwitch,jdbcType=INTEGER},
project_id = #{record.projectId,jdbcType=BIGINT},
building_id = #{record.buildingId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -374,6 +398,12 @@
<if test="alertSwitch != null">
alert_switch = #{alertSwitch,jdbcType=INTEGER},
</if>
<if test="projectId != null">
project_id = #{projectId,jdbcType=BIGINT},
</if>
<if test="buildingId != null">
building_id = #{buildingId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
@ -394,7 +424,9 @@
data_amount_threshold = #{dataAmountThreshold,jdbcType=INTEGER},
data_amount_threshold_alarm = #{dataAmountThresholdAlarm,jdbcType=INTEGER},
data_accumulated_totals = #{dataAccumulatedTotals,jdbcType=INTEGER},
alert_switch = #{alertSwitch,jdbcType=INTEGER}
alert_switch = #{alertSwitch,jdbcType=INTEGER},
project_id = #{projectId,jdbcType=BIGINT},
building_id = #{buildingId,jdbcType=BIGINT}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

21
data-center-business-dao/src/main/resources/mappers/ex/GatewayClientsMapperExt.xml

@ -1,12 +1,27 @@
<?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.techsor.datacenter.business.dao.ex.GatewayClientsMapperExt">
<select id="getListPage" resultType="com.techsor.datacenter.business.model.GatewayClients">
<select id="getListPage" resultType="com.techsor.datacenter.business.dto.gateway.GatewayClientsQueryResponse">
select
id as id,client_id as clientId,client_name as clientName,online_status as onlineStatus,last_updata_ts as lastUpdataTs,create_ts as createTs,address as address,
data_amount_threshold, data_amount_threshold_alarm,company_id as companyId,alert_switch as alertSwitch
gateway_clients.id as id,
gateway_clients.client_id as clientId,
gateway_clients.client_name as clientName,
gateway_clients.online_status as onlineStatus,
gateway_clients.last_updata_ts as lastUpdataTs,
gateway_clients.create_ts as createTs,
gateway_clients.address as address,
gateway_clients.data_amount_threshold,
gateway_clients.data_amount_threshold_alarm,
gateway_clients.company_id as companyId,
gateway_clients.alert_switch as alertSwitch,
gateway_clients.project_id as projectId,
gateway_clients.building_id as buildingId,
basic_project.project_name as projectName,
basic_building.name as buildingName
from
gateway_clients
left join basic_project on gateway_clients.project_id = basic_project.id
left join basic_building on gateway_clients.building_id = basic_building.building_id
<where>
<if test="param.clientId != null and param.clientId != ''">
and gateway_clients.client_id = #{param.clientId}

6
data-center-business-model/src/main/java/com/techsor/datacenter/business/dto/gateway/GatewayClientsAddParam.java

@ -24,4 +24,10 @@ public class GatewayClientsAddParam {
@Schema(description ="alert switch", example = "1")
private Integer alertSwitch;
@Schema(description ="project id", example = "1")
private Long projectId;
@Schema(description ="building id", example = "1")
private Long buildingId;
}

6
data-center-business-model/src/main/java/com/techsor/datacenter/business/dto/gateway/GatewayClientsEditParam.java

@ -23,4 +23,10 @@ public class GatewayClientsEditParam {
@Schema(description ="alert switch", example = "1")
private Integer alertSwitch;
@Schema(description ="project id", example = "1")
private Long projectId;
@Schema(description ="building id", example = "1")
private Long buildingId;
}

37
data-center-business-model/src/main/java/com/techsor/datacenter/business/dto/gateway/GatewayClientsQueryResponse.java

@ -0,0 +1,37 @@
package com.techsor.datacenter.business.dto.gateway;
import lombok.Data;
@Data
public class GatewayClientsQueryResponse {
private Long id;
private String clientId;
private String clientName;
private Integer onlineStatus;
private Long lastUpdataTs;
private Long createTs;
private String address;
private Integer dataAmountThreshold;
private Boolean dataAmountThresholdAlarm;
private String companyId;
private Boolean alertSwitch;
private String projectId;
private String buildingId;
private String projectName;
private String buildingName;
}

68
data-center-business-model/src/main/java/com/techsor/datacenter/business/model/GatewayClients.java

@ -120,6 +120,24 @@ public class GatewayClients implements Serializable {
*/
private Integer alertSwitch;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column gateway_clients.project_id
*
* @mbg.generated
*/
private Long projectId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column gateway_clients.building_id
*
* @mbg.generated
*/
private Long buildingId;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table gateway_clients
@ -440,6 +458,54 @@ public class GatewayClients implements Serializable {
this.alertSwitch = alertSwitch;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column gateway_clients.project_id
*
* @return the value of gateway_clients.project_id
*
* @mbg.generated
*/
public Long getProjectId() {
return projectId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column gateway_clients.project_id
*
* @param projectId the value for gateway_clients.project_id
*
* @mbg.generated
*/
public void setProjectId(Long projectId) {
this.projectId = projectId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column gateway_clients.building_id
*
* @return the value of gateway_clients.building_id
*
* @mbg.generated
*/
public Long getBuildingId() {
return buildingId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column gateway_clients.building_id
*
* @param buildingId the value for gateway_clients.building_id
*
* @mbg.generated
*/
public void setBuildingId(Long buildingId) {
this.buildingId = buildingId;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table gateway_clients
@ -465,6 +531,8 @@ public class GatewayClients implements Serializable {
sb.append(", dataAmountThresholdAlarm=").append(dataAmountThresholdAlarm);
sb.append(", dataAccumulatedTotals=").append(dataAccumulatedTotals);
sb.append(", alertSwitch=").append(alertSwitch);
sb.append(", projectId=").append(projectId);
sb.append(", buildingId=").append(buildingId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();

120
data-center-business-model/src/main/java/com/techsor/datacenter/business/model/GatewayClientsExample.java

@ -1003,6 +1003,126 @@ public class GatewayClientsExample {
addCriterion("alert_switch not between", value1, value2, "alertSwitch");
return (Criteria) this;
}
public Criteria andProjectIdIsNull() {
addCriterion("project_id is null");
return (Criteria) this;
}
public Criteria andProjectIdIsNotNull() {
addCriterion("project_id is not null");
return (Criteria) this;
}
public Criteria andProjectIdEqualTo(Long value) {
addCriterion("project_id =", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotEqualTo(Long value) {
addCriterion("project_id <>", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThan(Long value) {
addCriterion("project_id >", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThanOrEqualTo(Long value) {
addCriterion("project_id >=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThan(Long value) {
addCriterion("project_id <", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThanOrEqualTo(Long value) {
addCriterion("project_id <=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdIn(List<Long> values) {
addCriterion("project_id in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotIn(List<Long> values) {
addCriterion("project_id not in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdBetween(Long value1, Long value2) {
addCriterion("project_id between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotBetween(Long value1, Long value2) {
addCriterion("project_id not between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andBuildingIdIsNull() {
addCriterion("building_id is null");
return (Criteria) this;
}
public Criteria andBuildingIdIsNotNull() {
addCriterion("building_id is not null");
return (Criteria) this;
}
public Criteria andBuildingIdEqualTo(Long value) {
addCriterion("building_id =", value, "buildingId");
return (Criteria) this;
}
public Criteria andBuildingIdNotEqualTo(Long value) {
addCriterion("building_id <>", value, "buildingId");
return (Criteria) this;
}
public Criteria andBuildingIdGreaterThan(Long value) {
addCriterion("building_id >", value, "buildingId");
return (Criteria) this;
}
public Criteria andBuildingIdGreaterThanOrEqualTo(Long value) {
addCriterion("building_id >=", value, "buildingId");
return (Criteria) this;
}
public Criteria andBuildingIdLessThan(Long value) {
addCriterion("building_id <", value, "buildingId");
return (Criteria) this;
}
public Criteria andBuildingIdLessThanOrEqualTo(Long value) {
addCriterion("building_id <=", value, "buildingId");
return (Criteria) this;
}
public Criteria andBuildingIdIn(List<Long> values) {
addCriterion("building_id in", values, "buildingId");
return (Criteria) this;
}
public Criteria andBuildingIdNotIn(List<Long> values) {
addCriterion("building_id not in", values, "buildingId");
return (Criteria) this;
}
public Criteria andBuildingIdBetween(Long value1, Long value2) {
addCriterion("building_id between", value1, value2, "buildingId");
return (Criteria) this;
}
public Criteria andBuildingIdNotBetween(Long value1, Long value2) {
addCriterion("building_id not between", value1, value2, "buildingId");
return (Criteria) this;
}
}
/**

2
data-center-business-service/src/main/java/com/techsor/datacenter/business/service/GatewayClientsService.java

@ -18,7 +18,7 @@ import java.util.List;
*/
public interface GatewayClientsService {
PageInfo<GatewayClients> query(GatewayClientsQueryParam param, Long userId, Long companyId, Integer languageType);
PageInfo<GatewayClientsQueryResponse> query(GatewayClientsQueryParam param, Long userId, Long companyId, Integer languageType);
SimpleDataResponse add(GatewayClientsAddParam param, Long userId, Long companyId, Integer languageType);

8
data-center-business-service/src/main/java/com/techsor/datacenter/business/service/impl/GatewayClientsServiceImpl.java

@ -82,9 +82,9 @@ public class GatewayClientsServiceImpl implements GatewayClientsService {
@Override
public PageInfo<GatewayClients> query(GatewayClientsQueryParam param, Long userId, Long companyId, Integer languageType) {
public PageInfo<GatewayClientsQueryResponse> query(GatewayClientsQueryParam param, Long userId, Long companyId, Integer languageType) {
PageHelper.startPage(param.getPageNum() == null ? 1 : param.getPageNum(), param.getPageSize() == null ? 20 : param.getPageSize());
List<GatewayClients> resultList = gatewayClientsMapperExt.getListPage(param,companyId);
List<GatewayClientsQueryResponse> resultList = gatewayClientsMapperExt.getListPage(param,companyId);
return new PageInfo<>(resultList);
}
@ -138,6 +138,8 @@ public class GatewayClientsServiceImpl implements GatewayClientsService {
insertObj.setCompanyId(companyId);
insertObj.setAlertSwitch(param.getAlertSwitch());
insertObj.setDataAmountThreshold(param.getDataAmountThreshold());
insertObj.setBuildingId(param.getBuildingId());
insertObj.setProjectId(param.getProjectId());
this.gatewayClientsMapperExt.insert(insertObj);
//Record log
@ -178,6 +180,8 @@ public class GatewayClientsServiceImpl implements GatewayClientsService {
insertObj.setAddress(param.getAddress());
insertObj.setDataAmountThreshold(param.getDataAmountThreshold());
insertObj.setAlertSwitch(param.getAlertSwitch());
insertObj.setBuildingId(param.getBuildingId());
insertObj.setProjectId(param.getProjectId());
this.gatewayClientsMapperExt.updateByPrimaryKeySelective(insertObj);
//Record log

Loading…
Cancel
Save