package com.ruoyi.safety.controller;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.safety.pojo.SafetyTrainingRecord;
|
import com.ruoyi.safety.service.SafetyTrainingRecordService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.servlet.http.HttpServletResponse;
|
import java.util.List;
|
|
/**
|
* 安环管理-培训完成记录接口。
|
*/
|
@RestController
|
@Api(tags = "安环管理-培训完成记录")
|
@RequestMapping("/safety/training/record")
|
public class SafetyTrainingRecordController extends SafetyControllerSupport {
|
|
@Autowired
|
private SafetyTrainingRecordService recordService;
|
|
/**
|
* 分页查询培训完成记录。
|
*/
|
@Log(title = "安环管理-培训完成记录-分页查询", businessType = BusinessType.OTHER)
|
@ApiOperation("分页查询培训完成记录")
|
@GetMapping("/list")
|
public AjaxResult list(Page<SafetyTrainingRecord> page, SafetyTrainingRecord query,
|
@RequestParam(value = "pageNum", required = false) Long pageNum,
|
@RequestParam(value = "pageSize", required = false) Long pageSize) {
|
return AjaxResult.success(recordService.queryPage(buildPage(page, pageNum, pageSize), query));
|
}
|
|
/**
|
* add training completion record.
|
*/
|
@Log(title = "safety-training-record-add", businessType = BusinessType.INSERT)
|
@ApiOperation("add safety training completion record")
|
@PostMapping("/add")
|
public AjaxResult add(@RequestBody SafetyTrainingRecord record) {
|
return toAjax(recordService.saveSafety(record));
|
}
|
|
/**
|
* update training completion record.
|
*/
|
@Log(title = "safety-training-record-update", businessType = BusinessType.UPDATE)
|
@ApiOperation("update safety training completion record")
|
@PutMapping("/update")
|
public AjaxResult update(@RequestBody SafetyTrainingRecord record) {
|
return toAjax(recordService.updateSafety(record));
|
}
|
|
/**
|
* delete training completion record.
|
*/
|
@Log(title = "safety-training-record-delete", businessType = BusinessType.DELETE)
|
@ApiOperation("delete safety training completion record")
|
@DeleteMapping("/delete/{id}")
|
public AjaxResult delete(@PathVariable Long id) {
|
return toAjax(recordService.deleteSafetyById(id));
|
}
|
|
/**
|
* training completion record detail.
|
*/
|
@Log(title = "safety-training-record-detail", businessType = BusinessType.OTHER)
|
@ApiOperation("query safety training completion record detail")
|
@GetMapping("/detail/{id}")
|
public AjaxResult detail(@PathVariable Long id) {
|
return AjaxResult.success(recordService.getById(id));
|
}
|
|
/**
|
* 导出培训完成记录。
|
*/
|
@Log(title = "安环管理-培训完成记录-导出", businessType = BusinessType.EXPORT)
|
@ApiOperation("导出培训完成记录")
|
@GetMapping("/export")
|
public void export(HttpServletResponse response, SafetyTrainingRecord query) {
|
List<SafetyTrainingRecord> records = recordService.queryPage(new Page<SafetyTrainingRecord>(1, -1), query)
|
.getRecords();
|
ExcelUtil<SafetyTrainingRecord> util = new ExcelUtil<SafetyTrainingRecord>(SafetyTrainingRecord.class);
|
util.exportExcel(response, records, "safety_training_record");
|
}
|
}
|