| | |
| | | package com.sinata.web.controller.backend; |
| | | |
| | | import com.sinata.common.core.domain.R; |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.system.domain.dto.MwMicroEquipmentRecordDTO; |
| | | import com.sinata.system.domain.query.MwMicroEquipmentRecordQuery; |
| | | import com.sinata.system.domain.query.MwMicroEquipmentStaticsQuery; |
| | | import com.sinata.system.domain.vo.MwMicroEquipmentRecordVO; |
| | | import com.sinata.system.domain.vo.MwMicroEquipmentStaticsTitleVO; |
| | | import com.sinata.system.service.MwMicroEquipmentRecordService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author mitao |
| | | * @since 2024-12-02 |
| | | */ |
| | | @Api(tags = {"设备使用记录相关接口"}) |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/backend/mwMicroEquipmentRecord") |
| | | public class MwMicroEquipmentRecordController { |
| | | private final MwMicroEquipmentRecordService mwMicroEquipmentRecordService; |
| | | |
| | | /** |
| | | * 设备使用记录分页列表 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/page") |
| | | @ApiOperation("设备使用记录分页列表") |
| | | public R<PageDTO<MwMicroEquipmentRecordVO>> pageList(@Valid @RequestBody MwMicroEquipmentRecordQuery query) { |
| | | return R.ok(mwMicroEquipmentRecordService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 导出设备使用记录 |
| | | * |
| | | * @param query |
| | | */ |
| | | @PostMapping("/export") |
| | | @ApiOperation("导出设备使用记录") |
| | | public void export(@RequestBody MwMicroEquipmentRecordQuery query, HttpServletResponse response) { |
| | | try { |
| | | mwMicroEquipmentRecordService.export(query, response); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 新增使用记录 |
| | | * |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | @ApiOperation("新增使用记录") |
| | | public R<?> add(@Valid @RequestBody MwMicroEquipmentRecordDTO dto) { |
| | | mwMicroEquipmentRecordService.add(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 处置分析表头 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/statics/title") |
| | | @ApiOperation("处置分析表头") |
| | | public R<List<MwMicroEquipmentStaticsTitleVO>> staticsTitle() { |
| | | return R.ok(mwMicroEquipmentRecordService.staticsTitle()); |
| | | } |
| | | |
| | | /** |
| | | * 处置分析数据 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/statics/data") |
| | | @ApiOperation("处置分析数据") |
| | | public R<List<List<String>>> staticsData(@Valid @RequestBody MwMicroEquipmentStaticsQuery query) { |
| | | return R.ok(mwMicroEquipmentRecordService.getStaticsData(query)); |
| | | } |
| | | |
| | | /** |
| | | * 处置分析导出 |
| | | * |
| | | * @param query |
| | | * @param response |
| | | */ |
| | | @PostMapping("/statics/export") |
| | | @ApiOperation("处置分析导出") |
| | | public void export(@Valid @RequestBody MwMicroEquipmentStaticsQuery query, HttpServletResponse response) { |
| | | try { |
| | | mwMicroEquipmentRecordService.staticsExport(query, response); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |