|
|
@@ -1,10 +1,30 @@
|
|
|
package com.zd.bottle.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.zd.bottle.domain.RfidTag;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import com.zd.bottle.service.RfidTagService;
|
|
|
+import com.zd.common.core.domain.per.PerFun;
|
|
|
+import com.zd.common.core.domain.per.PerPrefix;
|
|
|
+import com.zd.common.core.utils.SpringUtils;
|
|
|
+import com.zd.common.core.utils.poi.ExcelUtil;
|
|
|
+import com.zd.common.core.web.page.TableDataInfo;
|
|
|
+import com.zd.common.log.annotation.Log;
|
|
|
+import com.zd.common.log.enums.BusinessType;
|
|
|
+import com.zd.common.response.ResultData;
|
|
|
+import com.zd.common.security.annotation.PreAuthorize;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
import com.zd.common.core.web.controller.BaseController;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
+import java.sql.Wrapper;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* RFID标签管理 前端控制器
|
|
|
@@ -14,7 +34,103 @@ import com.zd.common.core.web.controller.BaseController;
|
|
|
* @since 2022-09-08
|
|
|
*/
|
|
|
@RestController
|
|
|
+@Api(tags = "【RFID标签管理】")
|
|
|
@RequestMapping("/rfidTag")
|
|
|
public class RfidTagController extends BaseController<RfidTag> {
|
|
|
|
|
|
+ @Resource
|
|
|
+ private RfidTagService service;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询RFID标签管理列表
|
|
|
+ * @param rfidTag 参数实体
|
|
|
+ * @return TableDataInfo<RfidTag>
|
|
|
+ */
|
|
|
+// @PreAuthorize(hasPermi = PerPrefix.BOTTLE_TAG+ PerFun.LIST)
|
|
|
+ @GetMapping("/list")
|
|
|
+ @ApiOperation(value = "查询RFID标签管理列表")
|
|
|
+ public TableDataInfo<RfidTag> list(RfidTag rfidTag) {
|
|
|
+ startPage();
|
|
|
+ LambdaQueryWrapper<RfidTag> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.setEntity(rfidTag);
|
|
|
+ List<RfidTag> list = service.list(wrapper);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出RFID标签管理列表
|
|
|
+ * @param response 响应对象
|
|
|
+ * @param rfidTag 参数实体
|
|
|
+ * @throws IOException 异常
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "导出RFID标签管理列表")
|
|
|
+// @PreAuthorize(hasPermi = PerPrefix.BOTTLE_TAG+ PerFun.EXPORT)
|
|
|
+ @Log(title = "RFID标签管理", businessType = BusinessType.EXPORT)
|
|
|
+ @PostMapping("/export")
|
|
|
+ public void export(HttpServletResponse response, RfidTag rfidTag) throws IOException {
|
|
|
+ LambdaQueryWrapper<RfidTag> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.setEntity(rfidTag);
|
|
|
+ List<RfidTag> list = service.list(wrapper);
|
|
|
+ ExcelUtil<RfidTag> util = new ExcelUtil<>(RfidTag.class);
|
|
|
+ util.exportExcel(response, list, "RFID标签管理数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取RFID标签管理详细信息
|
|
|
+ * @param id 主键
|
|
|
+ * @return RfidTag
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "获取RFID标签管理详细信息")
|
|
|
+// @PreAuthorize(hasPermi = PerPrefix.BOTTLE_TAG+ PerFun.QUERY)
|
|
|
+ @GetMapping(value = "/{id}")
|
|
|
+ public ResultData<RfidTag> getInfo(@PathVariable("id") Long id) {
|
|
|
+ return ResultData.success(service.getById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增RFID标签管理
|
|
|
+ * @param rfidTag 参数实体
|
|
|
+ * @return Boolean
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "新增RFID标签管理")
|
|
|
+// @PreAuthorize(hasPermi = PerPrefix.BOTTLE_TAG+ PerFun.ADD)
|
|
|
+ @Log(title = "RFID标签管理", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping
|
|
|
+ public ResultData<Boolean> add(@RequestBody RfidTag rfidTag) {
|
|
|
+ String tagCode = rfidTag.getTagCode();
|
|
|
+ LambdaQueryWrapper<RfidTag> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(RfidTag::getTagCode,tagCode);
|
|
|
+ List<RfidTag> tags = service.list(queryWrapper);
|
|
|
+ if (!tags.isEmpty()){
|
|
|
+ return ResultData.fail("该标签已经存在,请勿重复录入,如需补打二维码请点击下方按钮。");
|
|
|
+ }
|
|
|
+ return ResultData.result(service.add(rfidTag));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改RFID标签管理
|
|
|
+ * @param rfidTag 参数实体
|
|
|
+ * @return Boolean
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "修改RFID标签管理")
|
|
|
+// @PreAuthorize(hasPermi = PerPrefix.BOTTLE_TAG+ PerFun.EDIT)
|
|
|
+ @Log(title = "RFID标签管理", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping
|
|
|
+ public ResultData<Boolean> edit(@RequestBody RfidTag rfidTag) {
|
|
|
+ return ResultData.result(service.updateById(rfidTag));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除RFID标签管理
|
|
|
+ * @param ids 主键集合
|
|
|
+ * @return Boolean
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "删除RFID标签管理")
|
|
|
+// @PreAuthorize(hasPermi = PerPrefix.BOTTLE_TAG+ PerFun.REMOVE)
|
|
|
+ @Log(title = "RFID标签管理", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public ResultData<Boolean> remove(@PathVariable Long[] ids) {
|
|
|
+ return ResultData.result(service.removeBatchByIds(Arrays.asList(ids)));
|
|
|
+ }
|
|
|
+
|
|
|
}
|