|
@@ -0,0 +1,55 @@
|
|
|
+package com.sky.ioc.service.message.impl;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.sky.ioc.entity.domain.message.Message;
|
|
|
+import com.sky.ioc.enums.MessageTypeEnums;
|
|
|
+import com.sky.ioc.mapper.message.MessageMapper;
|
|
|
+import com.sky.ioc.service.message.MessageService;
|
|
|
+import com.sky.ioc.tool.ReturnMsg;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class MessageServiceImpl implements MessageService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ MessageMapper messageMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ReturnMsg getList() {
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ List<String> types = MessageTypeEnums.getValues();
|
|
|
+ for(String type:types){
|
|
|
+ List<Message> messages = messageMapper.selectList(new LambdaQueryWrapper<Message>().eq(Message::getType,type));
|
|
|
+ json.put(type,messages);
|
|
|
+ }
|
|
|
+ return ReturnMsg.ok(json);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ReturnMsg getTypeList() {
|
|
|
+ List<String> types = MessageTypeEnums.getValues();
|
|
|
+ return ReturnMsg.ok(types);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ReturnMsg search(String name, String type, String start_time, String end_time) {
|
|
|
+ LambdaQueryWrapper<Message> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ if(StringUtils.isNotBlank(name)){
|
|
|
+ lambdaQueryWrapper.eq(Message::getName,name);
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(type)){
|
|
|
+ lambdaQueryWrapper.eq(Message::getType,type);
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(start_time)&&StringUtils.isNotBlank(end_time)){
|
|
|
+ lambdaQueryWrapper.between(Message::getSend_time,start_time,end_time);
|
|
|
+ }
|
|
|
+ List<Message> list = messageMapper.selectList(lambdaQueryWrapper);
|
|
|
+ return ReturnMsg.ok(list);
|
|
|
+ }
|
|
|
+}
|