Search in sources :

Example 6 with UserLoginDto

use of io.jpom.model.dto.UserLoginDto in project Jpom by dromara.

the class UserService method getUserJwtId.

/**
 * 查询用户 jwt id
 *
 * @param userModel 用户
 * @return jwt id
 */
public UserLoginDto getUserJwtId(UserModel userModel) {
    String id = userModel.getId();
    String sql = "select password from USER_INFO where id=?";
    List<Entity> query = super.query(sql, id);
    Entity first = CollUtil.getFirst(query);
    Assert.notEmpty(first, "没有对应的用户信息");
    String password = (String) first.get("password");
    Assert.hasText(password, "没有对应的用户信息");
    return new UserLoginDto(JwtUtil.builder(userModel, password), password);
}
Also used : Entity(cn.hutool.db.Entity) UserLoginDto(io.jpom.model.dto.UserLoginDto)

Aggregations

UserLoginDto (io.jpom.model.dto.UserLoginDto)6 NotLogin (io.jpom.common.interceptor.NotLogin)4 UserModel (io.jpom.model.data.UserModel)4 JSONObject (com.alibaba.fastjson.JSONObject)2 WorkspaceModel (io.jpom.model.data.WorkspaceModel)2 Entity (cn.hutool.db.Entity)1 JWT (cn.hutool.jwt.JWT)1 ClassFeature (io.jpom.permission.ClassFeature)1 Feature (io.jpom.permission.Feature)1 MethodFeature (io.jpom.permission.MethodFeature)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1