| | |
| | | */ |
| | | package org.sxkj.fw.device.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import lombok.AllArgsConstructor; |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.sxkj.fw.device.entity.FwDeviceTrackEntity; |
| | | import org.sxkj.fw.device.vo.FwDeviceTrackVO; |
| | | import org.sxkj.fw.device.excel.FwDeviceTrackExcel; |
| | | import org.sxkj.fw.device.wrapper.FwDeviceTrackWrapper; |
| | | import org.sxkj.fw.device.service.IFwDeviceTrackService; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.sxkj.fw.device.dto.FwDeviceTrackDTO; |
| | | import org.sxkj.fw.device.entity.FwDeviceTrackEntity; |
| | | import org.sxkj.fw.device.excel.FwDeviceTrackExcel; |
| | | import org.sxkj.fw.device.service.IFwDeviceTrackService; |
| | | import org.sxkj.fw.device.vo.FwDeviceTrackVO; |
| | | import org.sxkj.fw.device.wrapper.FwDeviceTrackWrapper; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 设备跟踪流转表 控制器 |
| | |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详情", notes = "传入fwDeviceTrack") |
| | | public R<FwDeviceTrackVO> detail(FwDeviceTrackEntity fwDeviceTrack) { |
| | | FwDeviceTrackEntity detail = fwDeviceTrackService.getOne(Condition.getQueryWrapper(fwDeviceTrack)); |
| | | public R<FwDeviceTrackVO> detail(FwDeviceTrackDTO fwDeviceTrack) { |
| | | FwDeviceTrackEntity detail = fwDeviceTrackService.getOne(Condition.getQueryWrapper(FwDeviceTrackWrapper.build().entityDTO(fwDeviceTrack))); |
| | | |
| | | if (detail == null) { |
| | | return R.fail("该记录不存在"); |
| | | } |
| | | |
| | | return R.data(FwDeviceTrackWrapper.build().entityVO(detail)); |
| | | } |
| | | /** |
| | | * 设备跟踪流转表 分页 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入fwDeviceTrack") |
| | | public R<IPage<FwDeviceTrackVO>> list(@ApiIgnore @RequestParam Map<String, Object> fwDeviceTrack, Query query) { |
| | | IPage<FwDeviceTrackEntity> pages = fwDeviceTrackService.page(Condition.getPage(query), Condition.getQueryWrapper(fwDeviceTrack, FwDeviceTrackEntity.class)); |
| | | return R.data(FwDeviceTrackWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | | * 设备跟踪流转表 自定义分页 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入fwDeviceTrack") |
| | | public R<IPage<FwDeviceTrackVO>> page(FwDeviceTrackVO fwDeviceTrack, Query query) { |
| | | IPage<FwDeviceTrackVO> pages = fwDeviceTrackService.selectFwDeviceTrackPage(Condition.getPage(query), fwDeviceTrack); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 设备跟踪流转表 新增 |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增", notes = "传入fwDeviceTrack") |
| | | public R save(@Valid @RequestBody FwDeviceTrackEntity fwDeviceTrack) { |
| | | return R.status(fwDeviceTrackService.save(fwDeviceTrack)); |
| | | } |
| | | |
| | | /** |
| | | * 设备跟踪流转表 修改 |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入fwDeviceTrack") |
| | | public R update(@Valid @RequestBody FwDeviceTrackEntity fwDeviceTrack) { |
| | | return R.status(fwDeviceTrackService.updateById(fwDeviceTrack)); |
| | | public R<IPage<FwDeviceTrackVO>> page(FwDeviceTrackDTO fwDeviceTrack, Query query) { |
| | | IPage<FwDeviceTrackEntity> pages = fwDeviceTrackService.selectFwDeviceTrackPage(Condition.getPage(query), fwDeviceTrack); |
| | | return R.data(FwDeviceTrackWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入fwDeviceTrack") |
| | | public R submit(@Valid @RequestBody FwDeviceTrackEntity fwDeviceTrack) { |
| | | return R.status(fwDeviceTrackService.saveOrUpdate(fwDeviceTrack)); |
| | | public R submit(@Valid @RequestBody FwDeviceTrackDTO fwDeviceTrack) { |
| | | |
| | | if (null != fwDeviceTrack.getDeviceId()) { |
| | | return R.fail("设备ID不能为空"); |
| | | } |
| | | |
| | | return R.status(fwDeviceTrackService.saveOrUpdate(FwDeviceTrackWrapper.build().entityDTO(fwDeviceTrack))); |
| | | } |
| | | |
| | | /** |
| | |
| | | @GetMapping("/export-fwDeviceTrack") |
| | | @ApiOperationSupport(order = 9) |
| | | @ApiOperation(value = "导出数据", notes = "传入fwDeviceTrack") |
| | | @ApiIgnore |
| | | public void exportFwDeviceTrack(@ApiIgnore @RequestParam Map<String, Object> fwDeviceTrack, BladeUser bladeUser, HttpServletResponse response) { |
| | | QueryWrapper<FwDeviceTrackEntity> queryWrapper = Condition.getQueryWrapper(fwDeviceTrack, FwDeviceTrackEntity.class); |
| | | //if (!AuthUtil.isAdministrator()) { |