From 1ff17fd97a85cd191467b4a2ffe0e4b7b1959af5 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期日, 12 十一月 2023 17:00:25 +0800
Subject: [PATCH] 查询用户同时得到其对应的多个角色,采用积极关联查询方式
---
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java | 47 +++++++++++++++++++++++++++++++++++++++--------
1 files changed, 39 insertions(+), 8 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 27c5a85..a8f4ae3 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
@@ -12,16 +12,38 @@
@Service
public class DistrictSv {
- private BaDistrictMapper baDistrictMapper ;
+ private BaDistrictMapper dao;
@Autowired
- private void setBaDistrictMapper(BaDistrictMapper baDistrictMapper){
- this.baDistrictMapper = baDistrictMapper ;
+ private void setDao(BaDistrictMapper dao){
+ this.dao = dao;
}
-
+ /**
+ * 淇濆瓨瀹炰綋
+ * @param po 瀹炰綋
+ * @return 鏁伴噺
+ */
public int save(BaDistrict po){
- return this.baDistrictMapper.insert(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) ;
}
/**
@@ -29,8 +51,8 @@
* @param firstLevel 绗竴绾ц涓嬪尯 level
* @return 鎵�鏈夎鏀垮尯鍒掗泦鍚�
*/
- public List<BaDistrict> getAll(byte firstLevel){
- List<BaDistrict> list = this.baDistrictMapper.selectByLevel(firstLevel) ;
+ public List<BaDistrict> selectAllByLevel(byte firstLevel){
+ List<BaDistrict> list = this.dao.selectByLevel(firstLevel) ;
if(list != null && list.size() > 0){
for(BaDistrict po : list){
getSubDistrict(po) ;
@@ -40,12 +62,21 @@
}
/**
+ * 寰楀埌涓�涓鏀垮尯
+ * @param id 琛屾斂鍖篒D
+ * @return 琛屾斂鍖哄疄浣�
+ */
+ public BaDistrict selectById(Long id){
+ return this.dao.selectByPrimaryKey(id) ;
+ }
+
+ /**
* 寰楀埌涓嬬骇琛屾斂鍖哄垝
* @param po 涓婄骇琛屾斂鍖哄垝
*/
private void getSubDistrict(BaDistrict po){
if(po != null && po.id != null){
- po.subDistricts = this.baDistrictMapper.selectBySupperId(po.id) ;
+ po.subDistricts = this.dao.selectBySupperId(po.id) ;
if(po.subDistricts != null && po.subDistricts.size() > 0){
for(BaDistrict subPo : po.subDistricts){
getSubDistrict(subPo) ;
--
Gitblit v1.8.0