dingxin 6 年之前
父節點
當前提交
37e338bd1f

+ 6
- 4
whole-estate/src/main/java/com/example/wholeestate/controller/BuildingController.java 查看文件

@@ -71,14 +71,16 @@ public class BuildingController extends BaseController {
71 71
     @ApiOperation(value = "楼盘预约", notes = "楼盘预约")
72 72
     @ApiImplicitParams({
73 73
             @ApiImplicitParam(paramType = "Query",dataType = "Integer",name = "pageNum",value = "分页第几页" ),
74
-            @ApiImplicitParam(paramType = "Query",dataType = "Integer",name = "pageSize",value = "pageSize:每页长度" )
74
+            @ApiImplicitParam(paramType = "Query",dataType = "Integer",name = "pageSize",value = "pageSize:每页长度" ),
75
+            @ApiImplicitParam(paramType = "Query",dataType = "Integer",name = "buildingId",value = "buildingId:楼盘ID" ),
76
+            @ApiImplicitParam(paramType = "Query",dataType = "String",name = "username",value = "username:用户名称" )
75 77
 
76 78
     })
77 79
 //    @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token")
78
-    @RequestMapping(value = "/appointmentlsit", method = RequestMethod.GET)
79
-    public ResponseBean appointmentList(@RequestParam("pageNum")Integer pageNum,@RequestParam("pageSize")Integer pageSize, HttpSession session){
80
+    @RequestMapping(value = "/appointmentlist", method = RequestMethod.GET)
81
+    public ResponseBean appointmentList(@RequestParam("pageNum")Integer pageNum,@RequestParam("pageSize")Integer pageSize, HttpSession session,@RequestParam("buildingId")Integer buildingId,@RequestParam("username")String username){
80 82
 //        SysUser sessionUser= getSessionUser(session);
81
-        ResponseBean  responseBean = iBuildingService.appointmentList(pageNum,pageSize);
83
+        ResponseBean  responseBean = iBuildingService.appointmentList(pageNum,pageSize,buildingId,username);
82 84
         return responseBean;
83 85
     }
84 86
 

+ 2
- 1
whole-estate/src/main/java/com/example/wholeestate/dao/AppointmentMapper.java 查看文件

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6 6
 import com.example.wholeestate.model.Appointment;
7
+import org.apache.ibatis.annotations.Param;
7 8
 
8 9
 /**
9 10
  * <p>
@@ -19,7 +20,7 @@ public interface AppointmentMapper extends BaseMapper<Appointment> {
19 20
      * @param page
20 21
      * @return
21 22
      */
22
-    IPage<Appendable> appendableList(Page<Appendable> page);
23
+    IPage<Appointment> appendableList(Page page, @Param("buildingId") Integer buildingId, @Param("username")String username);
23 24
     
24 25
 
25 26
 }

+ 14
- 0
whole-estate/src/main/java/com/example/wholeestate/model/Appointment.java 查看文件

@@ -1,8 +1,11 @@
1 1
 package com.example.wholeestate.model;
2 2
 
3
+import com.baomidou.mybatisplus.annotation.TableField;
3 4
 import com.baomidou.mybatisplus.annotation.TableName;
4 5
 import java.time.LocalDateTime;
5 6
 import java.io.Serializable;
7
+import java.util.List;
8
+
6 9
 import lombok.Data;
7 10
 import lombok.EqualsAndHashCode;
8 11
 import lombok.experimental.Accessors;
@@ -68,5 +71,16 @@ public class Appointment implements Serializable {
68 71
      */
69 72
     private LocalDateTime createDate;
70 73
 
74
+    /**
75
+     * 预约用户
76
+     */
77
+    @TableField(exist = false)
78
+    private List<Character> arrayListUser;
79
+
80
+    /**
81
+     * 预约楼盘
82
+     */
83
+    @TableField(exist = false)
84
+    private List<Building> arrayListbuilding;
71 85
 
72 86
 }

+ 1
- 1
whole-estate/src/main/java/com/example/wholeestate/service/IBuildingService.java 查看文件

@@ -41,7 +41,7 @@ public interface IBuildingService extends IService<Building> {
41 41
      * @param
42 42
      * @return
43 43
      */
44
-    ResponseBean appointmentList(Integer pageNum, Integer pageSize);
44
+    ResponseBean appointmentList(Integer pageNum, Integer pageSize,Integer buildingId,String username);
45 45
 
46 46
     /**
47 47
      * 添加楼盘

+ 33
- 4
whole-estate/src/main/java/com/example/wholeestate/service/impl/BuildingServiceImpl.java 查看文件

@@ -9,13 +9,17 @@ import com.example.wholeestate.common.resp.ResponseBean;
9 9
 import com.example.wholeestate.common.uuid.IdGen;
10 10
 import com.example.wholeestate.dao.AppointmentMapper;
11 11
 import com.example.wholeestate.dao.BuildingMapper;
12
+import com.example.wholeestate.dao.CustomerMapper;
13
+import com.example.wholeestate.model.Appointment;
12 14
 import com.example.wholeestate.model.Building;
15
+import com.example.wholeestate.model.Customer;
13 16
 import com.example.wholeestate.service.IBuildingService;
14 17
 import com.fasterxml.jackson.databind.util.ArrayBuilders;
15 18
 import org.springframework.beans.factory.annotation.Autowired;
16 19
 import org.springframework.stereotype.Service;
17 20
 
18 21
 import java.time.LocalDateTime;
22
+import java.util.ArrayList;
19 23
 import java.util.Date;
20 24
 import java.util.HashMap;
21 25
 import java.util.List;
@@ -36,6 +40,8 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
36 40
     @Autowired
37 41
     private AppointmentMapper AppointmentMapper;
38 42
 
43
+    @Autowired
44
+    private  CustomerMapper customerMapper;
39 45
     private IdGen idGen = IdGen.get();
40 46
 
41 47
     @Override
@@ -61,6 +67,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
61 67
         ResponseBean response= new ResponseBean();
62 68
         QueryWrapper<Building> buildingtWrapper = new QueryWrapper<>();
63 69
         buildingtWrapper.lambda().eq(Building::getStatus,0);
70
+        buildingtWrapper.lambda().eq(Building::getBuildingId,id);
64 71
         Building building= buildingMapper.selectOne(buildingtWrapper);
65 72
         response.addSuccess(building);
66 73
         return response;
@@ -94,13 +101,35 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
94 101
     }
95 102
 
96 103
     @Override
97
-    public ResponseBean appointmentList(Integer pageNum,Integer pageSize) {
104
+    public ResponseBean appointmentList(Integer pageNum,Integer pageSize,Integer buildingId,String username) {
98 105
         ResponseBean response= new ResponseBean();
99
-        Page<Appendable> page = new Page<>();
106
+        Page<Appointment> page = new Page<>();
100 107
         page.setSize(pageSize == null ? 10 : pageSize);
101 108
         page.setCurrent(pageNum == null ? 1 : pageNum);
102
-        IPage<Appendable> building= AppointmentMapper.appendableList(page);
103
-        List<Appendable> buildingList=building.getRecords();
109
+        IPage<Appointment> building= AppointmentMapper.appendableList(page,buildingId,username);
110
+        List<Appointment> buildingList=building.getRecords();
111
+        //预约的用户,
112
+        ArrayList  arrayListUser= new ArrayList<>();
113
+
114
+        //预约的楼盘,
115
+        ArrayList  arrayListbuilding= new ArrayList<>();
116
+       for (Appointment bui:buildingList){
117
+          Building buil= new Building();
118
+           QueryWrapper<Building> buildingtWrapper = new QueryWrapper<>();
119
+           buildingtWrapper.lambda().eq(Building::getStatus,0);
120
+           buildingtWrapper.lambda().eq(Building::getBuildingId,bui.getBuildingId());
121
+           Building bu= buildingMapper.selectOne(buildingtWrapper);
122
+           arrayListUser.add(bu);
123
+
124
+           QueryWrapper<Customer> customerWrapper = new QueryWrapper<>();
125
+           customerWrapper.lambda().eq(Customer::getStatus,0);
126
+           customerWrapper.lambda().eq(Customer::getCustomerId,bui.getCustomerId());
127
+           Customer cust= customerMapper.selectOne(customerWrapper);
128
+           arrayListbuilding.add(cust);
129
+
130
+           bui.setArrayListUser(arrayListUser);
131
+           bui.setArrayListbuilding(arrayListbuilding);
132
+       }
104 133
 
105 134
         HashMap hashMap= new HashMap<>();
106 135
         hashMap.put("list",buildingList);

+ 10
- 0
whole-estate/src/main/resources/mapper/AppointmentMapper.xml 查看文件

@@ -4,5 +4,15 @@
4 4
 
5 5
     <select id="appendableList" resultType="com.example.wholeestate.model.Appointment">
6 6
         SELECT * FROM ta_appointment
7
+      <where>
8
+        <if test="buildingId != null and buildingId != ''">
9
+            and  ta_appointment.building_id like concat('%',#{buildingId,jdbcType=INTEGER},'%')
10
+        </if>
11
+
12
+          <if test="username != null and username != ''">
13
+              and  ta_appointment.customer_name like concat('%',#{username,jdbcType=VARCHAR},'%')
14
+          </if>
15
+
16
+      </where>
7 17
     </select>
8 18
 </mapper>