Browse Source

Merge remote-tracking branch 'origin/master'

Administrator 2 years ago
parent
commit
173cc816e4

+ 7 - 2
mhotel/src/com/happy/action/adminManagerAction.java

@@ -169,8 +169,13 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
             List<FileInfo> fileInfoList = JSONArray.parseArray(fileListJson, FileInfo.class);
             if(fileInfoList!=null && fileInfoList.size()>0){
                 for(FileInfo file : fileInfoList){
+                    FileInfo fileInfo = fileService.getById(file.getId());
                     file.setLinkId(admin.getId());
-                    fileService.updateFile(file);
+                    if(fileInfo==null){
+                        fileService.insertFile(file);
+                    }else{
+                        fileService.updateFile(file);
+                    }
                 }
             }
             int m = adminManagerService.insertAdmin(admin);
@@ -253,10 +258,10 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
                 }
                 for(FileInfo file : fileInfoList){
                     FileInfo fileInfo = fileService.getById(file.getId());
+                    file.setLinkId(admin.getId());
                     if(fileInfo==null){
                         fileService.insertFile(file);
                     }else{
-                        file.setLinkId(admin.getId());
                         fileService.updateFile(file);
                     }
                 }

+ 1 - 1
mhotel/src/com/happy/action/hotelAction.java

@@ -112,10 +112,10 @@ public class hotelAction extends ActionSupport implements ServletRequestAware {
                 }
                 for(FileInfo file : fileList){
                     FileInfo fileInfo = fileService.getById(file.getId());
+                    file.setLinkId(hotelId);
                     if(fileInfo==null){
                         fileService.insertFile(file);
                     }else{
-                        file.setLinkId(hotelId);
                         fileService.updateFile(file);
                     }
                 }

+ 14 - 3
mhotel/src/com/happy/action/houseAction.java

@@ -37,6 +37,7 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
     public HotelDictService hotelDictService;
 
     public Integer id;
+    public Integer managerId;
     public String hName;//房型名称
     public int page; // 当前页
     public int rows;// 每页显示的行数rows
@@ -113,7 +114,11 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
             if (m > 0) {
                 for(FileInfo file : fileList){
                     file.setLinkId(house.getId());
-                    fileService.updateFile(file);
+                    if(file==null){
+                        fileService.insertFile(file);
+                    }else{
+                        fileService.updateFile(file);
+                    }
                 }
                 resultJson.put("message", "新增成功");
                 resultJson.put("code", 200);
@@ -192,10 +197,10 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
                 }
                 for(FileInfo file : fileList){
                     FileInfo fileInfo = fileService.getById(file.getId());
+                    file.setLinkId(house.getId());
                     if(fileInfo==null){
                         fileService.insertFile(file);
                     }else{
-                        file.setLinkId(house.getId());
                         fileService.updateFile(file);
                     }
                 }
@@ -287,7 +292,10 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
         JSONObject resultJson = new JSONObject();
         StringBuilder s1 = new StringBuilder("");
         if (hName!=null){
-            s1.append(" and h_name like '%").append(hName).append("'");
+            s1.append(" and h_name like '%").append(hName).append("%'");
+        }
+        if (hName!=null){
+            s1.append(" and manager_id = '").append(managerId).append("'");
         }
         IPage<House> houseIPage = houseService.queryPage(s1.toString(),page,rows);
         if(houseIPage!=null && !"".equals(houseIPage)){
@@ -316,6 +324,9 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
         if (hName!=null){
             s1.append("  and house_name like '%").append(hName).append("%'");
         }
+        if (managerId!=null){
+            s1.append("  and manager_id = '").append(managerId).append("'");
+        }
         IPage<HouseSumEto> houseIPage = houseService.queryPageHouseSum(s1.toString(),page,rows);
         if(houseIPage!=null && !"".equals(houseIPage)){
             resultJson.put("message", "查询分页成功");