package com.zhongzheng.controller.mock; import com.zhongzheng.common.annotation.Log; import com.zhongzheng.common.core.controller.BaseController; import com.zhongzheng.common.core.domain.AjaxResult; import com.zhongzheng.common.core.page.TableDataInfo; import com.zhongzheng.common.enums.BusinessType; import com.zhongzheng.common.utils.poi.ExcelUtil; import com.zhongzheng.modules.mock.bo.MockApplyAddBo; import com.zhongzheng.modules.mock.bo.MockApplyEditBo; import com.zhongzheng.modules.mock.bo.MockApplyQueryBo; import com.zhongzheng.modules.mock.service.IMockApplyService; import com.zhongzheng.modules.mock.vo.MockApplyVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.Arrays; import java.util.List; /** * 模考安排Controller * * @author ruoyi * @date 2022-05-24 */ @Api(value = "模考安排控制器", tags = {"模考安排管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/mock/apply") public class MockApplyController extends BaseController { private final IMockApplyService iMockApplyService; /** * 查询模考安排列表 */ @ApiOperation("查询模考安排列表") @PreAuthorize("@ss.hasPermi('system:apply:list')") @GetMapping("/list") public TableDataInfo list(MockApplyQueryBo bo) { startPage(); List list = iMockApplyService.queryList(bo); return getDataTable(list); } /** * 导出模考安排列表 */ @ApiOperation("导出模考安排列表") @PreAuthorize("@ss.hasPermi('system:apply:export')") @Log(title = "模考安排", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(MockApplyQueryBo bo) { List list = iMockApplyService.queryList(bo); ExcelUtil util = new ExcelUtil(MockApplyVo.class); return util.exportExcel(list, "模考安排"); } /** * 获取模考安排详细信息 */ @ApiOperation("获取模考安排详细信息") @PreAuthorize("@ss.hasPermi('system:apply:query')") @GetMapping("/{applyId}") public AjaxResult getInfo(@PathVariable("applyId" ) Long applyId) { return AjaxResult.success(iMockApplyService.queryById(applyId)); } /** * 新增模考安排 */ @ApiOperation("新增模考安排") @PreAuthorize("@ss.hasPermi('system:apply:add')") @Log(title = "模考安排", businessType = BusinessType.INSERT) @PostMapping() public AjaxResult add(@RequestBody MockApplyAddBo bo) { return toAjax(iMockApplyService.insertByAddBo(bo) ? 1 : 0); } /** * 修改模考安排 */ @ApiOperation("修改模考安排") @PreAuthorize("@ss.hasPermi('system:apply:edit')") @Log(title = "模考安排", businessType = BusinessType.UPDATE) @PutMapping() public AjaxResult edit(@RequestBody MockApplyEditBo bo) { return toAjax(iMockApplyService.updateByEditBo(bo) ? 1 : 0); } /** * 删除模考安排 */ @ApiOperation("删除模考安排") @PreAuthorize("@ss.hasPermi('system:apply:remove')") @Log(title = "模考安排" , businessType = BusinessType.DELETE) @DeleteMapping("/{applyIds}") public AjaxResult remove(@PathVariable Long[] applyIds) { return toAjax(iMockApplyService.deleteWithValidByIds(Arrays.asList(applyIds), true) ? 1 : 0); } /** * 查询模考安排列表 */ @ApiOperation("查询模考安排列表") @PreAuthorize("@ss.hasPermi('system:apply:list')") @GetMapping("/listApply") public TableDataInfo listApply(MockApplyQueryBo bo) { startPage(); List list = iMockApplyService.listApply(bo); return getDataTable(list); } }