lin 3 år sedan
förälder
incheckning
364dfd524d

+ 3 - 2
zoniot-common/zoniot-core-mysql/pom.xml

@@ -29,8 +29,9 @@
             <version>1.1.9</version>
         </dependency>
         <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>1.2.10</version>
         </dependency>
     </dependencies>
 

+ 1 - 0
zoniot-rmcp/zoniot-rmcp-core/pom.xml

@@ -25,6 +25,7 @@
                 <includes>
                     <include>**/*.xml</include>
                 </includes>
+                <filtering>false</filtering>
             </resource>
             <resource>
                 <directory>src/main/resources</directory>

+ 3 - 1
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/dao/DeviceMapper.java

@@ -2,10 +2,10 @@ package com.zcxk.rmcp.core.dao;
 
 
 import com.zcxk.rmcp.core.entity.Device;
+import org.apache.ibatis.annotations.Param;
 import org.mapstruct.Mapper;
 
 /**
- * 
  * @author linqingwei
  * @date 2021-07-19 9:44
  */
@@ -14,4 +14,6 @@ public interface DeviceMapper {
     int insertSelective(Device record);
 
     int updateByPrimaryKeySelective(Device record);
+
+    Device findById(@Param("id") Long id);
 }

+ 3 - 3
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/entity/Device.java

@@ -70,7 +70,7 @@ public class Device {
     * 设备状态
     */
     @ApiModelProperty(value="设备状态")
-    private Boolean deviceStatus;
+    private Integer deviceStatus;
 
     /**
     * 地址
@@ -112,7 +112,7 @@ public class Device {
     * 阀门状态 0:关,1:开,2:无阀
     */
     @ApiModelProperty(value="阀门状态 0:关,1:开,2:无阀")
-    private Boolean valveStatus;
+    private Integer valveStatus;
 
     /**
     * 最后上报时间
@@ -124,7 +124,7 @@ public class Device {
     * 状态
     */
     @ApiModelProperty(value="状态")
-    private Boolean status;
+    private Integer status;
 
     /**
     * 创建人

+ 4 - 0
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/mapper/DeviceMapper.xml

@@ -247,4 +247,8 @@
     </set>
     where id = #{id}
   </update>
+
+  <select id="findById" resultMap="BaseResultMap">
+  select <include refid="Base_Column_List"/> from rmcp_device where status = 1 and id = #{id}
+  </select>
 </mapper>

+ 8 - 2
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/controller/TestController.java

@@ -1,6 +1,9 @@
 package com.zcxk.rmcp.web.controller;
 
 import com.zcxk.core.common.pojo.AjaxMessage;
+import com.zcxk.rmcp.core.entity.Device;
+import com.zcxk.rmcp.web.service.DeviceService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -16,11 +19,14 @@ import org.springframework.web.bind.annotation.RestController;
 public class TestController {
 
 
+    @Autowired
+    DeviceService deviceService;
 
     @PostMapping("/test")
     public AjaxMessage<Void> test(){
-        System.out.println("test");
-        return AjaxMessage.fail(100,"1");
+        Device device = deviceService.findById(1L);
+        System.out.println(device);
+        return AjaxMessage.success();
     }
 
 }

+ 2 - 0
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/DeviceService.java

@@ -14,4 +14,6 @@ public interface DeviceService{
 
     int updateByPrimaryKeySelective(Device record);
 
+    Device findById(Long id);
+
 }

+ 4 - 0
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/impl/DeviceServiceImpl.java

@@ -26,4 +26,8 @@ public class DeviceServiceImpl implements DeviceService{
         return deviceMapper.updateByPrimaryKeySelective(record);
     }
 
+    @Override
+    public Device findById(Long id) {
+        return deviceMapper.findById(id);
+    }
 }

+ 29 - 7
zoniot-rmcp/zoniot-rmcp-web/src/main/resources/application-dev.properties

@@ -2,22 +2,44 @@ server.port=8325
 spring.application.name=zoniot-rmcp
 logging.level.root=info
 logging.path=./logs/zoniot-rmcp
-#\u6570\u636E\u5E93\u914D\u7F6E
+
+# mysql
 spring.datasource.url=jdbc:mysql://114.135.61.188:33306/rmcp_v2?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
 spring.datasource.username=root
 spring.datasource.password=100Zone@123
 spring.datasource.driver-class-name=com.mysql.jdbc.Driver
 spring.datasource.hikari.max-lifetime=30000
-#mybatis-plus.mapper-locations=classpath:mapper/*.xml
-mybatis-plus.type-aliases-package=com.zcxk.rmcp.core.entity
-mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
-mybatis-plus.global-config.db-config.logic-delete-value=0 
-mybatis-plus.global-config.db-config.logic-not-delete-value=1
+
+# druid
+spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
+spring.datasource.druid.initial-size=5
+spring.datasource.druid.min-idle=5
+spring.datasource.druid.max-active=20
+spring.datasource.druid.max-wait=60000
+spring.datasource.druid.time-between-eviction-runs-millis=60000
+spring.datasource.druid.min-evictable-idle-time-millis=300000
+spring.datasource.druid.validation-query=SELECT 1
+spring.datasource.druid.test-while-idle=true
+spring.datasource.druid.test-on-borrow=true
+spring.datasource.druid.test-on-return=false
+spring.datasource.druid.pool-prepared-statements=true
+spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
+spring.datasource.druid.filters=stat,wall
+spring.datasource.druid.connection-properties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
+
+# mybatis
+mybatis.mapper-locations=classpath:com/zcxk/rmcp/core/mapper/*.xml
+mybatis.type-aliases-package=com.zcxk.rmcp.core.entity
+mybatis.configuration.map-underscore-to-camel-case=true
+mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
+mybatis.configuration.use-column-label=true
+
+
 spring.jackson.time-zone=GMT+8
 #spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
 #spring.jackson.joda-date-time-format: yyyy-MM-dd HH:mm:ss
 
-# mq
+# redis
 spring.redis.host=114.135.61.188
 spring.redis.port=26379
 spring.redis.password=zoniot