| | |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.farm.entity.Farm; |
| | | import org.springblade.modules.farm.service.FarmService; |
| | | import org.springblade.modules.farm.vo.FarmVO; |
| | | import org.springblade.modules.system.vo.RoleVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 自定义查询所有农场信息(不分页) |
| | | * @param farm |
| | | * @return |
| | | */ |
| | | @GetMapping("/getFarmList") |
| | | public R<List<FarmVO>> getFarmList(FarmVO farm) { |
| | | List<FarmVO> farmList = farmService.getFarmList(farm); |
| | | return R.data(farmList); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @PostMapping("/save") |
| | |
| | | public R save(@Valid @RequestBody Farm farm) { |
| | | farm.setCreateTime(new Date()); |
| | | farm.setUpdateTime(new Date()); |
| | | return R.status(farmService.save(farm)); |
| | | //坐标转换 |
| | | if (null != farm.getPosition() && !farm.getPosition().equals("")) { |
| | | //替换逗号为空格 |
| | | String sNull = farm.getPosition().replaceAll(",", " "); |
| | | //替换分号为逗号 |
| | | String replaceAll = sNull.replaceAll(";", ","); |
| | | farm.setPosition("'POLYGON((" + replaceAll + "))'"); |
| | | } |
| | | return R.status(farmService.saveFarmInfo(farm)); |
| | | } |
| | | |
| | | /** |
| | |
| | | public R update(@Valid @RequestBody Farm farm) { |
| | | farm.setUpdateTime(new Date()); |
| | | //坐标转换 |
| | | if (null != farm.getPosition() && !farm.getPosition().equals("")) { |
| | | //替换逗号为空格 |
| | | String sNull = farm.getPosition().replaceAll(",", " "); |
| | | //替换分号为逗号 |
| | | String replaceAll = sNull.replaceAll(";", ","); |
| | | farm.setPosition("'POLYGON((" + replaceAll + "))'"); |
| | | } |
| | | // if (null != farm.getPosition() && !farm.getPosition().equals("")) { |
| | | // //替换逗号为空格 |
| | | // String sNull = farm.getPosition().replaceAll(",", " "); |
| | | // //替换分号为逗号 |
| | | // String replaceAll = sNull.replaceAll(";", ","); |
| | | // farm.setPosition("'POLYGON((" + replaceAll + "))'"); |
| | | // } |
| | | //更新并返回 |
| | | return R.status(farmService.updateFarmById(farm)); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | * 大屏农场数量与人员数量 |
| | | */ |
| | | @GetMapping("/SelectCount") |
| | | public R SelectCount() { |
| | |
| | | map.put("rynum", integer1); |
| | | return R.data(map); |
| | | } |
| | | |
| | | } |