package cn.com.goldenwater.dcproj.controller.tac; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.model.TacActiveLog; import cn.com.goldenwater.dcproj.param.TacActiveLogParam; import cn.com.goldenwater.dcproj.service.TacActiveLogService; import cn.com.goldenwater.id.util.UuidUtil; import com.github.pagehelper.PageInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @author lune * @date 2019-10-17 */ @Api(value = "TAC 稽察模块相关日志管理", tags = "TAC 稽察模块相关日志管理") @RestController @RequestMapping("/tac/active/log") public class TacActiveLogController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private TacActiveLogService tacActiveLogService; @ApiOperation(value = "添加/修改稽察模块相关日志") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "tacActiveLog", value = "TacActiveLog", required = true) @RequestBody TacActiveLog tacActiveLog) { if (StringUtils.isBlank(tacActiveLog.getId())) { String uuid = UuidUtil.uuid(); // 生成uuid tacActiveLog.setId(uuid); tacActiveLogService.insert(tacActiveLog); } else { tacActiveLogService.update(tacActiveLog); } return buildSuccessResponse(tacActiveLog); } @ApiOperation(value = "根据ID删除稽察模块相关日志") @RequestMapping(value = "/del/{id}", method = RequestMethod.GET) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = tacActiveLogService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "根据ID获取稽察模块相关日志(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { TacActiveLog tacActiveLog = tacActiveLogService.get(id); return buildSuccessResponse(tacActiveLog); } @ApiOperation(value = "获取稽察模块相关日志(列表所有)") @RequestMapping(value = "/list", method = RequestMethod.POST) public BaseResponse> list(@ApiParam(name = "tacActiveLogParam", value = "tacActiveLogParam", required = true) @RequestBody TacActiveLogParam tacActiveLogParam) { List tacActiveLogList = tacActiveLogService.findList(tacActiveLogParam); return buildSuccessResponse(tacActiveLogList); } @ApiOperation(value = "获取稽察模块相关日志(列表--分页)") @RequestMapping(value = "/page", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "tacActiveLogParam", value = "tacActiveLogParam", required = true) @RequestBody TacActiveLogParam tacActiveLogParam) { PageInfo tacActiveLogList = tacActiveLogService.findPageInfo(tacActiveLogParam); return buildSuccessResponse(tacActiveLogList); } }