| | |
| | | * @return 用户实体 |
| | | */ |
| | | public BaUser selectById(Long id) { |
| | | return this.dao.selectById(id); |
| | | return this.dao.selectByPrimaryKey(id); |
| | | } |
| | | |
| | | /** |
| | |
| | | if(list_users.size() > 0) { |
| | | for(int i = 0; i < list_users.size(); i++) { |
| | | VoUserInfo voUserInfo = list_users.get(i); |
| | | String userId = voUserInfo.getUserId(); |
| | | String userId = voUserInfo.getId(); |
| | | |
| | | JSONArray array_roleIds = new JSONArray(); |
| | | List<Map<String, Object>> list_roleIds = Optional.ofNullable(this.dao.getRoleIdsByUserId(Long.parseLong(userId))).orElse(new ArrayList<>()); |
| | |
| | | public Long save(BaUser po){ |
| | | //return this.dao.putin(po) ; |
| | | this.dao.putin(po) ; |
| | | return po.getUserId(); |
| | | return po.getId(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 插入用户与角色关联记录数量 |
| | | */ |
| | | public int setRoles(Long userId, String[] roleIds) { |
| | | this.urDao.deleteByUserId(userId); |
| | | |
| | | int count = 0; |
| | | if (roleIds != null && roleIds.length > 0) { |
| | | this.urDao.deleteByUserId(userId); |
| | | for (String roleId : roleIds) { |
| | | count += this.urDao.insertSelective(new BaUserRole(userId, Long.parseLong(roleId))); |
| | | } |
| | | } |
| | | return count; |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | |
| | | if(map.size() == 0) { |
| | | return null; |
| | | } |
| | | voUserInfo.setUserId(String.valueOf(userId)); |
| | | voUserInfo.setId(String.valueOf(userId)); |
| | | voUserInfo.setUserName(map.get("userName").toString()); |
| | | voUserInfo.setPhone(map.get("phone").toString()); |
| | | voUserInfo.setBlockId(map.get("blockId").toString()); |