|
@ -162,7 +162,7 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
|
|
|
Map<String, Object> userinfo = new HashedMap();
|
|
|
|
|
|
UserDO user = userDao.findOne(id);
|
|
|
RoleDO role = roleDao.findByCode(user.getRoleCode());
|
|
|
RoleDO role = roleDao.findByCode(user.getRoleId());
|
|
|
|
|
|
userinfo.put("id", user.getId());
|
|
|
userinfo.put("name", user.getName());
|
|
@ -395,11 +395,11 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
|
|
|
* @param userId
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject generateUserOrgTree(String saasid,String userId,String roleCode) throws IOException {
|
|
|
public JSONObject generateUserOrgTree(String saasid,String userId,String roleId) throws IOException {
|
|
|
JSONObject result = new JSONObject();
|
|
|
List<OrgTree> orgList = new ArrayList<>();
|
|
|
// 有归属租户加载saas底下的所有机构树列表,角色为机构管理员时不需要选管理机构
|
|
|
if(!StringUtils.isEmpty(saasid) && !StringUtils.endsWithIgnoreCase(RoleDO.BaseRoleType.admin.toString(),roleCode)){
|
|
|
if(!StringUtils.isEmpty(saasid) && !StringUtils.endsWithIgnoreCase(RoleDO.BaseRoleType.admin.toString(),roleId)){
|
|
|
StringBuilder sql = new StringBuilder("SELECT " +
|
|
|
" tree.* " +
|
|
|
" FROM " +
|
|
@ -506,19 +506,19 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
|
|
|
* 用户信息列表
|
|
|
* @param name
|
|
|
* @param saasid
|
|
|
* @param roleCode
|
|
|
* @param roleId
|
|
|
* @param page
|
|
|
* @param size
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject userInfoList(String name,String saasid,String roleCode,int page,int size) throws Exception {
|
|
|
public JSONObject userInfoList(String name,String saasid,String roleId,int page,int size) throws Exception {
|
|
|
JSONObject result = new JSONObject();
|
|
|
int start = 0 == page ? page++ : (page - 1) * size;
|
|
|
int end = 0 == size ? 15 : page * size;
|
|
|
String realName = null == name ? "" : name;
|
|
|
String saasidValue = null == saasid ? "" : saasid;
|
|
|
String roleCodeValue = null == roleCode ? "" : roleCode;
|
|
|
String roleIdValue = null == roleId ? "" : roleId;
|
|
|
|
|
|
String sql = "SELECT " +
|
|
|
" user.id as id, " +
|
|
@ -535,16 +535,16 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
|
|
|
" WHERE " +
|
|
|
" user.saas_id = saas.id " +
|
|
|
" AND " +
|
|
|
" user.role_code = role.code " +
|
|
|
" user.role_id = role.id " +
|
|
|
" and (user.name like '{realName}' or '' ='{realName}') " +
|
|
|
" and (saas.id = '{saasid}' or '' = '{saasid}') " +
|
|
|
" and ( user.role_code = '{roleCode}' or '' = '{roleCode}') " +
|
|
|
" and ( user.role_id = '{roleId}' or '' = '{roleId}') " +
|
|
|
" ORDER BY user.create_time DESC" +
|
|
|
" limit {start},{end} ";
|
|
|
String finalSql = sql
|
|
|
.replace("{realName}","%" + realName + "%")
|
|
|
.replace("{saasid}",saasidValue)
|
|
|
.replace("{roleCode}",roleCodeValue)
|
|
|
.replace("{roleId}",roleIdValue)
|
|
|
.replace("{start}",String.valueOf(start))
|
|
|
.replace("{end}",String.valueOf(end));
|
|
|
|
|
@ -557,14 +557,14 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
|
|
|
"WHERE " +
|
|
|
" user.saas_id = saas.id " +
|
|
|
" AND " +
|
|
|
" user.role_code = role.code " +
|
|
|
" user.role_id = role.id " +
|
|
|
" and (user.name like '{realName}' or '' ='{realName}') " +
|
|
|
" and (saas.id = '{saasid}' or '' = '{saasid}') " +
|
|
|
" and ( user.role_code = '{roleCode}' or '' = '{roleCode}') ";
|
|
|
" and ( user.role_id = '{roleId}' or '' = '{roleId}') ";
|
|
|
String finalCountSql = countSql
|
|
|
.replace("{realName}", "%" + realName + "%")
|
|
|
.replace("{saasid}", saasidValue )
|
|
|
.replace("{roleCode}", roleCodeValue );
|
|
|
.replace("{roleId}", roleIdValue );
|
|
|
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(finalSql);
|
|
|
Integer count = jdbcTemplate.queryForObject(finalCountSql, Integer.class);
|