Browse Source

阿米巴付款申请开发

anderx 3 years ago
parent
commit
acf6651c54

+ 82 - 24
src/main/java/com/goafanti/admin/bo/AdminListBo.java

@@ -3,6 +3,7 @@ package com.goafanti.admin.bo;
 import java.util.Date;
 import java.util.List;
 
+import com.goafanti.common.model.Role;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
 import com.goafanti.common.constant.AFTConstants;
@@ -20,7 +21,7 @@ public class AdminListBo {
 	 * 用户名
 	 */
 	private String	name;
-	
+
 	/**
 	 * 密码
 	 */
@@ -45,12 +46,12 @@ public class AdminListBo {
 	 * 所在省份
 	 */
 	private String	province;
-	
+
 	/**
-	 * 所在市 
+	 * 所在市
 	 */
 	private String city;
-	
+
 	/**
 	 * 岗位
 	 */
@@ -65,38 +66,38 @@ public class AdminListBo {
 	 * 上级管理用户ID
 	 */
 	private String	superiorId;
-	
+
 	/** 部门ID **/
 	private String departmentId;
-	
+
 	/** 部门名称 **/
 	private String departmentName;
-	
+
 	/** 用户状态 **/
 	private String status;
-	
+
 	/** 用户编号 **/
 	@SuppressWarnings("unused")
 	private String userNo;
-	
+
 	/** 职务 **/
 	private String duty;
-	
+
 	/**
 	 * 最后登录时间
 	 */
 	private String lastLoginTime;
 	/** 角色 **/
-	private List<String> roles;
-	
+	private List<Role> roles;
+
 	/** 角色 id**/
-	private List<String> rolesId;
-	
-	
+	private List<String> rolesName;
+
+
 	private String contactMobile;
-	
+
 	private String contactId;
-	
+
 	private String openId;
 
 	/**
@@ -109,6 +110,55 @@ public class AdminListBo {
 	 */
 	private String depManager;
 
+
+	private String ambId;
+	private String ancestors;
+	private Integer ambManage;
+	private String ambName;
+	private String ancestorsNames;
+	private String ambRole;
+
+
+	public String getAmbId() {
+		return ambId;
+	}
+
+	public void setAmbId(String ambId) {
+		this.ambId = ambId;
+	}
+
+	public String getAncestors() {
+		return ancestors;
+	}
+
+	public void setAncestors(String ancestors) {
+		this.ancestors = ancestors;
+	}
+
+	public Integer getAmbManage() {
+		return ambManage;
+	}
+
+	public void setAmbManage(Integer ambManage) {
+		this.ambManage = ambManage;
+	}
+
+	public String getAmbRole() {
+		return ambRole;
+	}
+
+	public void setAmbRole(String ambRole) {
+		this.ambRole = ambRole;
+	}
+
+	public String getAmbName() {
+		return ambName;
+	}
+
+	public void setAmbName(String ambName) {
+		this.ambName = ambName;
+	}
+
 	public String getDepManager() {
 		return depManager;
 	}
@@ -125,19 +175,27 @@ public class AdminListBo {
 		this.reviewer = reviewer;
 	}
 
-	public List<String> getRolesId() {
-		return rolesId;
+	public List<String> getRolesName() {
+		return rolesName;
 	}
 
-	public void setRolesId(List<String> rolesId) {
-		this.rolesId = rolesId;
+	public void setRolesName(List<String> rolesName) {
+		this.rolesName = rolesName;
 	}
 
-	public List<String> getRoles() {
+	public String getAncestorsNames() {
+		return ancestorsNames;
+	}
+
+	public void setAncestorsNames(String ancestorsNames) {
+		this.ancestorsNames = ancestorsNames;
+	}
+
+	public List<Role> getRoles() {
 		return roles;
 	}
 
-	public void setRoles(List<String> roles) {
+	public void setRoles(List<Role> roles) {
 		this.roles = roles;
 	}
 
@@ -252,7 +310,7 @@ public class AdminListBo {
 	public void setSuperior(String superior) {
 		this.superior = superior;
 	}
-	
+
 	public String getDepartmentId() {
 		return departmentId;
 	}

+ 2 - 0
src/main/java/com/goafanti/admin/service/NewAdminService.java

@@ -69,4 +69,6 @@ public interface NewAdminService {
 
 	boolean checkAdminRole(List<String> roles, Admin admin);
 
+	void pushRolesName(AdminListBo i);
+
 }

+ 5 - 1
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -8,6 +8,7 @@ import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.Department;
+import com.goafanti.common.model.Role;
 import com.goafanti.common.utils.RedisUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -51,6 +52,8 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 	private DepartmentService departmentService;
 	@Resource(name = "passwordUtil")
 	private PasswordUtil					passwordUtil;
+	@Autowired
+	private NewAdminServiceImpl newAdminService;
 
 	@Autowired
 	private RedisUtil	redisUtil;
@@ -343,7 +346,8 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 		Pagination<AdminListBo> p = (Pagination<AdminListBo>)findPage("frequentContactsList", "frequentContactsCount", params, pageNo, pageSize);
 		List<AdminListBo> list=(List<AdminListBo>)p.getList();
 		for(AdminListBo i:list){
-			i.setRoles(adminMapper.selectRolesByUid(i.getContactId()));
+			newAdminService.pushRolesName(i);
+
 		}
 		return p;
 	}

+ 40 - 6
src/main/java/com/goafanti/admin/service/impl/NewAdminServiceImpl.java

@@ -5,7 +5,6 @@ import java.util.*;
 import com.goafanti.common.dao.AmbSystemMapper;
 import com.goafanti.common.model.AmbSystem;
 import com.goafanti.common.model.Role;
-import com.goafanti.common.utils.AsyncUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -47,16 +46,29 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		if(StringUtils.isNotBlank(alb.getStatus())) params.put("status", alb.getStatus());
 		if(StringUtils.isNotBlank(alb.getMobile())) params.put("mobile", alb.getMobile());
 		if(StringUtils.isNotBlank(alb.getSuperiorId())) params.put("superiorId", alb.getSuperiorId());
+		if(StringUtils.isNotBlank(alb.getAmbId())) params.put("ambId", alb.getAmbId());
+		if(StringUtils.isNotBlank(alb.getAncestors())) params.put("ancestors", alb.getAncestors());
+		if(alb.getAmbManage()!=null) params.put("ambManage", alb.getAmbManage());
 		Pagination<AdminListBo> p=(Pagination<AdminListBo>)findPage("selectAdminListByPage","selectAdminCount",params,pageNo,pageSize);
 		List<AdminListBo> list= (List<AdminListBo>) p.getList();
 		for(AdminListBo i:list){
-			i.setRoles(adminMapper.selectRolesByUid(i.getId()));
-			i.setRolesId(adminMapper.selectRolesIdByUid(i.getId()));
+			pushRolesName(i);
 		}
 		return p;
 	}
 
 	@Override
+	public void pushRolesName(AdminListBo i) {
+		List<Role> roles = adminMapper.selectRolesByUid(i.getId());
+		i.setRoles(roles);
+		List<String> ls=new ArrayList<>();
+		for (Role role : roles) {
+			ls.add(role.getRoleName());
+		}
+		i.setRolesName(ls);
+	}
+
+	@Override
 	public List<Admin> selectAllAdmin() {
 		return adminMapper.selectAllAdmin(null);
 	}
@@ -89,6 +101,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 			}
 			TokenManager.clearUserAuthByUserId(ad.getId());
 		}
+		pushAmbRole(ad);
 		ad.setType(sumType(roleIds));
 		int count=adminMapper.updateByPrimaryKeySelective(ad);
 		if (count>0&&ad.getAmbId()!=null){
@@ -99,8 +112,8 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 //
 //			}
 
+
 		}
-		List<Admin> Nos =adminMapper.selectIDNBySuperiorId(ad.getId());
 		return count;
 	}
 
@@ -219,7 +232,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 
 	@Override
 	public int insertNewAdmin(Admin ad ,List<String> roleIds) {
-		ad.setStatus("正常");
+		ad.setStatus("1");
 		ad.setId(UUID.randomUUID().toString());
 		ad.setType(sumType(roleIds));
 
@@ -234,7 +247,28 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 			}
 			TokenManager.clearUserAuthByUserId(ad.getId());
 		}
-		return adminMapper.insert(ad);
+		pushAmbRole(ad);
+
+
+		return adminMapper.insertSelective(ad);
+	}
+
+	/**
+	 * 计算巴权限
+	 * @param ad
+	 */
+	private void pushAmbRole(Admin ad) {
+		Admin use = adminMapper.selectByPrimaryKey(ad.getId());
+		AmbSystem ambSystem = ambSystemMapper.selectByPrimaryKey(Long.valueOf(ad.getAmbId()));
+		if (ambSystem.getLvl() == 5 || ambSystem.getLvl() == 6) {
+			if (use.getAmbRole() == null) {
+				ad.setAmbRole("7");
+			} else {
+				if (!use.getAmbRole().contains("7")) {
+					ad.setAmbRole(use.getAmbRole() + ",7");
+				}
+			}
+		}
 	}
 
 	@Override

+ 47 - 3
src/main/java/com/goafanti/ambSystem/service/Impl/AmbServiceImpl.java

@@ -4,8 +4,10 @@ import com.goafanti.ambSystem.bo.AmbAll;
 import com.goafanti.ambSystem.bo.InputAmb;
 import com.goafanti.ambSystem.bo.OutAmb;
 import com.goafanti.ambSystem.service.AmbService;
+import com.goafanti.common.dao.AdminMapper;
 import com.goafanti.common.dao.AmbSystemMapper;
 import com.goafanti.common.error.BusinessException;
+import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.AmbSystem;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -22,6 +24,8 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
     private Integer maxLvl=null;
     @Autowired
     private AmbSystemMapper ambSystemMapper;
+    @Autowired
+    private AdminMapper adminMapper;
 
     @Override
     public int addAmb(InputAmb in) {
@@ -29,6 +33,7 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
         in.setStatus("0");
         in.setCreateBy(TokenManager.getAdminId());
         in.setCreateTime(new Date());
+        pushAdminAmbRole(in);
         return ambSystemMapper.insertSelective(in);
     }
 
@@ -44,7 +49,7 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
     public int updateAmb(InputAmb in) {
         AmbSystem use = ambSystemMapper.selectByPrimaryKey(in.getId());
         int i=0;
-
+        //0为执行计算巴名称,1为已执行,无需再执行
         if (in.getParentId()!=null&&in.getParentId()!=use.getParentId()){
             getParentParam(in);
             i=updateAncestorsNames(in,use.getName(),i);
@@ -54,7 +59,44 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
         }
         in.setUpdateBy(TokenManager.getAdminId());
         in.setUpdateTime(new Date());
-        return ambSystemMapper.updateByPrimaryKeySelective(in);
+        ambSystemMapper.updateByPrimaryKeySelective(in);
+        if (!in.getLeader().equals(use.getLeader()))pushAdminAmbRole(in);
+        return 1;
+    }
+
+    /**
+     * 设置巴主巴角色
+     * @param in
+     */
+    private void pushAdminAmbRole(InputAmb in) {
+        Admin use = adminMapper.selectByPrimaryKey(in.getLeader());
+        StringBuffer str=new StringBuffer();
+
+        List<AmbSystem> list=selectByLeader(in.getLeader());
+        for (AmbSystem ambSystem : list) {
+            str.append(ambSystem.getLvl()).append(",");
+        }
+        Admin a =new Admin();
+        if (use.getAmbRole().contains("7")){
+            str.append("7").append(",");
+            a.setAmbRole(str.toString());
+        }else {
+            a.setAmbRole(str.substring(0,str.length()-1));
+        }
+        a.setId(in.getLeader());
+        adminMapper.updateByPrimaryKeySelective(a);
+    }
+
+    private List<AmbSystem> selectByLeader(String leader) {
+        AmbSystem a =new AmbSystem();
+        a.setLeader(leader);
+        return ambSystemMapper.selectByParameter(a);
+    }
+
+    private List<AmbSystem> selectByParentId(Long parentId) {
+        AmbSystem a =new AmbSystem();
+        a.setParentId(parentId);
+        return ambSystemMapper.selectByParameter(a);
     }
 
     private int updateAncestorsNames(InputAmb in,String useName,Integer i) {
@@ -98,13 +140,15 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
             int i = ambSystemMapper.selectByName(in.getName());
             if (i>0)return -1;
         }else if (type==2){
-            List<AmbSystem> ambSystems = ambSystemMapper.selectByParentId(in.getId());
+            List<AmbSystem> ambSystems = selectByParentId(in.getId());
             if (!ambSystems.isEmpty())return -1;
         }
 
         return 0;
     }
 
+
+
     @Override
     public Object detailsAmb(InputAmb in) {
         return ambSystemMapper.selectDtailsAmb(in.getId());

+ 2 - 2
src/main/java/com/goafanti/common/dao/AdminMapper.java

@@ -71,9 +71,9 @@ public interface AdminMapper {
 
     String selectNameByid(String id);
 
-    List<String>selectRolesByUid(String id);
+    List<Role> selectRolesByUid(String id);
+
 
-    List<String>selectRolesIdByUid(String id);
 
     String selectStatusByMobile(@Param("mobile")String mobile);
 

+ 3 - 1
src/main/java/com/goafanti/common/dao/AmbSystemMapper.java

@@ -22,7 +22,7 @@ public interface AmbSystemMapper {
 
     List<AmbAll> getAncestorsList(List<String> list);
 
-    List<AmbSystem> selectByParentId(Long id);
+    List<AmbSystem> selectByParameter(AmbSystem a);
 
     int selectByName(String name);
 
@@ -30,4 +30,6 @@ public interface AmbSystemMapper {
 
 
     int updateAncestorsNames(@Param(value = "id") Long id, @Param(value = "name")String name, @Param(value = "useName")String useName);
+
+    
 }

+ 61 - 47
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -25,11 +25,12 @@
     <result column="type" jdbcType="INTEGER" property="type" />
     <result column="reviewer" jdbcType="VARCHAR" property="reviewer" />
     <result column="amb_id" jdbcType="VARCHAR" property="ambId" />
+    <result column="amb_role" jdbcType="VARCHAR" property="ambRole" />
   </resultMap>
   <sql id="Base_Column_List">
     id, mobile, `name`, `password`, email, create_time, `number`, province, `position`,
     superior_id, city, department_id, `status`, user_no, duty, district, head_portrait_url,
-    contact_mobile, last_login_time, open_id, `type`, reviewer, amb_id
+    contact_mobile, last_login_time, open_id, `type`, reviewer, amb_id, amb_role
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
     select
@@ -49,7 +50,7 @@
       user_no, duty, district,
       head_portrait_url, contact_mobile, last_login_time,
       open_id, `type`, reviewer,
-      amb_id)
+      amb_id, amb_role)
     values (#{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
       #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{number,jdbcType=INTEGER},
       #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR}, #{superiorId,jdbcType=VARCHAR},
@@ -57,7 +58,7 @@
       #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR}, #{district,jdbcType=VARCHAR},
       #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR}, #{lastLoginTime,jdbcType=TIMESTAMP},
       #{openId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{reviewer,jdbcType=VARCHAR},
-      #{ambId,jdbcType=VARCHAR})
+      #{ambId,jdbcType=VARCHAR}, #{ambRole,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
     insert into admin
@@ -128,6 +129,9 @@
       <if test="ambId != null">
         amb_id,
       </if>
+      <if test="ambRole != null">
+        amb_role,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="mobile != null">
@@ -196,6 +200,9 @@
       <if test="ambId != null">
         #{ambId,jdbcType=VARCHAR},
       </if>
+      <if test="ambRole != null">
+        #{ambRole,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Admin">
@@ -267,6 +274,9 @@
       <if test="ambId != null">
         amb_id = #{ambId,jdbcType=VARCHAR},
       </if>
+      <if test="ambRole != null">
+        amb_role = #{ambRole,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -293,7 +303,8 @@
       open_id = #{openId,jdbcType=VARCHAR},
       `type` = #{type,jdbcType=INTEGER},
       reviewer = #{reviewer,jdbcType=VARCHAR},
-      amb_id = #{ambId,jdbcType=VARCHAR}
+      amb_id = #{ambId,jdbcType=VARCHAR},
+      amb_role = #{ambRole,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
 
@@ -522,38 +533,35 @@
 
   <!--*************************************************************************-->
   <select id="selectAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
-    select x.*,y.name as departmentName from(select
-    <!-- a.user_no as userNo, -->
-    a.mobile, a.name,
-    a.position, a.email, a.id,
-    a.province,
-    a.city,
-    a.create_time as createTime,
-    aa.name as superior,
-    a.superior_id as superiorId,
-    a.department_id as departmentId,
-    a.last_login_time as lastLoginTime,
-    a.contact_mobile as contactMobile,
-    a.duty,a.status,
-    a.type
+    select a.id, a.mobile, a.name, a.position, a.email, a.province, a.city, a.create_time as createTime, aa.name as superior,dep.name departmentName,
+    a.superior_id as superiorId, a.department_id as departmentId, a.last_login_time as lastLoginTime, a.contact_mobile as contactMobile,
+    a.duty,a.status, a.type, ambs.id ambId,ambs.name ambName,ambs.ancestors_names ancestorsNames ,a.amb_role ambRole
     from admin a
     left join admin_location al on a.id = al.admin_id
     left join admin aa on aa.id = a.superior_id
-    left join user_role ur on a.id=ur.uid
-    left join `role` y on ur.rid=y.id
-    where a.id <![CDATA[ <> ]]> '1'
+    left join amb_system ambs on a.amb_id=ambs.id
+    left join department dep on a.department_id = dep.id
+    <if test="rid != null">
+      RIGHT join (select uid from user_role where rid=#{rid,jdbcType=VARCHAR}) ur on a.id=ur.uid
+    </if>
     <if test="roleName != null">
-      and y.role_name= #{roleName,jdbcType=VARCHAR}
+      left  join  user_role  ur on a.id=ur.uid
+      RIGHT join (select id from role where role_name =#{roleName,jdbcType=VARCHAR}) y on ur.rid=y.id
+    </if>
+    <if test="ambManage ==0">
+      RIGHT join (select id from admin where(find_in_set( 5 ,amb_role) or find_in_set( 6 ,amb_role)))am on a.id !=am.id
     </if>
+    <if test="ambManage ==1">
+      RIGHT join (select id from admin where(find_in_set( 5 ,amb_role) or find_in_set( 6 ,amb_role)))am on a.id =am.id
+    </if>
+    where a.status in (0,1)
     <if test="name != null">
       and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
     </if>
     <if test="departmentId != null">
       and a.department_id = #{departmentId,jdbcType=VARCHAR}
     </if>
-    <if test="rid != null">
-      and ur.rid = #{rid,jdbcType=VARCHAR}
-    </if>
+
     <if test="duty != null">
       and a.duty = #{duty,jdbcType=VARCHAR}
     </if>
@@ -569,30 +577,38 @@
     <if test="superiorId != null">
       and a.superior_id = #{superiorId,jdbcType=VARCHAR}
     </if>
-    group by a.id
-    order by a.last_login_time,a.number )x left join department y on x.departmentId = y.id
+    <if test="ambId != null">
+      and a.amb_id = #{ambId}
+    </if>
+    <if test="ancestors != null">
+      and (ambs.id=#{ancestors} or find_in_set( #{ancestors} ,ambs.ancestors))
+    </if>
+    order by a.last_login_time desc
     <if test="page_sql!=null">
       ${page_sql}
     </if>
   </select>
   <select id="selectAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
-    select count(t.counts)
-    from(select a.id counts from (select a.id  from admin a
-    left join user_role ur on a.id=ur.uid
-    left join `role` y on ur.rid=y.id
-    where a.id <![CDATA[ <> ]]> '1'
+    select count(*)
+    from admin a
+    left join admin_location al on a.id = al.admin_id
+    left join admin aa on aa.id = a.superior_id
+    left join amb_system ambs on a.amb_id=ambs.id
+    left join department dep on a.department_id = dep.id
+    <if test="rid != null">
+      RIGHT join (select * from user_role where rid=#{rid,jdbcType=VARCHAR}) ur on a.id=ur.uid
+    </if>
     <if test="roleName != null">
-      and y.role_name= #{roleName,jdbcType=VARCHAR}
+      left  join  user_role  ur on a.id=ur.uid
+      RIGHT join (select * from role where role_name =#{roleName,jdbcType=VARCHAR}) y on ur.rid=y.id
     </if>
+    where a.status in (0,1)
     <if test="name != null">
       and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
     </if>
     <if test="departmentId != null">
       and a.department_id = #{departmentId,jdbcType=VARCHAR}
     </if>
-    <if test="rid != null">
-      and ur.rid = #{rid,jdbcType=VARCHAR}
-    </if>
     <if test="duty != null">
       and a.duty = #{duty,jdbcType=VARCHAR}
     </if>
@@ -608,8 +624,12 @@
     <if test="superiorId != null">
       and a.superior_id = #{superiorId,jdbcType=VARCHAR}
     </if>
-    )a
-    group by a.id)t
+    <if test="ambId != null">
+      and a.amb_id = #{ambId}
+    </if>
+    <if test="ancestors != null">
+      and (ambs.id=#{ancestors} or find_in_set( #{ancestors} ,ambs.ancestors))
+    </if>
   </select>
   <insert id="insertn" parameterType="com.goafanti.common.model.Admin">
     insert into admin (id, mobile, name,
@@ -659,21 +679,15 @@
     where
       id=#{id,jdbcType=VARCHAR}
   </select>
-  <select id="selectRolesByUid" parameterType="java.lang.String" resultType="java.lang.String">
+  <select id="selectRolesByUid" parameterType="com.goafanti.common.model.Role" resultType="com.goafanti.common.model.Role">
     select
-      r.role_name as roles
+      r.id,r.role_name as roleName
     from user_role ur
            left join role r on r.id = ur.rid
     where
       uid=#{id,jdbcType=VARCHAR}
   </select>
-  <select id="selectRolesIdByUid" parameterType="java.lang.String" resultType="java.lang.String">
-    select
-      rid as rolesId
-    from user_role
-    where
-      uid=#{id,jdbcType=VARCHAR}
-  </select>
+
   <select id="selectStatusByMobile" parameterType="java.lang.String" resultType="java.lang.String">
     select
       status

+ 8 - 2
src/main/java/com/goafanti/common/mapper/AmbSystemMapper.xml

@@ -306,11 +306,17 @@
       and (a.id=#{ancestors} or find_in_set( #{ancestors} ,a.ancestors))
     </if>
   </select>
-    <select id="selectByParentId"  parameterType="java.lang.Long" resultMap="BaseResultMap">
+    <select id="selectByParameter"  parameterType="com.goafanti.common.model.AmbSystem" resultMap="BaseResultMap">
         select
         <include refid="Base_Column_List" />
         from amb_system
-        where parent_id = #{id,jdbcType=BIGINT}
+        where 1=1
+          <if test="parentId !=null">
+            and  parent_id = #{parentId}
+          </if>
+      <if test="leader !=null">
+        and  leader = #{leader}
+      </if>
     </select>
     <select id="selectByName" resultType="java.lang.Integer">
       select

+ 21 - 3
src/main/java/com/goafanti/common/model/Admin.java

@@ -123,6 +123,13 @@ public class Admin extends BaseModel implements AftUser {
     private String ambId;
 
     /**
+     * 阿米巴权限
+     */
+    private String ambRole;
+
+
+
+    /**
      * 上级管理用户名称
      */
     private String	superior;
@@ -199,9 +206,7 @@ public class Admin extends BaseModel implements AftUser {
         return createTime;
     }
 
-    public String getAid() {
-        return id;
-    }
+
 
     public void setCreateTime(Date createTime) {
         this.createTime = createTime;
@@ -342,4 +347,17 @@ public class Admin extends BaseModel implements AftUser {
     public void setAmbId(String ambId) {
         this.ambId = ambId;
     }
+
+    public String getAmbRole() {
+        return ambRole;
+    }
+
+    public void setAmbRole(String ambRole) {
+        this.ambRole = ambRole;
+    }
+
+    @Override
+    public String getAid() {
+        return null;
+    }
 }

+ 14 - 4
src/main/java/com/goafanti/common/model/Role.java

@@ -3,12 +3,13 @@ package com.goafanti.common.model;
 import java.io.Serializable;
 import java.util.Date;
 
-public class Role extends BaseModel implements Serializable{
+public class Role  implements Serializable{
     /**
-	 * 
+	 *
 	 */
 	private static final long serialVersionUID = 1L;
 
+	private String id;
 
     private String roleName;
 
@@ -23,7 +24,16 @@ public class Role extends BaseModel implements Serializable{
      */
     private Date createTime;
 
-	public String getCreater() {
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getCreater() {
 		return creater;
 	}
 
@@ -56,4 +66,4 @@ public class Role extends BaseModel implements Serializable{
     public void setRoleType(Integer roleType) {
         this.roleType = roleType;
     }
-}
+}