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.TacEvalationConfig; import cn.com.goldenwater.dcproj.param.TacEvalationConfigParam; import cn.com.goldenwater.dcproj.service.TacEvalationConfigService; import cn.com.goldenwater.dcproj.vo.TacEvalationConfigVo; 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-9-11 */ @Api(value = "TAC 测评权重配置表管理", tags = "TAC 测评权重配置表管理") @RestController @RequestMapping("/tac/evalation/config") public class TacEvalationConfigController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private TacEvalationConfigService tacEvalationConfigService; @ApiOperation(value = "添加/修改测评权重配置表") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "tacEvalationConfig", value = "TacEvalationConfig", required = true) @RequestBody TacEvalationConfig tacEvalationConfig) { if (StringUtils.isBlank(tacEvalationConfig.getId())) { String uuid = UuidUtil.uuid(); // 生成uuid tacEvalationConfig.setId(uuid); tacEvalationConfigService.insert(tacEvalationConfig); } else { tacEvalationConfigService.update(tacEvalationConfig); } return buildSuccessResponse(tacEvalationConfig); } @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 = tacEvalationConfigService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "根据年份获取测评权重配置表(单表)") @GetMapping("/getConfigsByYear") public BaseResponse getConfigsByYear(@ApiParam(name = "year", value = "year", required = true) @RequestParam String year) { TacEvalationConfigParam tacEvalationConfigParam = new TacEvalationConfigParam(); tacEvalationConfigParam.setYear(Long.parseLong(year)); TacEvalationConfigVo tacEvalationConfig = tacEvalationConfigService.getConfigsByYear(tacEvalationConfigParam); return buildSuccessResponse(tacEvalationConfig); } @ApiOperation(value = "根据ID获取测评权重配置表(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { TacEvalationConfig tacEvalationConfig = tacEvalationConfigService.get(id); return buildSuccessResponse(tacEvalationConfig); } @ApiOperation(value = "获取测评权重配置表(列表所有)") @RequestMapping(value = "/list", method = RequestMethod.POST) public BaseResponse> list(@ApiParam(name = "tacEvalationConfigParam", value = "tacEvalationConfigParam", required = true) @RequestBody TacEvalationConfigParam tacEvalationConfigParam) { List tacEvalationConfigList = tacEvalationConfigService.findList(tacEvalationConfigParam); return buildSuccessResponse(tacEvalationConfigList); } @ApiOperation(value = "获取测评权重配置表(列表--分页)") @RequestMapping(value = "/page", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "tacEvalationConfigParam", value = "tacEvalationConfigParam", required = true) @RequestBody TacEvalationConfigParam tacEvalationConfigParam) { PageInfo tacEvalationConfigList = tacEvalationConfigService.findPageInfo(tacEvalationConfigParam); return buildSuccessResponse(tacEvalationConfigList); } @ApiOperation(value = "添加/修改测评权重配置表") @RequestMapping(value = "/insertConfigByYear", method = RequestMethod.POST) public BaseResponse insertConfigByYear(@ApiParam(name = "tacEvalationConfig", value = "TacEvalationConfig", required = true) @RequestBody TacEvalationConfigVo vo) { tacEvalationConfigService.insertConfigByYear(vo); return buildSuccessResponse(); } }