|
@@ -0,0 +1,113 @@
|
|
|
+package com.ruoyi.web.controller.zhdd;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
+
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.constraints.*;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import com.ruoyi.common.annotation.RepeatSubmit;
|
|
|
+import com.ruoyi.common.annotation.Log;
|
|
|
+import com.ruoyi.common.core.controller.BaseController;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.core.validate.AddGroup;
|
|
|
+import com.ruoyi.common.core.validate.EditGroup;
|
|
|
+import com.ruoyi.common.core.validate.QueryGroup;
|
|
|
+import com.ruoyi.common.enums.BusinessType;
|
|
|
+import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
+import com.ruoyi.zhdd.domain.vo.SingleDeviceVo;
|
|
|
+import com.ruoyi.zhdd.domain.bo.SingleDeviceBo;
|
|
|
+import com.ruoyi.zhdd.service.ISingleDeviceService;
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 单兵数据信息Controller
|
|
|
+ *
|
|
|
+ * @author xintong
|
|
|
+ * @date 2021-12-17
|
|
|
+ */
|
|
|
+@Validated
|
|
|
+@Api(value = "单兵数据信息控制器", tags = {"单兵数据信息管理"})
|
|
|
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
|
+@RestController
|
|
|
+@RequestMapping("/zhdd/singleDevice")
|
|
|
+public class SingleDeviceController extends BaseController {
|
|
|
+
|
|
|
+ private final ISingleDeviceService iSingleDeviceService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询单兵数据信息列表
|
|
|
+ */
|
|
|
+ @ApiOperation("查询单兵数据信息列表")
|
|
|
+ @PreAuthorize("@ss.hasPermi('zhdd:singleDevice:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo<SingleDeviceVo> list(@Validated(QueryGroup.class) SingleDeviceBo bo) {
|
|
|
+ return iSingleDeviceService.queryPageList(bo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出单兵数据信息列表
|
|
|
+ */
|
|
|
+ @ApiOperation("导出单兵数据信息列表")
|
|
|
+ @PreAuthorize("@ss.hasPermi('zhdd:singleDevice:export')")
|
|
|
+ @Log(title = "单兵数据信息", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/export")
|
|
|
+ public void export(@Validated SingleDeviceBo bo, HttpServletResponse response) {
|
|
|
+ List<SingleDeviceVo> list = iSingleDeviceService.queryList(bo);
|
|
|
+ ExcelUtil.exportExcel(list, "单兵数据信息", SingleDeviceVo.class, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取单兵数据信息详细信息
|
|
|
+ */
|
|
|
+ @ApiOperation("获取单兵数据信息详细信息")
|
|
|
+ @PreAuthorize("@ss.hasPermi('zhdd:singleDevice:query')")
|
|
|
+ @GetMapping("/{userId}")
|
|
|
+ public AjaxResult<SingleDeviceVo> getInfo(@NotNull(message = "主键不能为空")
|
|
|
+ @PathVariable("userId") String userId) {
|
|
|
+ return AjaxResult.success(iSingleDeviceService.queryById(userId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增单兵数据信息
|
|
|
+ */
|
|
|
+ @ApiOperation("新增单兵数据信息")
|
|
|
+ @PreAuthorize("@ss.hasPermi('zhdd:singleDevice:add')")
|
|
|
+ @Log(title = "单兵数据信息", businessType = BusinessType.INSERT)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PostMapping()
|
|
|
+ public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody SingleDeviceBo bo) {
|
|
|
+ return toAjax(iSingleDeviceService.insertByBo(bo) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改单兵数据信息
|
|
|
+ */
|
|
|
+ @ApiOperation("修改单兵数据信息")
|
|
|
+ @PreAuthorize("@ss.hasPermi('zhdd:singleDevice:edit')")
|
|
|
+ @Log(title = "单兵数据信息", businessType = BusinessType.UPDATE)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PutMapping()
|
|
|
+ public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody SingleDeviceBo bo) {
|
|
|
+ return toAjax(iSingleDeviceService.updateByBo(bo) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除单兵数据信息
|
|
|
+ */
|
|
|
+ @ApiOperation("删除单兵数据信息")
|
|
|
+ @PreAuthorize("@ss.hasPermi('zhdd:singleDevice:remove')")
|
|
|
+ @Log(title = "单兵数据信息" , businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{userIds}")
|
|
|
+ public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
|
+ @PathVariable String[] userIds) {
|
|
|
+ return toAjax(iSingleDeviceService.deleteWithValidByIds(Arrays.asList(userIds), true) ? 1 : 0);
|
|
|
+ }
|
|
|
+}
|