From dd15f7f00e9eda3b15bd956ff830ccbe78752a4f Mon Sep 17 00:00:00 2001 From: wuzeyu <1223318623@qq.com> Date: 星期一, 20 五月 2024 17:11:07 +0800 Subject: [PATCH] 田间灌溉项目管理 项目模块 解决分页问题、增加创建时间字段、解决地址ID不一致问题 灌溉单元模块 创建Ctrl SV mapper 实体类 --- pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectSv.java | 80 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 80 insertions(+), 0 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectSv.java index 3a5ce63..4683b2d 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectSv.java @@ -1,13 +1,20 @@ package com.dy.pipIrrIrrigate.project; +import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoIr.IrProjectMapper; import com.dy.pipIrrGlobal.pojoIr.IrProject; +import com.dy.pipIrrGlobal.voIr.VoProject; +import com.dy.pipIrrGlobal.voIr.VoProjectOne; +import com.dy.pipIrrGlobal.voPr.VoIntake; import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.common.utils.PojoUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; +import java.util.List; +import java.util.Map; /** * @author :WuZeYu @@ -67,4 +74,77 @@ } return 1; } + + /** + * 淇敼椤圭洰淇℃伅 + * @param po + * @return + */ + public Integer updateProject(IrProject po){ + po.setOperateDt(new Date()); + if (po.getVillageId() != null) { + po.setTownId(irProjectMapper.getSupperByVillageId(po.getVillageId())); + po.setCountyId(irProjectMapper.getSupperByVillageId(po.getTownId())); + po.setCityId(irProjectMapper.getSupperByVillageId(po.getCountyId())); + po.setProvinceId(irProjectMapper.getSupperByVillageId(po.getCityId())); + } + if (po.getTownId() != null) { + po.setCountyId(irProjectMapper.getSupperByVillageId(po.getTownId())); + po.setCityId(irProjectMapper.getSupperByVillageId(po.getCountyId())); + po.setProvinceId(irProjectMapper.getSupperByVillageId(po.getCityId())); + } + if (po.getCountyId() != null) { + po.setCityId(irProjectMapper.getSupperByVillageId(po.getCountyId())); + po.setProvinceId(irProjectMapper.getSupperByVillageId(po.getCityId())); + } + if (po.getCityId() != null) { + po.setProvinceId(irProjectMapper.getSupperByVillageId(po.getCityId())); + } + int rows = irProjectMapper.updateByPrimaryKeySelective(po); + if (rows == 0){ + return 0; + } + return 1; + } + + /** + * 淇敼椤圭洰鐘舵�� + * @param po + * @return + */ + public Integer updateProjectState(IrProject po){ + po.setOperateDt(new Date()); + int rows = irProjectMapper.updateProjectState(po); + if (rows == 0){ + return 0; + } + return 1; + } + + /** + * 鑾峰彇涓�涓」鐩暟鎹� + * @param id + * @return + */ + public VoProjectOne selectById(Long id){ + VoProjectOne irProject = irProjectMapper.selectById(id); + return irProject; + } + + /** + * 鍒嗛〉鏌ヨ椤圭洰 + * @param queryVo + * @return + */ + public QueryResultVo<List<VoProject>> getProjects(QueryVo queryVo){ + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + Long itemTotal = irProjectMapper.getRecordCount(params); + + QueryResultVo<List<VoProject>> rsVo = new QueryResultVo<>(); + rsVo.pageSize = queryVo.pageSize; + rsVo.pageCurr = queryVo.pageCurr; + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = irProjectMapper.getProjects(params); + return rsVo; + } } -- Gitblit v1.8.0