Browse Source

api access token dev update

pull/2/head
qiaozhanwei 6 years ago
parent
commit
3118a7626c
  1. 5
      escheduler-api/src/main/java/cn/escheduler/api/service/AccessTokenService.java
  2. 1
      escheduler-dao/src/main/java/cn/escheduler/dao/mapper/AccessTokenMapper.java
  3. 3
      escheduler-dao/src/main/java/cn/escheduler/dao/mapper/AccessTokenMapperProvider.java
  4. 5
      escheduler-dao/src/test/java/cn/escheduler/dao/mapper/AccessTokenMapperTest.java

5
escheduler-api/src/main/java/cn/escheduler/api/service/AccessTokenService.java

@ -111,6 +111,8 @@ public class AccessTokenService extends BaseService {
accessToken.setUserId(userId); accessToken.setUserId(userId);
accessToken.setExpireTime(DateUtils.stringToDate(expireTime)); accessToken.setExpireTime(DateUtils.stringToDate(expireTime));
accessToken.setToken(token); accessToken.setToken(token);
accessToken.setCreateTime(new Date());
accessToken.setUpdateTime(new Date());
// insert // insert
int insert = accessTokenMapper.insert(accessToken); int insert = accessTokenMapper.insert(accessToken);
@ -120,6 +122,7 @@ public class AccessTokenService extends BaseService {
} else { } else {
putMsg(result, Status.CREATE_ALERT_GROUP_ERROR); putMsg(result, Status.CREATE_ALERT_GROUP_ERROR);
} }
return result; return result;
} }
@ -173,8 +176,6 @@ public class AccessTokenService extends BaseService {
accessToken.setToken(token); accessToken.setToken(token);
accessToken.setUpdateTime(new Date()); accessToken.setUpdateTime(new Date());
accessTokenMapper.update(accessToken); accessTokenMapper.update(accessToken);
putMsg(result, Status.SUCCESS); putMsg(result, Status.SUCCESS);

1
escheduler-dao/src/main/java/cn/escheduler/dao/mapper/AccessTokenMapper.java

@ -68,6 +68,7 @@ public interface AccessTokenMapper {
@Results(value = {@Result(property = "id", column = "id", id = true, javaType = Integer.class, jdbcType = JdbcType.INTEGER), @Results(value = {@Result(property = "id", column = "id", id = true, javaType = Integer.class, jdbcType = JdbcType.INTEGER),
@Result(property = "userId", column = "user_id", javaType = Integer.class, jdbcType = JdbcType.INTEGER), @Result(property = "userId", column = "user_id", javaType = Integer.class, jdbcType = JdbcType.INTEGER),
@Result(property = "token", column = "token", javaType = String.class, jdbcType = JdbcType.VARCHAR), @Result(property = "token", column = "token", javaType = String.class, jdbcType = JdbcType.VARCHAR),
@Result(property = "userName", column = "user_name", javaType = String.class, jdbcType = JdbcType.VARCHAR),
@Result(property = "expireTime", column = "expire_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE), @Result(property = "expireTime", column = "expire_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE),
@Result(property = "createTime", column = "create_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE), @Result(property = "createTime", column = "create_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE),
@Result(property = "updateTime", column = "update_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE) @Result(property = "updateTime", column = "update_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE)

3
escheduler-dao/src/main/java/cn/escheduler/dao/mapper/AccessTokenMapperProvider.java

@ -96,8 +96,9 @@ public class AccessTokenMapperProvider {
SELECT("count(0)"); SELECT("count(0)");
FROM(TABLE_NAME + " t,t_escheduler_user u"); FROM(TABLE_NAME + " t,t_escheduler_user u");
Object searchVal = parameter.get("searchVal"); Object searchVal = parameter.get("searchVal");
WHERE("u.id = t.user_id");
if(searchVal != null && StringUtils.isNotEmpty(searchVal.toString())){ if(searchVal != null && StringUtils.isNotEmpty(searchVal.toString())){
WHERE("u.id = t.user_id and u.user_name like concat('%', #{searchVal}, '%')"); WHERE(" u.user_name like concat('%', #{searchVal}, '%')");
} }
}}.toString(); }}.toString();
} }

5
escheduler-dao/src/test/java/cn/escheduler/dao/mapper/AccessTokenMapperTest.java

@ -51,8 +51,9 @@ public class AccessTokenMapperTest {
@Test @Test
public void testListPaging(){ public void testListPaging(){
Integer integer = accessTokenMapper.countAccessTokenPaging("hw"); Integer integer = accessTokenMapper.countAccessTokenPaging("");
List<AccessToken> accessTokenList = accessTokenMapper.queryAccessTokenPaging("hw", 0, 2); System.out.println(integer);
List<AccessToken> accessTokenList = accessTokenMapper.queryAccessTokenPaging("", 0, 2);
System.out.println(accessTokenList); System.out.println(accessTokenList);
} }

Loading…
Cancel
Save