package com.artfess.application.controller;
import com.artfess.base.annotation.ApiGroup;
import com.artfess.base.constants.ApiGroupConsts;
import com.artfess.base.controller.BaseController;
import com.artfess.base.model.CommonResult;
import com.artfess.base.query.PageList;
import com.artfess.base.query.QueryFilter;
import com.artfess.base.util.StringUtil;
import com.artfess.sysConfig.persistence.manager.SysLogsManager;
import com.artfess.sysConfig.persistence.model.SysLogs;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
*
* 描述:系统操作日志 控制器类
* 构建组:artfess
* 作者:baseli
* 日期:2021年6月9日15:46:28
*
*/
@RestController
@RequestMapping(value = "/logs/sysLogs/v1")
@Api(tags = "系统操作日志")
@ApiGroup(group = {ApiGroupConsts.GROUP_APPLICATION})
public class SysOptLogsController extends BaseController {
@Resource
SysLogsManager sysLogsManager;
/**
* 系统操作日志列表(分页条件查询)数据
*
* @param queryFilter
* @return
* @throws Exception PageJson
* @throws
*/
@PostMapping("/list")
@ApiOperation(value = "系统操作日志数据列表", httpMethod = "POST", notes = "获取系统操作日志列表")
public PageList list(@ApiParam(name = "queryFilter", value = "查询对象") @RequestBody QueryFilter queryFilter) throws Exception {
return sysLogsManager.query(queryFilter);
}
/**
* 系统操作日志明细页面
*
* @param id
* @return
* @throws Exception ModelAndView
*/
@GetMapping(value = "/get/{id}")
@ApiOperation(value = "根据ID查询系统操作日志", httpMethod = "POST", notes = "根据ID查询系统操作日志")
public SysLogs get(@ApiParam(name = "id", value = "业务对象主键", required = true) @PathVariable String id) throws Exception {
return sysLogsManager.get(id);
}
/**
* 新增系统操作日志
*
* @param sysLogs
* @return
* @throws Exception
* @throws
*/
@PostMapping(value = "save")
@ApiOperation(value = "添加/修改系统操作日志", httpMethod = "POST", notes = "添加/修改系统操作日志")
public CommonResult save(@ApiParam(name = "sysLogs", value = "添加/修改系统操作日志", required = true) @RequestBody SysLogs sysLogs) throws Exception {
String msg = "添加系统操作日志成功";
if (StringUtil.isEmpty(sysLogs.getId())) {
sysLogsManager.create(sysLogs);
} else {
sysLogsManager.update(sysLogs);
msg = "更新系统操作日志成功";
}
return new CommonResult(msg);
}
/**
* 删除系统操作日志记录
*
* @param id
* @return
* @throws Exception
* @throws
*/
@DeleteMapping(value = "remove/{id}")
@ApiOperation(value = "根据ID删除系统操作日志", httpMethod = "POST", notes = "根据ID删除系统操作日志")
public CommonResult remove(@ApiParam(name = "id", value = "业务主键", required = true) @PathVariable String id) throws Exception {
sysLogsManager.remove(id);
return new CommonResult(true, "删除成功");
}
/**
* 批量删除系统操作日志记录
*
* @param ids
* @return
* @throws Exception
* @throws
*/
@DeleteMapping(value = "/removes")
@ApiOperation(value = "根据ID批量删除系统操作日志", httpMethod = "POST", notes = "根据ID批量删除系统操作日志")
public CommonResult removes(@ApiParam(name = "ids", value = "业务主键数组,多个业务主键之间用逗号分隔", required = true) @RequestParam String... ids) throws Exception {
sysLogsManager.removeByIds(ids);
return new CommonResult(true, "删除成功");
}
}