Quellcode durchsuchen

项目、资讯、活动 排序规则

魏熙美 vor 5 Jahren
Ursprung
Commit
625a533046

+ 15
- 16
src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java Datei anzeigen

@@ -24,6 +24,7 @@ import java.util.ArrayList;
24 24
 import java.util.HashMap;
25 25
 import java.util.List;
26 26
 import java.util.Map;
27
+import java.util.stream.Collectors;
27 28
 
28 29
 /**
29 30
  * <p>
@@ -278,7 +279,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
278 279
         if (CollectionUtils.isNotEmpty(buildingProjectTypeArray)) {
279 280
             taBuildingProjectTypeMapper.insertBuildingProjectTypeBatch(buildingProjectTypeArray, building.getBuildingId());
280 281
         }
281
-        return ResponseBean.success("");
282
+        return ResponseBean.success(building);
282 283
     }
283 284
 
284 285
     @Override
@@ -311,13 +312,13 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
311 312
         List<TaBuildingImg> buildingImgs = JSONObject.parseArray(imgStr, TaBuildingImg.class);
312 313
 
313 314
         if (CollectionUtils.isNotEmpty(buildingImgs)) {
314
-            insertImgBatch(buildingImgs, building.getBuildingId());
315
+            buildingImgs = insertImgBatch(buildingImgs, building.getBuildingId());
315 316
         }
316 317
 
317 318
         String tagStr = object.getString("tag");
318 319
         List<TaBuildingTag> buildingTags = JSONObject.parseArray(tagStr, TaBuildingTag.class);
319 320
         if (CollectionUtils.isNotEmpty(buildingTags)) {
320
-            insertTagBatch(buildingTags, building.getBuildingId());
321
+            buildingTags = insertTagBatch(buildingTags, building.getBuildingId());
321 322
         }
322 323
 
323 324
         // 项目类型
@@ -326,7 +327,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
326 327
             taBuildingProjectTypeMapper.insertBuildingProjectTypeBatch(buildingProjectTypeArray, building.getBuildingId());
327 328
         }
328 329
 
329
-        return ResponseBean.success("");
330
+        return ResponseBean.success(building);
330 331
     }
331 332
 
332 333
     @Override
@@ -637,9 +638,8 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
637 638
     }
638 639
 
639 640
 
640
-    int insertImgBatch(List<TaBuildingImg> imgs, String buildingId) {
641
-        int rows = 0;
642
-        for (TaBuildingImg img: imgs){
641
+    private List<TaBuildingImg> insertImgBatch(List<TaBuildingImg> imgs, String buildingId) {
642
+        return imgs.stream().map(img -> {
643 643
             TaBuildingImg Images = new TaBuildingImg();
644 644
             Images.setBuildingId(buildingId);
645 645
             Images.setImgType(img.getImgType());
@@ -647,21 +647,20 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
647 647
             Images.setOrderNo(Integer.valueOf(img.getOrderNo()));
648 648
             Images.setStatus(1);
649 649
             Images.setCreateDate(LocalDateTime.now());
650
-            rows += taBuildingImgMapper.insert(Images);
651
-        }
650
+            taBuildingImgMapper.insert(Images);
652 651
 
653
-        return rows;
652
+            return Images;
653
+        }).collect(Collectors.toList());
654 654
     }
655 655
 
656
-    int insertTagBatch(List<TaBuildingTag> tags, String buildingId) {
657
-        int rows = 0;
658
-        for (TaBuildingTag tag:tags){
656
+    private List<TaBuildingTag> insertTagBatch(List<TaBuildingTag> tags, String buildingId) {
657
+        return tags.stream().map(tag -> {
659 658
             TaBuildingTag btag = new TaBuildingTag();
660 659
             btag.setBuildingId(buildingId);
661 660
             btag.setTagName(tag.getTagName());
662
-            rows += taBuildingTagMapper.insert(btag);
663
-        }
664
-        return rows;
661
+            taBuildingTagMapper.insert(btag);
662
+            return btag;
663
+        }).collect(Collectors.toList());
665 664
     }
666 665
 
667 666
     int insertApartmentImgBatch(List<TaBuildingImg> imgs, String buildingId, String apartmentId) {

+ 2
- 0
src/main/java/com/huiju/estateagents/service/impl/TaNewsServiceImpl.java Datei anzeigen

@@ -72,6 +72,7 @@ public class TaNewsServiceImpl extends ServiceImpl<TaNewsMapper, TaNews> impleme
72 72
         taNewsQueryWrapper.eq(newsStatus != null, "news_status", newsStatus);
73 73
         taNewsQueryWrapper.eq("status", 1);
74 74
         taNewsQueryWrapper.like(title!=null,"news_name", title);
75
+        taNewsQueryWrapper.orderByAsc("news_status");
75 76
         taNewsQueryWrapper.orderByDesc("weight","create_date");
76 77
         IPage<TaNews> taNewsIPage = this.page(page, taNewsQueryWrapper);
77 78
 
@@ -126,6 +127,7 @@ public class TaNewsServiceImpl extends ServiceImpl<TaNewsMapper, TaNews> impleme
126 127
 
127 128
         taNews.setCreateDate(LocalDateTime.now());
128 129
         taNews.setStatus(1);
130
+        taNews.setNewsStatus(1);
129 131
         this.save(taNews);
130 132
         responseBean.addSuccess(taNews);
131 133
         return responseBean;

+ 1
- 1
src/main/resources/mapper/TaBuildingDynamicMapper.xml Datei anzeigen

@@ -42,7 +42,7 @@
42 42
         <if test="time != null">
43 43
             and TO_DAYS(tbd.create_date) = TO_DAYS(#{time})
44 44
         </if>
45
-        ORDER BY tbd.create_date DESC
45
+        ORDER BY tbd.activity_status asc, tbd.create_date DESC
46 46
   </select>
47 47
 
48 48
     <select id="iBuildingDynamicSelectId" parameterType="string" resultType="com.huiju.estateagents.entity.TaBuildingDynamic">

+ 1
- 1
src/main/resources/mapper/TaBuildingMapper.xml Datei anzeigen

@@ -23,7 +23,7 @@
23 23
             <if test="cityId != null and cityId != ''">
24 24
                 and  ta_building.city_id =#{cityId}
25 25
             </if>
26
-            <if test="isMain != null and isMain != ''">
26
+            <if test="isMain != null">
27 27
                 and  ta_building.is_main = #{isMain}
28 28
             </if>
29 29
             <if test="orgId != null">