Commit 2d838398 authored by hezhen's avatar hezhen

123

parent 447e3fcb
......@@ -66,6 +66,16 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
log.info("----userId==="+userId+"----parentId===="+parentId+"----自己不能成为自己的上线");
return;
}
AppUserVo appUserVo=userDetailBiz.getUserInfoById(userId);
if (appUserVo==null){
log.info("----userId==="+userId+"----parentId===="+parentId+"----该用户不存在");
return;
}
appUserVo=userDetailBiz.getUserInfoById(parentId);
if (appUserVo==null){
log.info("----userId==="+userId+"----parentId===="+parentId+"----该上线用户不存在");
return;
}
AppUserRelation relation=getMyBiz().getRelationByUserId(parentId);
Long time=System.currentTimeMillis();
if(relation==null){
......@@ -122,7 +132,6 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
}
}
/**
* 小程序分享上下线绑定
* @param userid 当前人小程序id
......@@ -218,9 +227,10 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
//获取用户的下线总数
public int getCountByParentId(Integer parentId,Long time){
Example example=new Example(AppUserRelation.class);
example.createCriteria().andEqualTo("parentId",parentId).andNotEqualTo("isForever",1).andGreaterThan("bindTime",time);
return mapper.selectCountByExample(example);
if (validTime<=0){
time= validTime;
}
return mapper.countByParentId(parentId,time);
}
@CacheClear(key="user:relation{1.userId}")
......
package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.entity.AppUserRelation;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
......@@ -16,4 +17,7 @@ public interface AppUserRelationMapper extends Mapper<AppUserRelation> {
List<AppUserRelation> selectByLeaderId(Integer leaderId);
//获取有效的下级
public int countByParentId(@Param("parentId")Integer parentId,@Param("bindTime")Long bindTime);
}
......@@ -6,4 +6,12 @@
<select id="selectByLeaderId" resultType="com.github.wxiaoqi.security.admin.entity.AppUserRelation">
select `parent_id` as `parentId`,`user_id`as `userId`,`bind_time` as `bindTime` from `app_user_relation` where `parent_id`=#{leaderId} and `is_del`=0 order by `bind_time` DESC
</select>
<select id="countByParentId">
select count(*) from `app_user_relation` where
`parent_id`=#{parentId} and `is_del`=0
<if test="bindTime!='' and bindTime!=null and bindTime>0">
and (is_forever=2 or bind_time>#{bindTime})
</if>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment