瀏覽代碼

新需求

傅行帆 5 年之前
父節點
當前提交
e79215dbd2

+ 3
- 1
src/main/java/com/huiju/estateagents/controller/StatisticalController.java 查看文件

@@ -207,7 +207,9 @@ public class StatisticalController extends BaseController {
207 207
                                                 @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
208 208
                                                 @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
209 209
                                                 @RequestParam(value = "buildingId", required = false) String buildingId,
210
+                                                @RequestParam(value = "sortField", required = false) String sortField,
211
+                                                @RequestParam(value = "sortOrder", required = false) String sortOrder,
210 212
                                                 HttpServletRequest request) {
211
-        return iStatisticalService.getStatsTableList(pageNum,pageSize,getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request));
213
+        return iStatisticalService.getStatsTableList(pageNum,pageSize,getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request),sortField,sortOrder);
212 214
     }
213 215
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java 查看文件

@@ -145,6 +145,6 @@ public interface TaBuildingMapper extends BaseMapper<TaBuilding> {
145 145
      * @param personBuildingList
146 146
      * @return
147 147
      */
148
-    IPage<StatsBuilding> getStatsTableList(IPage<StatsBuilding> page, @Param("orgId") Integer orgId, @Param("startDate")  LocalDate startDate, @Param("endDate")  LocalDate endDate, @Param("buildingId") String buildingId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
148
+    IPage<StatsBuilding> getStatsTableList(IPage<StatsBuilding> page, @Param("orgId") Integer orgId, @Param("startDate")  LocalDate startDate, @Param("endDate")  LocalDate endDate, @Param("buildingId") String buildingId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,@Param("sortField") String sortField,@Param("orderType") String orderType);
149 149
 
150 150
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/IStatisticalService.java 查看文件

@@ -145,5 +145,5 @@ public interface IStatisticalService {
145 145
      * @param taPersonBuildingListByUserId
146 146
      * @return
147 147
      */
148
-    ResponseBean getStatsTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId);
148
+    ResponseBean getStatsTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId,String sortField,String sortOrder);
149 149
 }

+ 8
- 2
src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java 查看文件

@@ -447,9 +447,15 @@ public class StatisticalServiceImpl implements IStatisticalService {
447 447
      * @return
448 448
      */
449 449
     @Override
450
-    public ResponseBean getStatsTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> personBuildingList) {
450
+    public ResponseBean getStatsTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> personBuildingList,String sortField,String sortOrder) {
451
+        String orderType = "asc";
452
+        if ("descend".equals(sortOrder)){
453
+            orderType = "desc";
454
+        }else if ("ascend".equals(sortOrder)){
455
+            orderType = "asc";
456
+        }
451 457
         IPage<StatsBuilding> pg = new Page<>(pageNum, pageSize);
452
-        IPage<StatsBuilding> page = taBuildingMapper.getStatsTableList(pg, orgId, startDate, endDate, buildingId, personBuildingList);
458
+        IPage<StatsBuilding> page = taBuildingMapper.getStatsTableList(pg, orgId, startDate, endDate, buildingId, personBuildingList,sortField,orderType);
453 459
         return ResponseBean.success(page);
454 460
     }
455 461
 

+ 30
- 0
src/main/resources/mapper/TaBuildingMapper.xml 查看文件

@@ -407,6 +407,12 @@
407 407
                 AND a.realty_consultant IS NOT NULL
408 408
                 AND a.realty_consultant != ''
409 409
                 AND a.org_id = #{orgId}
410
+                <if test="startDate != null">
411
+                    and  TO_DAYS(a.create_date) >= TO_DAYS(#{startDate})
412
+                </if>
413
+                <if test="endDate != null">
414
+                    and  TO_DAYS(a.create_date) &lt;= TO_DAYS(#{endDate})
415
+                </if>
410 416
             GROUP BY
411 417
                 a.building_id
412 418
         ) aa ON aa.building_id = t.building_id
@@ -425,6 +431,12 @@
425 431
                     AND b.org_id = #{orgId}
426 432
                     AND IFNULL( b.person_type, '' ) IN ( 'estate agent', 'customer' )
427 433
                     AND b.person_id NOT IN ( SELECT c.person_id FROM ta_recommend_customer c WHERE c.org_id = 84 AND person_id IS NOT NULL AND person_id != '' )
434
+                    <if test="startDate != null">
435
+                        and  TO_DAYS(b.create_date) >= TO_DAYS(#{startDate})
436
+                    </if>
437
+                    <if test="endDate != null">
438
+                        and  TO_DAYS(b.create_date) &lt;= TO_DAYS(#{endDate})
439
+                    </if>
428 440
                 GROUP BY
429 441
                     b.person_id
430 442
             ) bb
@@ -439,11 +451,29 @@
439 451
                 ta_uv u
440 452
             WHERE
441 453
                 u.tagert_type = 'project'
454
+            <if test="startDate != null">
455
+                and  TO_DAYS(u.create_date) >= TO_DAYS(#{startDate})
456
+            </if>
457
+            <if test="endDate != null">
458
+                and  TO_DAYS(u.create_date) &lt;= TO_DAYS(#{endDate})
459
+            </if>
442 460
             GROUP BY
443 461
                 u.be_uv
444 462
         ) uu ON uu.building_id = t.building_id
445 463
         WHERE
446 464
         t.org_id = #{orgId}
465
+        <if test="personBuildingList != null and personBuildingList.size > 0">
466
+            AND t.building_id in
467
+            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
468
+                #{personBuilding.buildingId}
469
+            </foreach>
470
+        </if>
471
+        <if test="buildingId != null and buildingId != '' ">
472
+            AND t.building_id = #{buildingId}
473
+        </if>
474
+        <if test="sortField != null and sortField != ''">
475
+            ORDER BY ${sortField} ${orderType}
476
+        </if>
447 477
     </select>
448 478
 
449 479
 </mapper>