Commit 27b20b52 authored by qiaozhanwei's avatar qiaozhanwei
Browse files

update admin gen token

parent 45886e46
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -283,6 +283,26 @@ public class UsersController extends BaseController{
    @GetMapping(value="/list")
    @ResponseStatus(HttpStatus.OK)
    public Result listUser(@RequestAttribute(value = Constants.SESSION_USER) User loginUser){
        logger.info("login user {}, user list");
        try{
            Map<String, Object> result = usersService.queryAllGeneralUsers(loginUser);
            return returnDataList(result);
        }catch (Exception e){
            logger.error(USER_LIST_ERROR.getMsg(),e);
            return error(Status.USER_LIST_ERROR.getCode(), Status.USER_LIST_ERROR.getMsg());
        }
    }


    /**
     * user list no paging
     *
     * @param loginUser
     * @return
     */
    @GetMapping(value="/list-all")
    @ResponseStatus(HttpStatus.OK)
    public Result listAll(@RequestAttribute(value = Constants.SESSION_USER) User loginUser){
        logger.info("login user {}, user list");
        try{
            Map<String, Object> result = usersService.queryUserList(loginUser);
@@ -293,6 +313,7 @@ public class UsersController extends BaseController{
        }
    }


    /**
     * verify username
     *
+21 −0
Original line number Diff line number Diff line
@@ -518,6 +518,27 @@ public class UsersService extends BaseService {
        return result;
    }

    /**
     * query user list
     *
     * @param loginUser
     * @return
     */
    public Map<String, Object> queryAllGeneralUsers(User loginUser) {
        Map<String, Object> result = new HashMap<>(5);
        //only admin can operate
        if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM, Constants.STATUS)) {
            return result;
        }

        List<User> userList = userMapper.queryAllGeneralUsers();
        result.put(Constants.DATA_LIST, userList);
        putMsg(result, Status.SUCCESS);

        return result;
    }


    /**
     * query user list
     *
+19 −0
Original line number Diff line number Diff line
@@ -76,6 +76,25 @@ public interface UserMapper {
    @SelectProvider(type = UserMapperProvider.class, method = "queryById")
    User queryById(@Param("userId") int userId);

    /**
     * query all general user list
     * @return
     */
    @Results(value = {
            @Result(property = "id", column = "id", id = true, javaType = Integer.class, jdbcType = JdbcType.INTEGER),
            @Result(property = "userName", column = "user_name", javaType = String.class, jdbcType = JdbcType.VARCHAR),
            @Result(property = "userPassword", column = "user_password", javaType = String.class, jdbcType = JdbcType.VARCHAR),
            @Result(property = "email", column = "email", javaType = String.class, jdbcType = JdbcType.VARCHAR),
            @Result(property = "phone", column = "phone", javaType = String.class, jdbcType = JdbcType.VARCHAR),
            @Result(property = "userType", column = "user_type", typeHandler = EnumOrdinalTypeHandler.class, javaType = UserType.class, jdbcType = JdbcType.TINYINT),
            @Result(property = "tenantId", column = "tenant_id", javaType = Integer.class, jdbcType = JdbcType.INTEGER),
            @Result(property = "createTime", column = "create_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE),
            @Result(property = "updateTime", column = "update_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE)
    })
    @SelectProvider(type = UserMapperProvider.class, method = "queryAllGeneralUsers")
    List<User> queryAllGeneralUsers();


    /**
     * query all user list
     * @return
+17 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ public class UserMapperProvider {
     *
     * @return
     */
    public String queryAllUsers() {
    public String queryAllGeneralUsers() {
        return new SQL() {
            {
                SELECT("*");
@@ -130,6 +130,22 @@ public class UserMapperProvider {
        }.toString();
    }

    /**
     * query all user list
     *
     * @return
     */
    public String queryAllUsers() {
        return new SQL() {
            {
                SELECT("*");
                FROM(TABLE_NAME);
            }
        }.toString();
    }



    /**
     * check user name and password
     *
+2 −2
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@
        }
      }
      if (this.auth) {
        this.store.dispatch(`security/getUsersList`).then(res => {
        this.store.dispatch(`security/getUsersAll`).then(res => {
          this.userIdList = _.map(res, v => _.pick(v, ['id', 'userName']))
          d(this.userIdList[0].id)
        })
Loading