Merge branch 'sy'
commit
5689ca1157
|
@ -0,0 +1,60 @@
|
|||
package com.muyu.master.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.market.domian.Logs;
|
||||
import com.muyu.master.service.LogsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/master")
|
||||
@Tag(name = "日志列表",description = "记录客户相关操作")
|
||||
public class LogsController {
|
||||
|
||||
@Autowired
|
||||
private LogsService service;
|
||||
|
||||
/**
|
||||
* 查询日志列表
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "查询日志列表",description = "查询用户操作日志列表")
|
||||
@GetMapping("/list")
|
||||
public Result<List<Logs>> show(){
|
||||
List<Logs> list=service.showList();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除信息
|
||||
* @param logsId
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "根据id删除日志",description = "根据id删除")
|
||||
@DeleteMapping("/{logsId}")
|
||||
public Result<String> delete(@PathVariable("logsId") Long logsId){
|
||||
service.removeById(logsId);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询信息
|
||||
* @param logsId
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "根据id获取信息",description = "根据id获取信息")
|
||||
@GetMapping("/{logsId}")
|
||||
public Result<Logs> findById(@PathVariable("logsId") Long logsId){
|
||||
service.getById(logsId);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.muyu.master.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.market.domian.Logs;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface LogsMapper extends BaseMapper<Logs> {
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.muyu.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.market.domian.Logs;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface LogsService extends IService<Logs> {
|
||||
|
||||
List<Logs> showList();
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.muyu.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.market.domian.Logs;
|
||||
import com.muyu.master.mapper.LogsMapper;
|
||||
import com.muyu.master.service.LogsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class LogsServiceImpl
|
||||
extends ServiceImpl<LogsMapper, Logs>
|
||||
implements LogsService {
|
||||
|
||||
@Autowired
|
||||
private LogsMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<Logs> showList() {
|
||||
|
||||
LambdaQueryWrapper<Logs> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(Logs::getLogsId);//根据用户id查询
|
||||
List<Logs> list = this.list();
|
||||
|
||||
list.stream().map(Logs::getLogsId).collect(Collectors.toSet());
|
||||
return this.list(queryWrapper)
|
||||
.stream()
|
||||
.toList();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue