package com.zt.life.modules.sysBaseInfo.controller; import com.zt.common.annotation.LogOperation; import com.zt.common.constant.Constant; import com.zt.common.annotation.QueryParam; import com.zt.common.db.query.QueryFilter; import com.zt.common.servlet.Result; import com.zt.common.servlet.PageResult; import com.zt.common.validator.AssertUtils; import com.zt.common.validator.ValidatorUtils; import com.zt.common.validator.group.AddGroup; import com.zt.common.validator.group.DefaultGroup; import com.zt.common.validator.group.UpdateGroup; import com.zt.life.modules.sysBaseInfo.model.TestAgencyInfo; import com.zt.life.modules.sysBaseInfo.service.TestAgencyInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * test_agency_info * * @author zt generator * @since 1.0.0 2023-11-08 */ @RestController @RequestMapping("/sysBaseInfo/TestAgencyInfo/") @Api(tags="test_agency_info") public class TestAgencyInfoController { @Autowired private TestAgencyInfoService testAgencyInfoService; @GetMapping("page") @ApiOperation("分页") @ApiImplicitParams({ @ApiImplicitParam(name = Constant.Q.PAGE, value = Constant.QV.PAGE, required = true, dataType = Constant.QT.INT), @ApiImplicitParam(name = Constant.Q.LIMIT, value = Constant.QV.LIMIT, required = true, dataType = Constant.QT.INT), @ApiImplicitParam(name = Constant.Q.ORDER_FIELD, value = Constant.QV.ORDER_FIELD, dataType = Constant.QT.STRING), @ApiImplicitParam(name = Constant.Q.ORDER, value = Constant.QV.ORDER, dataType = Constant.QT.STRING), @ApiImplicitParam(name = "agencyName", value = "测评机构名称", dataType = Constant.QT.STRING, format = "agency_name^LK") }) public PageResult page(@ApiIgnore @QueryParam QueryFilter queryFilter){ return PageResult.ok(testAgencyInfoService.page(queryFilter)); } @GetMapping("{id}") @ApiOperation("信息") public Result get(@PathVariable("id") Long id){ TestAgencyInfo data = testAgencyInfoService.get(id); return Result.ok(data); } @PostMapping @ApiOperation("新增") @LogOperation("新增") public Result insert(@RequestBody TestAgencyInfo testAgencyInfo){ //效验数据 ValidatorUtils.validateEntity(testAgencyInfo, AddGroup.class, DefaultGroup.class); testAgencyInfoService.insert(testAgencyInfo); return Result.ok(); } @PutMapping @ApiOperation("修改") @LogOperation("修改") public Result update(@RequestBody TestAgencyInfo testAgencyInfo){ //效验数据 ValidatorUtils.validateEntity(testAgencyInfo, UpdateGroup.class, DefaultGroup.class); testAgencyInfoService.update(testAgencyInfo); return Result.ok(); } @DeleteMapping @ApiOperation("删除") @LogOperation("删除") public Result delete(@RequestBody Long[] ids){ //效验数据 AssertUtils.isArrayEmpty(ids, "id"); testAgencyInfoService.delete(ids); return Result.ok(); } }