diff --git a/src/main/java/com/xkrs/microservice/controller/TeaGardenPlotController.java b/src/main/java/com/xkrs/microservice/controller/TeaGardenPlotController.java index aa00339..ba805c7 100644 --- a/src/main/java/com/xkrs/microservice/controller/TeaGardenPlotController.java +++ b/src/main/java/com/xkrs/microservice/controller/TeaGardenPlotController.java @@ -1,6 +1,7 @@ package com.xkrs.microservice.controller; import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.IrrigationSarRecordEntity; import com.xkrs.microservice.model.entity.TeaGardenPlotEntity; import com.xkrs.microservice.model.qo.TeaGardenPlotQo; import com.xkrs.microservice.service.TeaGardenPlotService; @@ -9,6 +10,8 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.Locale; +import java.util.Optional; + import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; /** @@ -34,6 +37,20 @@ public class TeaGardenPlotController { return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); } + @RequestMapping(value="/get/id",method = RequestMethod.GET) + @CrossOrigin + public String getById(@RequestParam("id") Integer id) { + Optional res = teaGardenPlotService.getAllRecordById(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,res,locale); + } + + @RequestMapping(value="/get/status",method = RequestMethod.GET) + @CrossOrigin + public String getByStatus(@RequestParam("status") Integer status) { + Iterable res = teaGardenPlotService.getAllRecordByStatus(status); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,res,locale); + } + @RequestMapping(value="/update",method = RequestMethod.POST) // @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor')") @CrossOrigin diff --git a/src/main/java/com/xkrs/microservice/dao/TeaGardenPlotDao.java b/src/main/java/com/xkrs/microservice/dao/TeaGardenPlotDao.java index 0fa3a56..8806886 100644 --- a/src/main/java/com/xkrs/microservice/dao/TeaGardenPlotDao.java +++ b/src/main/java/com/xkrs/microservice/dao/TeaGardenPlotDao.java @@ -17,4 +17,11 @@ public interface TeaGardenPlotDao extends JpaRepository findAllByStatus(Integer status); + } diff --git a/src/main/java/com/xkrs/microservice/model/entity/TeaGardenPlotEntity.java b/src/main/java/com/xkrs/microservice/model/entity/TeaGardenPlotEntity.java index ee0a9f6..a823112 100644 --- a/src/main/java/com/xkrs/microservice/model/entity/TeaGardenPlotEntity.java +++ b/src/main/java/com/xkrs/microservice/model/entity/TeaGardenPlotEntity.java @@ -45,6 +45,11 @@ public class TeaGardenPlotEntity { @Column( length = 255, columnDefinition = "varchar(255)") private String zuowu; + private Integer status; + + @Column( length = 255, columnDefinition = "varchar(255)") + private String remarks; + private Geometry geom; @Transient @@ -114,6 +119,22 @@ public class TeaGardenPlotEntity { this.zuowu = zuowu; } + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + @JsonIgnore public Geometry getGeom() { return geom; @@ -140,7 +161,7 @@ public class TeaGardenPlotEntity { @Override public String toString() { - return "TeaGardenPlot{" + + return "TeaGardenPlotEntity{" + "id=" + id + ", dkbh='" + dkbh + '\'' + ", dlmc='" + dlmc + '\'' + @@ -149,6 +170,8 @@ public class TeaGardenPlotEntity { ", lxr='" + lxr + '\'' + ", lxdh='" + lxdh + '\'' + ", zuowu='" + zuowu + '\'' + + ", status=" + status + + ", remarks='" + remarks + '\'' + ", geom=" + geom + ", wktGeom='" + wktGeom + '\'' + '}'; diff --git a/src/main/java/com/xkrs/microservice/model/qo/TeaGardenPlotQo.java b/src/main/java/com/xkrs/microservice/model/qo/TeaGardenPlotQo.java index 0fac52f..d90a57a 100644 --- a/src/main/java/com/xkrs/microservice/model/qo/TeaGardenPlotQo.java +++ b/src/main/java/com/xkrs/microservice/model/qo/TeaGardenPlotQo.java @@ -1,6 +1,8 @@ package com.xkrs.microservice.model.qo; +import javax.persistence.Column; + /** * TeaGardenPlotQo * @author tajochen @@ -23,6 +25,10 @@ public class TeaGardenPlotQo { private String zuowu; + private Integer status; + + private String remarks; + private String geomStr; public Integer getId() { @@ -89,6 +95,22 @@ public class TeaGardenPlotQo { this.zuowu = zuowu; } + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + public String getGeomStr() { return geomStr; } diff --git a/src/main/java/com/xkrs/microservice/service/TeaGardenPlotService.java b/src/main/java/com/xkrs/microservice/service/TeaGardenPlotService.java index 5d3f53f..7a567f5 100644 --- a/src/main/java/com/xkrs/microservice/service/TeaGardenPlotService.java +++ b/src/main/java/com/xkrs/microservice/service/TeaGardenPlotService.java @@ -2,7 +2,8 @@ package com.xkrs.microservice.service; import com.xkrs.microservice.model.entity.TeaGardenPlotEntity; import com.xkrs.microservice.model.qo.TeaGardenPlotQo; -import com.xkrs.microservice.model.qo.TypicalPlotQo; + +import java.util.Optional; /** @@ -17,6 +18,13 @@ public interface TeaGardenPlotService { */ Iterable getAllRecord(); + /** + * 获取所有典型地块记录根据编号 + * @param id 编号 + * @return + */ + Optional getAllRecordById(Integer id); + /** * 获取指定地块编号记录 * @param dkbh @@ -24,6 +32,13 @@ public interface TeaGardenPlotService { */ TeaGardenPlotEntity getAllRecordByDkbh(String dkbh); + /** + * 获取指定地块根据状态 + * @param status + * @return + */ + Iterable getAllRecordByStatus(Integer status); + /** * 新增典型地块记录 diff --git a/src/main/java/com/xkrs/microservice/service/impl/TeaGardenPlotServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/TeaGardenPlotServiceImpl.java index ff9f54a..d0552ce 100644 --- a/src/main/java/com/xkrs/microservice/service/impl/TeaGardenPlotServiceImpl.java +++ b/src/main/java/com/xkrs/microservice/service/impl/TeaGardenPlotServiceImpl.java @@ -43,6 +43,17 @@ public class TeaGardenPlotServiceImpl implements TeaGardenPlotService { return teaGardenPlotDao.findAll(); } + /** + * 获取所有典型地块记录根据编号 + * @param id 编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getAllRecordById(Integer id){ + return teaGardenPlotDao.findById(id); + } + /** * 获取指定地块编号记录 * @param dkbh @@ -54,6 +65,17 @@ public class TeaGardenPlotServiceImpl implements TeaGardenPlotService { return teaGardenPlotDao.findAllByDkbh(dkbh); } + /** + * 获取指定地块根据状态 + * @param status + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllRecordByStatus(Integer status){ + return teaGardenPlotDao.findAllByStatus(status); + } + /** * 新增典型地块记录