Commit 479a7384 authored by libin's avatar libin

员工数据补录

parent 299603ff
......@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.time.Instant;
import java.util.*;
import java.util.stream.Collectors;
......@@ -411,5 +412,9 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper, AppUserRe
List<UserBo> userBoList = mapper.findAllRelations();
return CollectionUtils.isEmpty(userBoList)?Collections.emptyList():userBoList;
}
public void updateParentIdByUserId(Integer leaderId, Integer userId) {
mapper.updateParentIdByUserId(leaderId,userId, Instant.now().toEpochMilli());
}
}
......@@ -28,4 +28,5 @@ public interface AppUserRelationMapper extends Mapper<AppUserRelation> {
List<UserBo> findAllRelations();
void updateParentIdByUserId(@Param("leaderId") Integer leaderId,@Param("userId") Integer userId,@Param("updTime") Long updTime);
}
......@@ -27,14 +27,18 @@
</select>
<select id="findAllRelations" resultType="com.github.wxiaoqi.security.admin.bo.UserBo">
select aulp.id as `leaderId`,aulp.username as `leaderPhone`,aulc.id as `userId`,aulc.username as `phone`,
select aur.parent_id as `leaderId`,aulp.username as `leaderPhone`,aulc.id as `userId`,aulc.username as `phone`,
IFNULL(audp.realname,audp.nickname) as `leaderName`,IFNULL(audc.realname,audc.nickname) as `name`,aupt.company_name as `companyName`
from `app_user_relation` as aur
inner join `app_user_login` as aulp on aulp.id = aur.parent_id
left join `app_user_login` as aulp on aulp.id = aur.parent_id
inner join `app_user_login` as aulc on aulc.id=aur.user_id
inner join `app_user_detail` as audp on audp.userid= aulp.id
left join `app_user_detail` as audp on audp.userid= aulp.id
inner join `app_user_detail` as `audc` on audc.userid= aulc.id
left join `app_user_position_temp` as `aupt` on aupt.user_id = aulc.id
where aur.is_del=0 and aulp.isdel=0 and aulc.isdel=0
where aur.is_del=0 and aulc.isdel=0
</select>
<select id="updateParentIdByUserId">
update `app_user_relation` set `parent_id`=#{leaderId},`upd_time`=#{updTime} where user_id=#{userId}
</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