|
@@ -1,27 +1,86 @@
|
|
package com.hb.proj.well.controller;
|
|
package com.hb.proj.well.controller;
|
|
|
|
|
|
|
|
+
|
|
import cn.hutool.core.util.IdUtil;
|
|
import cn.hutool.core.util.IdUtil;
|
|
import com.hb.proj.model.Well;
|
|
import com.hb.proj.model.Well;
|
|
|
|
+import com.hb.proj.utils.RespVO;
|
|
|
|
+import com.hb.proj.utils.RespVOBuilder;
|
|
import com.hb.proj.well.service.WellService;
|
|
import com.hb.proj.well.service.WellService;
|
|
|
|
+import com.hb.xframework.dao.util.PageModel;
|
|
|
|
+import jakarta.validation.constraints.NotBlank;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 井相关接口
|
|
|
|
+ */
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/api/well")
|
|
@RequestMapping("/api/well")
|
|
@Validated
|
|
@Validated
|
|
public class WellController {
|
|
public class WellController {
|
|
@Autowired
|
|
@Autowired
|
|
private WellService wellService;
|
|
private WellService wellService;
|
|
|
|
+ /**
|
|
|
|
+ * 井保存
|
|
|
|
+ * @apiNote 通过传入对象保存
|
|
|
|
+ * @return 无
|
|
|
|
+ */
|
|
@RequestMapping("/save")
|
|
@RequestMapping("/save")
|
|
public void save(){
|
|
public void save(){
|
|
Well well = new Well();
|
|
Well well = new Well();
|
|
- System.out.println("--------------------id:"+IdUtil.fastSimpleUUID());
|
|
|
|
well.setWellId(IdUtil.fastSimpleUUID());
|
|
well.setWellId(IdUtil.fastSimpleUUID());
|
|
well.setWellName("井名");
|
|
well.setWellName("井名");
|
|
well.setWellSort("测试井");
|
|
well.setWellSort("测试井");
|
|
|
|
+ well.setCreateTime(new Date());
|
|
wellService.insert(well);
|
|
wellService.insert(well);
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 井修改
|
|
|
|
+ * @apiNote 修改井信息
|
|
|
|
+ * @return 无
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping("/update")
|
|
|
|
+ public void update(){
|
|
|
|
+ Well well = wellService.get("c15404d0d40e442ca35544d1f36a40bf");
|
|
|
|
+ well.setModifyTime(new Date());
|
|
|
|
+ well.setWellName("修改井名");
|
|
|
|
+ wellService.update(well);
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 井删除
|
|
|
|
+ * @apiNote 删除井信息
|
|
|
|
+ * @return 无
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping("/delete")
|
|
|
|
+ public void delete(){
|
|
|
|
+ Well well = wellService.get("c15404d0d40e442ca35544d1f36a40bf");
|
|
|
|
+ well.setModifyTime(new Date());
|
|
|
|
+ well.setDelIf(true);
|
|
|
|
+ wellService.update(well);
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 获得单个井数据.
|
|
|
|
+ * @apiNote <p>通过指定的井编号获取数据<br>
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping("/get")
|
|
|
|
+ RespVO<Well> getUser(@NotBlank(message = "井编号【wellId】不能为空") String id) {
|
|
|
|
+ return RespVOBuilder.ok(wellService.get(id));
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 查询分页井数据.
|
|
|
|
+ * @apiNote <p>通过条件获取数据<br>
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping("/queryPaged")
|
|
|
|
+ RespVO<PageModel<Map<String,Object>>> queryPaged() {
|
|
|
|
+ PageModel<Map<String,Object>> page= wellService.queryPagedMap();
|
|
|
|
+ return RespVOBuilder.ok(page);
|
|
}
|
|
}
|
|
}
|
|
}
|