| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- package com.keao.edu.user.controller;
- import com.keao.edu.common.controller.BaseController;
- import com.keao.edu.common.entity.HttpResponseResult;
- import com.keao.edu.common.page.PageInfo;
- import com.keao.edu.common.tenant.TenantContextHolder;
- import com.keao.edu.user.entity.ExamLocation;
- import com.keao.edu.user.page.ExamLocationQueryInfo;
- import com.keao.edu.user.service.ExamLocationService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiImplicitParam;
- import io.swagger.annotations.ApiOperation;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.Date;
- import java.util.List;
- /**
- * @Author Joburgess
- * @Date 2020.06.16
- */
- @RestController
- @RequestMapping("examLocation")
- @Api(tags = "线下考点服务")
- public class ExamLocationController extends BaseController {
- @Autowired
- private ExamLocationService examLocationService;
- @ApiOperation("分页查询")
- @GetMapping(value = "/list")
- public HttpResponseResult<PageInfo<ExamLocation>> getList(ExamLocationQueryInfo queryInfo) {
- if(StringUtils.isBlank(queryInfo.getSearch())){
- queryInfo.setSearch(null);
- }
- return succeed(examLocationService.queryPage(queryInfo));
- }
- @ApiOperation("获取所在机构所有考点")
- @GetMapping(value = "/getTenantAllLocations")
- public HttpResponseResult<List<ExamLocation>> getTenantAllLocations(){
- return succeed(examLocationService.getTenantAllLocations(TenantContextHolder.getTenantId()));
- }
- @ApiOperation("查询考点详情")
- @ApiImplicitParam(name = "id", value = "机构ID", required = true, dataType = "Integer", paramType = "path")
- @GetMapping(value = "/query")
- public HttpResponseResult<ExamLocation> query(Integer id) {
- return succeed(examLocationService.get(id));
- }
- @ApiOperation("新增考点")
- @PostMapping(value = "/add")
- public HttpResponseResult add(@RequestBody ExamLocation examLocation) {
- examLocation.setTenantId(TenantContextHolder.getTenantId());
- examLocation.setIsAvailable(true);
- examLocationService.insert(examLocation);
- return succeed();
- }
- @ApiOperation("更新考点")
- @PostMapping(value = "/update")
- public HttpResponseResult update(@RequestBody ExamLocation examLocation) {
- examLocation.setUpdateTime(new Date());
- examLocationService.update(examLocation);
- return succeed();
- }
- @ApiOperation("删除考点")
- @PostMapping(value = "/del")
- public HttpResponseResult add(Integer id) {
- return succeed(examLocationService.delete(id));
- }
- }
|