Browse Source

留言 时间范围 关键字搜索

liyuanyuan 1 year ago
parent
commit
bf40c1e736

+ 10 - 2
zxdt-api/src/main/java/api/controller/online/MessageController.java

@@ -94,9 +94,17 @@ public class MessageController extends BaseController {
94 94
     @ApiOperation("留言列表")
95 95
     @Log(title = "查询留言消息列表",businessType = BusinessType.QUERY)
96 96
     @GetMapping("/leavelist")
97
-    public AjaxResult getLeaveList() {
97
+    public AjaxResult getLeaveList(MessageInput input) {
98 98
         LambdaQueryWrapper<Message> qw = new QueryWrapper<Message>().select("kh_user user,count(*) as count,DATE_FORMAT(max(create_time), '%Y-%m-%d %H:%i:%s') as time").lambda();
99
-        qw.eq( Message::getSend, 1).isNull( Message::getKfUser).groupBy(Message::getKhUser);
99
+
100
+        qw.eq( Message::getSend, 1).isNull( Message::getKfUser);
101
+             qw.like(!StringHelper.isEmpty(input.getContent()),  Message::getMsgContent, input.getContent());
102
+
103
+        if (input.getStartTime() != null && input.getEndTime() != null) {
104
+            qw.between(Message::getCreateTime, input.getStartTime(), input.getEndTime());
105
+        }
106
+
107
+       qw .groupBy(Message::getKhUser);
100 108
         List<Map<String,Object>> list=messageService.getMaps(qw);
101 109
 
102 110
         if(list.size()>0) {

+ 8 - 0
zxdt-entity/src/main/java/api/entity/input/online/MessageInput.java

@@ -1,6 +1,9 @@
1 1
 package api.entity.input.online;
2 2
 
3 3
 import lombok.Data;
4
+import org.springframework.format.annotation.DateTimeFormat;
5
+
6
+import java.util.Date;
4 7
 
5 8
 @Data
6 9
 public class MessageInput {
@@ -10,4 +13,9 @@ public class MessageInput {
10 13
     private String content;
11 14
     //用户
12 15
     private String user;
16
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
17
+    private String startTime;
18
+
19
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
20
+    private Date endTime;
13 21
 }