Newer
Older
huludao / src / main / java / com / newfiber / api / pc / controller / LogController.java
package com.newfiber.api.pc.controller;

import com.baomidou.mybatisplus.plugins.Page;
import com.newfiber.api.core.bean.ReqBodyObj;
import com.newfiber.api.core.bean.RespBodyObj;
import com.newfiber.api.core.bean.SysLog;
import com.newfiber.api.pc.service.impl.SyslogService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

/**
 * Created by Administrator on 2019/1/30.
 */
@Controller
@Api(tags = "SYS-99、系统日志管理", position = 199)
public class LogController {
    @Autowired
    private SyslogService syslogService;
    @PostMapping(value = "getLogInfos",produces="application/json;charset=utf-8")
    @ResponseBody
    @com.newfiber.api.core.annotation.SysLog(actionType = "4",value = "查询日志")
    public RespBodyObj<Page<SysLog>> getLogInfo(@RequestBody ReqBodyObj<Map<String,String>> param){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date st = null,et = null;
        try {
            st = sdf.parse(param.getData().get("st"));
            et = sdf.parse(param.getData().get("et"));
        } catch (ParseException e) {
            e.printStackTrace();
            return RespBodyObj.error("查询失败");
        }
        return RespBodyObj.ok(syslogService.getLogs(param.getCurrent(),param.getSize(),st,et));
    }
}