From 6b268e3e7ee7e71d4dcb7760b005242679a1608f Mon Sep 17 00:00:00 2001 From: Administrator <zhubaomin> Date: 星期四, 25 一月 2024 15:23:55 +0800 Subject: [PATCH] 2024-01-25 朱宝民 优化获取用户信息接口 --- pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java | 87 ++++++++++++++++++++++++++++++------------- 1 files changed, 60 insertions(+), 27 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java index a8f4ae3..33f880e 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java @@ -2,11 +2,14 @@ import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper; import com.dy.pipIrrGlobal.pojoBa.BaDistrict; +import com.dy.pipIrrGlobal.util.DistrictLevel; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.Map; @Slf4j @Service @@ -20,33 +23,6 @@ } /** - * 淇濆瓨瀹炰綋 - * @param po 瀹炰綋 - * @return 鏁伴噺 - */ - public int save(BaDistrict po){ - return this.dao.insert(po) ; - } - - /** - * 淇濆瓨淇敼瀹炰綋 - * @param po 瀹炰綋 - * @return 鏁伴噺 - */ - public int update(BaDistrict po){ - return this.dao.updateByPrimaryKeySelective(po) ; - } - - /** - * 淇濆瓨淇敼瀹炰綋 - * @param id 瀹炰綋ID - * @return 鏁伴噺 - */ - public int delete(Long id){ - return this.dao.deleteLogicById(id) ; - } - - /** * 浠庣涓�绾ц鏀垮尯鍒掑紑濮嬶紝寰楀埌鎵�鏈夎鏀垮尯鍒掍俊鎭� * @param firstLevel 绗竴绾ц涓嬪尯 level * @return 鎵�鏈夎鏀垮尯鍒掗泦鍚� @@ -55,6 +31,8 @@ List<BaDistrict> list = this.dao.selectByLevel(firstLevel) ; if(list != null && list.size() > 0){ for(BaDistrict po : list){ + po.canDelete = false ; + po.canAdd = true ; getSubDistrict(po) ; } } @@ -71,6 +49,36 @@ } /** + * 淇濆瓨瀹炰綋 + * @param po 瀹炰綋 + * @return 鏁伴噺 + */ + @Transactional + public int save(BaDistrict po){ + return this.dao.putin(po) ; + } + + /** + * 淇濆瓨淇敼瀹炰綋 + * @param po 瀹炰綋 + * @return 鏁伴噺 + */ + @Transactional + public int update(BaDistrict po){ + return this.dao.updateByPrimaryKeySelective(po) ; + } + + /** + * 淇濆瓨淇敼瀹炰綋 + * @param id 瀹炰綋ID + * @return 鏁伴噺 + */ + @Transactional + public int delete(Long id){ + return this.dao.deleteLogicById(id) ; + } + + /** * 寰楀埌涓嬬骇琛屾斂鍖哄垝 * @param po 涓婄骇琛屾斂鍖哄垝 */ @@ -81,7 +89,32 @@ for(BaDistrict subPo : po.subDistricts){ getSubDistrict(subPo) ; } + }else{ + //娌℃湁涓嬬骇浜嗭紝鍙互鍒犻櫎 + po.canDelete = false ; + if(po.level.code.byteValue() == DistrictLevel.Village.code.byteValue()){ + //鍒版潙绾т簡锛屼笉鍙互鍐嶆坊鍔犺鏀垮尯浜� + po.canAdd = false ; + } } } } + + /** + * 鏍规嵁绾у埆鑾峰彇琛屾斂鍖哄垝鍒楄〃 + * @param level + * @return + */ + public List<Map<String, Object>> getDistrictgsByLevel(Integer level) { + return dao.getDistrictgsByLevel(level); + } + + /** + * 鏍规嵁鐖禝D鑾峰彇琛屾斂鍖哄垝鍒楄〃 + * @param supperId + * @return + */ + public List<Map<String, Object>> getDistrictsBySupperId(Long supperId) { + return dao.getDistrictsBySupperId(supperId); + } } -- Gitblit v1.8.0