xujunwei 1 год назад
Родитель
Сommit
c9f5ec5208

+ 6 - 0
src/main/java/com/genersoft/iot/vmp/extend/controller/ExtendDeviceController.java

@@ -17,6 +17,12 @@ public class ExtendDeviceController {
 
     @PostMapping("/page")
     public PageInfo<ExtendDevice> page(@RequestBody ExtendDevicePageDto dto) {
+        if (dto.getPageNum() == 0) {
+            dto.setPageNum(1);
+        }
+        if (dto.getPageSize() == 0) {
+            dto.setPageSize(10);
+        }
         return deviceService.page(dto);
     }
 

+ 4 - 1
src/main/java/com/genersoft/iot/vmp/extend/service/ExtendDeviceService.java

@@ -10,6 +10,8 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
 public class ExtendDeviceService extends ServiceImpl<ExtendDeviceMapper, ExtendDevice> {
 
@@ -23,7 +25,8 @@ public class ExtendDeviceService extends ServiceImpl<ExtendDeviceMapper, ExtendD
         LambdaQueryWrapper<ExtendDevice> lqw = new LambdaQueryWrapper<>();
         lqw.like(StrUtil.isNotBlank(dto.getName()),ExtendDevice :: getName,dto.getName());
         lqw.like(StrUtil.isNotBlank(dto.getDeviceId()),ExtendDevice :: getDeviceId,dto.getDeviceId());
-        return new PageInfo<>(this.list());
+        List<ExtendDevice> rsList = list(lqw);
+        return new PageInfo<>(rsList);
     }
 
 }

+ 38 - 1
src/main/resources/application-local.yml

@@ -60,7 +60,7 @@ sip:
   # 如果要监听多张网卡,可以使用逗号分隔多个IP, 例如: 192.168.1.4,10.0.0.4
   # 如果不明白,就使用0.0.0.0,大部分情况都是可以的
   # 请不要使用127.0.0.1,任何包括localhost在内的域名都是不可以的。
-  ip: 192.168.0.102
+  ip: 192.168.0.100
   # [可选] 28181服务监听的端口
   port: 8116
   # 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007)
@@ -114,3 +114,40 @@ user-settings:
 logging:
   config: classpath:logback-spring-local.xml
 
+
+# mybatis-plus相关配置
+mybatis-plus:
+  # xml扫描,多个目录用逗号或者分号分隔(告诉 Mapper 所对应的 XML 文件位置)
+  mapper-locations: classpath:mapper/*/*Mapper.xml
+  type-aliases-package: com.*.mapper
+  # 以下配置均有默认值,可以不设置
+  global-config:
+    #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+    id-type: 0
+    #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+    field-strategy: 2
+    #驼峰下划线转换
+    db-column-underline: true
+    #刷新mapper 调试神器
+    refresh-mapper: false
+    #数据库大写下划线转换
+    #capital-mode: true
+    #序列接口实现类配置
+    #key-generator: com.baomidou.springboot.xxx
+    #逻辑删除配置
+    #logic-delete-value: 0 # 逻辑已删除值(默认为 1)
+    #logic-not-delete-value: 1 # 逻辑未删除值(默认为 0)
+    #自定义填充策略接口实现
+    #    meta-object-handler: com.zhengqing.config.MyMetaObjectHandler
+    #自定义SQL注入器
+    #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    # 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+    # 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段
+    #    call-setters-on-nulls: true
+    # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    # 解决oracle更新数据为null时无法转换报错,mysql不会出现此情况
+    jdbc-type-for-null: 'null'