dingxin 6 years ago
parent
commit
37e338bd1f

+ 6
- 4
whole-estate/src/main/java/com/example/wholeestate/controller/BuildingController.java View File

71
     @ApiOperation(value = "楼盘预约", notes = "楼盘预约")
71
     @ApiOperation(value = "楼盘预约", notes = "楼盘预约")
72
     @ApiImplicitParams({
72
     @ApiImplicitParams({
73
             @ApiImplicitParam(paramType = "Query",dataType = "Integer",name = "pageNum",value = "分页第几页" ),
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
 //    @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token")
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
 //        SysUser sessionUser= getSessionUser(session);
82
 //        SysUser sessionUser= getSessionUser(session);
81
-        ResponseBean  responseBean = iBuildingService.appointmentList(pageNum,pageSize);
83
+        ResponseBean  responseBean = iBuildingService.appointmentList(pageNum,pageSize,buildingId,username);
82
         return responseBean;
84
         return responseBean;
83
     }
85
     }
84
 
86
 

+ 2
- 1
whole-estate/src/main/java/com/example/wholeestate/dao/AppointmentMapper.java View File

4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
 import com.example.wholeestate.model.Appointment;
6
 import com.example.wholeestate.model.Appointment;
7
+import org.apache.ibatis.annotations.Param;
7
 
8
 
8
 /**
9
 /**
9
  * <p>
10
  * <p>
19
      * @param page
20
      * @param page
20
      * @return
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 View File

1
 package com.example.wholeestate.model;
1
 package com.example.wholeestate.model;
2
 
2
 
3
+import com.baomidou.mybatisplus.annotation.TableField;
3
 import com.baomidou.mybatisplus.annotation.TableName;
4
 import com.baomidou.mybatisplus.annotation.TableName;
4
 import java.time.LocalDateTime;
5
 import java.time.LocalDateTime;
5
 import java.io.Serializable;
6
 import java.io.Serializable;
7
+import java.util.List;
8
+
6
 import lombok.Data;
9
 import lombok.Data;
7
 import lombok.EqualsAndHashCode;
10
 import lombok.EqualsAndHashCode;
8
 import lombok.experimental.Accessors;
11
 import lombok.experimental.Accessors;
68
      */
71
      */
69
     private LocalDateTime createDate;
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 View File

41
      * @param
41
      * @param
42
      * @return
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 View File

9
 import com.example.wholeestate.common.uuid.IdGen;
9
 import com.example.wholeestate.common.uuid.IdGen;
10
 import com.example.wholeestate.dao.AppointmentMapper;
10
 import com.example.wholeestate.dao.AppointmentMapper;
11
 import com.example.wholeestate.dao.BuildingMapper;
11
 import com.example.wholeestate.dao.BuildingMapper;
12
+import com.example.wholeestate.dao.CustomerMapper;
13
+import com.example.wholeestate.model.Appointment;
12
 import com.example.wholeestate.model.Building;
14
 import com.example.wholeestate.model.Building;
15
+import com.example.wholeestate.model.Customer;
13
 import com.example.wholeestate.service.IBuildingService;
16
 import com.example.wholeestate.service.IBuildingService;
14
 import com.fasterxml.jackson.databind.util.ArrayBuilders;
17
 import com.fasterxml.jackson.databind.util.ArrayBuilders;
15
 import org.springframework.beans.factory.annotation.Autowired;
18
 import org.springframework.beans.factory.annotation.Autowired;
16
 import org.springframework.stereotype.Service;
19
 import org.springframework.stereotype.Service;
17
 
20
 
18
 import java.time.LocalDateTime;
21
 import java.time.LocalDateTime;
22
+import java.util.ArrayList;
19
 import java.util.Date;
23
 import java.util.Date;
20
 import java.util.HashMap;
24
 import java.util.HashMap;
21
 import java.util.List;
25
 import java.util.List;
36
     @Autowired
40
     @Autowired
37
     private AppointmentMapper AppointmentMapper;
41
     private AppointmentMapper AppointmentMapper;
38
 
42
 
43
+    @Autowired
44
+    private  CustomerMapper customerMapper;
39
     private IdGen idGen = IdGen.get();
45
     private IdGen idGen = IdGen.get();
40
 
46
 
41
     @Override
47
     @Override
61
         ResponseBean response= new ResponseBean();
67
         ResponseBean response= new ResponseBean();
62
         QueryWrapper<Building> buildingtWrapper = new QueryWrapper<>();
68
         QueryWrapper<Building> buildingtWrapper = new QueryWrapper<>();
63
         buildingtWrapper.lambda().eq(Building::getStatus,0);
69
         buildingtWrapper.lambda().eq(Building::getStatus,0);
70
+        buildingtWrapper.lambda().eq(Building::getBuildingId,id);
64
         Building building= buildingMapper.selectOne(buildingtWrapper);
71
         Building building= buildingMapper.selectOne(buildingtWrapper);
65
         response.addSuccess(building);
72
         response.addSuccess(building);
66
         return response;
73
         return response;
94
     }
101
     }
95
 
102
 
96
     @Override
103
     @Override
97
-    public ResponseBean appointmentList(Integer pageNum,Integer pageSize) {
104
+    public ResponseBean appointmentList(Integer pageNum,Integer pageSize,Integer buildingId,String username) {
98
         ResponseBean response= new ResponseBean();
105
         ResponseBean response= new ResponseBean();
99
-        Page<Appendable> page = new Page<>();
106
+        Page<Appointment> page = new Page<>();
100
         page.setSize(pageSize == null ? 10 : pageSize);
107
         page.setSize(pageSize == null ? 10 : pageSize);
101
         page.setCurrent(pageNum == null ? 1 : pageNum);
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
         HashMap hashMap= new HashMap<>();
134
         HashMap hashMap= new HashMap<>();
106
         hashMap.put("list",buildingList);
135
         hashMap.put("list",buildingList);

+ 10
- 0
whole-estate/src/main/resources/mapper/AppointmentMapper.xml View File

4
 
4
 
5
     <select id="appendableList" resultType="com.example.wholeestate.model.Appointment">
5
     <select id="appendableList" resultType="com.example.wholeestate.model.Appointment">
6
         SELECT * FROM ta_appointment
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
     </select>
17
     </select>
8
 </mapper>
18
 </mapper>