api access token dev update

This commit is contained in:
qiaozhanwei 2019-04-18 15:22:31 +08:00
parent d1b6cbf1ee
commit 3118a7626c
4 changed files with 9 additions and 5 deletions

View File

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

View File

@ -68,6 +68,7 @@ public interface AccessTokenMapper {
@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 = "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 = "createTime", column = "create_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE),
@Result(property = "updateTime", column = "update_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE)

View File

@ -96,8 +96,9 @@ public class AccessTokenMapperProvider {
SELECT("count(0)");
FROM(TABLE_NAME + " t,t_escheduler_user u");
Object searchVal = parameter.get("searchVal");
WHERE("u.id = t.user_id");
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();
}

View File

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