|
@@ -1,20 +1,19 @@
|
|
|
package com.gyee.backconfig.controller;
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.gyee.backconfig.config.R;
|
|
|
import com.gyee.backconfig.model.auto.Equipmentmodel;
|
|
|
import com.gyee.backconfig.model.auto.Manufacturer;
|
|
|
import com.gyee.backconfig.service.auto.IEquipmentmodelService;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import com.gyee.common.model.StringUtils;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.Arrays;
|
|
|
|
|
|
-/**
|
|
|
+/** 设备型号
|
|
|
* <p>
|
|
|
* 前端控制器
|
|
|
* </p>
|
|
@@ -51,4 +50,53 @@ public class EquipmentmodelController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据id查询
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/manufacturer/{id}")
|
|
|
+ public R findOne(@PathVariable("id") String id) {
|
|
|
+ QueryWrapper<Equipmentmodel> qw = new QueryWrapper<>();
|
|
|
+ qw.eq("id", id);
|
|
|
+ Equipmentmodel Square = equipmentmodelService.getOne(qw);
|
|
|
+ if (StringUtils.isNotNull(Square)) {
|
|
|
+ return R.ok().data(Square);
|
|
|
+ } else {
|
|
|
+ return R.error().data("查询失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量插入
|
|
|
+ *
|
|
|
+ * @param equipmentmodel
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/save")
|
|
|
+ public R addAll(@RequestBody Equipmentmodel equipmentmodel) {
|
|
|
+ boolean b = equipmentmodelService.saveOrUpdate(equipmentmodel);
|
|
|
+ if (b) {
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.error().data("保存失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @DeleteMapping(value = "/remove-manufacturer/{ids}")
|
|
|
+ public R deleteAll(@PathVariable("ids") String ids) {
|
|
|
+ String[] strings = ids.split(",");
|
|
|
+ boolean b = equipmentmodelService.removeByIds(Arrays.asList(strings));
|
|
|
+ if (b) {
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.error().data("删除失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|