Browse Source

bug修复

lmstack 3 years ago
parent
commit
10efd84799

+ 4 - 3
src/main/java/cn/fastfun/controller/api/ApiAppDeviceController.java

@@ -167,9 +167,10 @@ public class ApiAppDeviceController {
         query.addParam(QueryParamExp.eq("type", 2));
         query.addParam(QueryParamExp.eq("sn", param.getSn()));
         Page<AppDeviceLog> deviceLogPage = appDeviceLogService.findByParam(query);
-        AppDeviceLog lastDeviceLogPage = deviceLogPage.getContent().get(0);
-//        if ()
-//                deviceLogPage.getContent().get(0);
+        AppDeviceLog lastDeviceLogPage = new AppDeviceLog();
+        if (!deviceLogPage.isEmpty()) {
+            deviceLogPage.getContent().get(0);
+        }
 
 
         AppDevice device = appDeviceService.getOne(new QueryParamExp("sn", param.getSn()));

+ 5 - 8
src/main/java/cn/fastfun/controller/api/ApiAppDeviceLogController.java

@@ -187,17 +187,15 @@ public class ApiAppDeviceLogController {
     @ApiOperation(value = "设备调拨 搜索 & 重置")
     @RequestMapping(value = "transfer/pageQuery", method = RequestMethod.POST)
     public ApiPageDTO transferPageQuery(@RequestBody LogTransferQueryParam param) {
-        StringBuffer sql = new StringBuffer("select t.batch_num,t.operate_id, t.add_time,count(0) as total,t.tf_event,t.tf_device_type,t.tf_used,t.tf_describe,t.out_custom_id,t.operator,t.remarks from app_device_log t where t.type = 2");
+        StringBuffer sql = new StringBuffer("select t.batch_num,t.operate_id, t.add_time,count(0) as total,t.tf_event,t.tf_device_type,t.tf_used,t.tf_describe,t.out_custom_id,t.operator,t.remarks from app_device_log t where t.type = 2 ");
 
         // sn搜索
         if (!StringUtils.isEmpty(param.getSn())) {
-            sql.append(" where t.sn like '%").append(param.getSn()).append("%'");
+            sql.append(" and t.sn like '%").append(param.getSn()).append("%'");
         }
-
         // 类型搜索
         if (!StringUtils.isEmpty(param.getType())) {
-            sql.append(StringUtils.isEmpty(param.getSn()) ? "where" : "and");
-            sql.append(" t.tf_device_type = '").append(param.getType()).append("'");
+            sql.append(" and t.tf_device_type = ").append(param.getType());
         }
         sql.append(" group by t.operate_id");
         if (!StringUtils.isEmpty(param.getOrderBy())) {
@@ -337,13 +335,12 @@ public class ApiAppDeviceLogController {
 
         // sn搜索
         if (!StringUtils.isEmpty(param.getSn())) {
-            sql.append(" where t.sn like '%").append(param.getSn()).append("%'");
+            sql.append(" and t.sn like '%").append(param.getSn()).append("%'");
         }
 
         // 类型搜索
         if (!StringUtils.isEmpty(param.getOutType())) {
-            sql.append(StringUtils.isEmpty(param.getSn()) ? "where" : "and");
-            sql.append(" t.out_type = '").append(param.getOutType()).append("'");
+            sql.append(" and t.out_type = ").append(param.getOutType());
         }
         sql.append(" group by t.operate_id");
         if (!StringUtils.isEmpty(param.getOrderBy())) {

+ 0 - 1
src/main/java/cn/fastfun/controller/param/DeviceOperateQueryParam.java

@@ -19,5 +19,4 @@ public class DeviceOperateQueryParam extends QueryParam {
         addParam(QueryParamExp.eq("operateID", operateID));
     }
 
-
 }

+ 1 - 1
src/main/java/cn/fastfun/controller/param/LogTransferQueryParam.java

@@ -13,6 +13,6 @@ public class LogTransferQueryParam extends QueryParam {
     private String sn;
 
     @ApiModelProperty(value = "调拨类型", name = "type")
-    private String type;
+    private Integer type;
 
 }

+ 1 - 1
src/main/java/cn/fastfun/controller/param/TransferFormParam.java

@@ -21,7 +21,7 @@ public class TransferFormParam {
 
 
     @ApiModelProperty(value = "用途", name = "used", required = true)
-    private Integer used;
+    private String used;
 
 
     @ApiModelProperty(value = "描述", name = "describe", required = true)

+ 1 - 1
src/main/java/cn/fastfun/service/entity/AppDeviceLog.java

@@ -85,7 +85,7 @@ public class AppDeviceLog extends DateEntity {
 
     @ApiModelProperty(value = "用途", name = "tfUsed", required = true)
     @Column(name = "tf_used")
-    private Integer tfUsed;
+    private String tfUsed;
 
 
     @ApiModelProperty(value = "描述", name = "tfDescribe", required = true)