com.didiglobal.logi.security.controller.v1.MessageController Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of logi-security-spring-boot-starter Show documentation
Show all versions of logi-security-spring-boot-starter Show documentation
logi-security 提供项目大多都需要的一些基础功能(用户、角色、权限、登录、注册、操作记录)
package com.didiglobal.logi.security.controller.v1;
import com.didiglobal.logi.security.common.constant.Constants;
import com.didiglobal.logi.security.common.Result;
import com.didiglobal.logi.security.common.vo.message.MessageVO;
import com.didiglobal.logi.security.service.MessageService;
import com.didiglobal.logi.security.util.HttpRequestUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @author cjm
*/
@RestController
@Api(value = "logi-security-message相关API接口", tags = "logi-security-消息相关API接口")
@RequestMapping(Constants.V1 + "/logi-security/message")
public class MessageController {
@Autowired
private MessageService messageService;
@GetMapping(value = {"/list/{readTag}", "/list"})
@ApiOperation(value = "获取所有消息", notes = "根据是否读已读获取消息")
@ApiImplicitParam(name = "readTag", value = "消息状态(true已读,false未读,null全部)", dataType = "Boolean")
public Result> list(@PathVariable(required = false) Boolean readTag, HttpServletRequest request) {
// 获取当前用户id
Integer userId = HttpRequestUtil.getOperatorId(request);
List messageVOList = messageService.getMessageListByUserIdAndReadTag(userId, readTag);
return Result.success(messageVOList);
}
@PutMapping("/switch")
@ApiOperation(value = "更改消息状态", notes = "调用该接口则消息状态被反转")
public Result switched(@RequestBody @ApiParam(name = "idList", value = "消息idList") List idList) {
messageService.changeMessageStatus(idList);
return Result.success();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy