机构管理最新需求
This commit is contained in:
+11
@@ -73,6 +73,17 @@ public class TsInstitutionController extends BaseController<TsInstitution> {
|
||||
return Result.success(tsUserIPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询机构下所有的机构人员
|
||||
* @return ResponseMessage<List<TsUser>>
|
||||
*/
|
||||
@ApiOperation("查询机构的人员")
|
||||
@PostMapping("/userUnderInstitution")
|
||||
public ResponseMessage<IPage<TsUser>> userUnderInstitution(TsUser tsUser){
|
||||
|
||||
return Result.success(tsUserService.getAllUsers(tsUser));
|
||||
}
|
||||
|
||||
@ApiOperation("导入机构数据")
|
||||
@PostMapping("/import")
|
||||
public ResponseMessage<Object> importInstitution() throws Exception {
|
||||
|
||||
@@ -49,7 +49,11 @@ public interface TsUserDao extends BaseMapper<TsUser> {
|
||||
*/
|
||||
List<TsUser> getUserAndPositionPage(@Param("start")Integer start, @Param("end")Integer end,@Param("TsUser") TsUser tsUser);
|
||||
|
||||
List<TsUser> userUnderInstitution(@Param("start")Integer start, @Param("end")Integer end,@Param("TsUser") TsUser tsUser,@Param("ids") List<String> ids);
|
||||
|
||||
Integer getUserAndPositionCount(@Param("TsUser") TsUser tsUser);
|
||||
|
||||
Integer userUnderInstitutionCount(@Param("TsUser") TsUser tsUser,@Param("ids") List<String> ids);
|
||||
/**
|
||||
* 通过岗位Id列表查询用户ID列表
|
||||
* @param positionIds:岗位ID列表
|
||||
|
||||
@@ -83,4 +83,6 @@ public interface ITsUserService extends IService<TsUser> {
|
||||
List<UpDTO> selectByName(String name);
|
||||
|
||||
List<UpDTO> selectNameById(List<String> strings,String type);
|
||||
|
||||
IPage<TsUser> getAllUsers(TsUser tsUser);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.adc.da.slrs.sarUser.service.impl;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.login.util.UserUtils;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
|
||||
import com.adc.da.slrs.sarInstitution.service.ITsInstitutionService;
|
||||
import com.adc.da.slrs.sarMenu.entity.SarMenu;
|
||||
import com.adc.da.slrs.sarMenu.service.ISarMenuService;
|
||||
import com.adc.da.slrs.sarPosition.dao.TsPositionDao;
|
||||
@@ -47,6 +49,8 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
|
||||
@Autowired
|
||||
private TsUserDao tsUserDao;
|
||||
@Autowired
|
||||
private ITsUserService tsUserService;
|
||||
@Autowired
|
||||
private ITsPositionService tsPositionService;
|
||||
@Autowired
|
||||
@Lazy
|
||||
@@ -59,6 +63,8 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
|
||||
private SyncUserService syncUserService;
|
||||
@Autowired
|
||||
private TsPositionDao tsPositionDao;
|
||||
@Autowired
|
||||
private ITsInstitutionService tsInstitutionService;
|
||||
|
||||
|
||||
public void deleteUser(){
|
||||
@@ -364,4 +370,40 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<TsUser> getAllUsers(TsUser tsUser) {
|
||||
List<String> ids=new ArrayList<>();
|
||||
ids.add(tsUser.getInstitutionId());
|
||||
List<String> middle=new ArrayList<>();
|
||||
middle.addAll(ids);
|
||||
boolean flag=true;
|
||||
while (flag){
|
||||
QueryWrapper<TsInstitution> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.in("parent_id",middle);
|
||||
List<TsInstitution> tsmiddle=tsInstitutionService.list(queryWrapper);
|
||||
if (tsmiddle.size()>0){
|
||||
tsmiddle.forEach(tsInstitution -> {
|
||||
middle.add(tsInstitution.getId());
|
||||
});
|
||||
middle.removeAll(ids);
|
||||
ids.addAll(middle);
|
||||
}else {
|
||||
tsmiddle.forEach(tsInstitution -> {
|
||||
middle.add(tsInstitution.getId());
|
||||
});
|
||||
middle.removeAll(ids);
|
||||
ids.addAll(middle);
|
||||
flag=false;
|
||||
}
|
||||
}
|
||||
Page<TsUser> tsUserPage = new Page<>();
|
||||
tsUserPage.setCurrent(tsUser.getCurrent());
|
||||
tsUserPage.setSize(tsUser.getSize());
|
||||
tsUserPage.setRecords(tsUserDao.userUnderInstitution((tsUser.getCurrent()-1)*tsUser.getSize(),tsUser.getSize(),tsUser,ids));
|
||||
tsUserPage.setTotal(tsUserDao.userUnderInstitutionCount(tsUser,ids));
|
||||
return tsUserPage;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -48,6 +48,49 @@
|
||||
limit #{start},#{end}
|
||||
</select>
|
||||
|
||||
<select id="userUnderInstitution" parameterType="com.adc.da.slrs.sarUser.entity.TsUser" resultMap="UserPosition">
|
||||
select u.*,p.id p_id,p.name p_name from ts_user u
|
||||
left join ts_user_position up
|
||||
on u.usid=up.user_id
|
||||
left join ts_position p
|
||||
on up.position_id=p.id
|
||||
where 1=1
|
||||
<if test="TsUser.uname != null and TsUser.uname != '' ">
|
||||
and u.uname like concat('%',#{TsUser.uname},'%')
|
||||
</if>
|
||||
<if test="TsUser.email != null and TsUser.email != '' ">
|
||||
and u.email like concat('%',#{TsUser.email},'%')
|
||||
</if>
|
||||
<if test=" null != ids and ids.size()> 0">
|
||||
and INSTITUTION_ID in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")" index="index">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
limit #{start},#{end}
|
||||
</select>
|
||||
|
||||
<select id="userUnderInstitutionCount" resultType="java.lang.Integer">
|
||||
select count(u.USID) from ts_user u
|
||||
left join ts_user_position up
|
||||
on u.usid=up.user_id
|
||||
left join ts_position p
|
||||
on up.position_id=p.id
|
||||
where 1=1
|
||||
<if test="TsUser.uname != null and TsUser.uname != '' ">
|
||||
and u.uname like concat('%',#{TsUser.uname},'%')
|
||||
</if>
|
||||
<if test="TsUser.email != null and TsUser.email != '' ">
|
||||
and u.email like concat('%',#{TsUser.email},'%')
|
||||
</if>
|
||||
<if test=" null != ids and ids.size()> 0">
|
||||
and INSTITUTION_ID in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")" index="index">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getUserAndPositionCount" parameterType="com.adc.da.slrs.sarUser.entity.TsUser" resultType="java.lang.Integer">
|
||||
select count(u.USID) from ts_user u
|
||||
left join ts_user_position up
|
||||
|
||||
Reference in New Issue
Block a user