This commit is contained in:
udf_admin@163.com
2020-04-26 21:03:11 +08:00
parent 6d1ac44104
commit 216e78e7d0
7 changed files with 36 additions and 39 deletions
@@ -3,7 +3,7 @@
<mapper namespace="org.itkk.udf.api.common.repository.ITraceInfoRepository">
<delete id="clearTraceInfo">
DELETE
FROM TF_TRACE_INFO A
WHERE A.CREATE_DATE <![CDATA[ <= ]]> (SYSDATE - #{traceLogKeepDays})
FROM TM_COMMON_TRACE_INFO A
WHERE A.CREATE_DATE <![CDATA[ <= ]]> date_sub(now(), INTERVAL #{traceLogKeepDays} day)
</delete>
</mapper>
</mapper>
@@ -19,13 +19,13 @@ public class DbCacheEntity {
/**
* 键(主键)
*/
@TableId("KEY")
private String key;
@TableId("K")
private String k;
/**
* 值
*/
@TableField("VALUE")
private String value;
@TableField("V")
private String v;
/**
* 过期时长(毫秒)
*/
@@ -72,7 +72,7 @@ public class DbCacheService {
//判空
if (entity != null) {
entity = new DbCacheEntity();
entity.setKey(key);
entity.setK(key);
entity.setCreateTime(System.currentTimeMillis());
entity.setExpire(expire);
entity.setExpireTime(entity.getCreateTime() + entity.getExpire());
@@ -122,8 +122,8 @@ public class DbCacheService {
if (entity == null) {
//新增缓存
entity = new DbCacheEntity();
entity.setKey(key);
entity.setValue(value);
entity.setK(key);
entity.setV(value);
entity.setCreateTime(System.currentTimeMillis());
entity.setExpire(expire);
entity.setExpireTime(entity.getCreateTime() + entity.getExpire());
@@ -175,8 +175,8 @@ public class DbCacheService {
if (entity == null) {
//新增缓存
entity = new DbCacheEntity();
entity.setKey(key);
entity.setValue(value);
entity.setK(key);
entity.setV(value);
entity.setCreateTime(System.currentTimeMillis());
entity.setExpire(expire);
entity.setExpireTime(entity.getCreateTime() + entity.getExpire());
@@ -185,7 +185,7 @@ public class DbCacheService {
iDbCacheRepository.insert(entity);
} else {
//更新缓存
entity.setValue(value);
entity.setV(value);
entity.setCreateTime(System.currentTimeMillis());
entity.setExpire(expire);
entity.setExpireTime(entity.getCreateTime() + entity.getExpire());
@@ -215,7 +215,7 @@ public class DbCacheService {
//构造key
keyPrefix = getKey(keyPrefix) + "%";
//删除
iDbCacheRepository.delete(new QueryWrapper<DbCacheEntity>().lambda().like(DbCacheEntity::getKey, keyPrefix));
iDbCacheRepository.delete(new QueryWrapper<DbCacheEntity>().lambda().like(DbCacheEntity::getK, keyPrefix));
}
/**
@@ -230,7 +230,7 @@ public class DbCacheService {
//构造key
keyPrefix = getKey(keyPrefix) + "%";
//获得key清单
List<DbCacheEntity> dbCacheEntityList = iDbCacheRepository.selectList(new QueryWrapper<DbCacheEntity>().lambda().select(DbCacheEntity::getKey).like(DbCacheEntity::getKey, keyPrefix));
List<DbCacheEntity> dbCacheEntityList = iDbCacheRepository.selectList(new QueryWrapper<DbCacheEntity>().lambda().select(DbCacheEntity::getK).like(DbCacheEntity::getK, keyPrefix));
//判空
if (CollectionUtils.isNotEmpty(dbCacheEntityList)) {
//初始化
@@ -238,11 +238,11 @@ public class DbCacheService {
//遍历
for (DbCacheEntity dbCacheEntity : dbCacheEntityList) {
//获得缓存实体
DbCacheEntity entity = getEntity(dbCacheEntity.getKey());
DbCacheEntity entity = getEntity(dbCacheEntity.getK());
//判空
if (entity != null) {
//放入结果集
rv.add(new DbCacheDto().setValue(entity.getValue()).setExpireTime(entity.getExpireTime()));
rv.add(new DbCacheDto().setValue(entity.getV()).setExpireTime(entity.getExpireTime()));
}
}
}
@@ -262,7 +262,7 @@ public class DbCacheService {
//获得缓存实体
DbCacheEntity entity = getEntity(key);
//返回
return entity == null ? null : new DbCacheDto().setValue(entity.getValue()).setExpireTime(entity.getExpireTime());
return entity == null ? null : new DbCacheDto().setValue(entity.getV()).setExpireTime(entity.getExpireTime());
}
/**
@@ -277,7 +277,7 @@ public class DbCacheService {
//构造key
keyPrefix = getKey(keyPrefix) + "%";
//获得key清单
List<DbCacheEntity> dbCacheEntityList = iDbCacheRepository.selectList(new QueryWrapper<DbCacheEntity>().lambda().select(DbCacheEntity::getKey).like(DbCacheEntity::getKey, keyPrefix));
List<DbCacheEntity> dbCacheEntityList = iDbCacheRepository.selectList(new QueryWrapper<DbCacheEntity>().lambda().select(DbCacheEntity::getK).like(DbCacheEntity::getK, keyPrefix));
//判空
if (CollectionUtils.isNotEmpty(dbCacheEntityList)) {
//初始化
@@ -285,11 +285,11 @@ public class DbCacheService {
//遍历
for (DbCacheEntity dbCacheEntity : dbCacheEntityList) {
//获得缓存实体
DbCacheEntity entity = getEntity(dbCacheEntity.getKey());
DbCacheEntity entity = getEntity(dbCacheEntity.getK());
//判空
if (entity != null) {
//放入结果集
rv.add(entity.getValue());
rv.add(entity.getV());
}
}
}
@@ -309,7 +309,7 @@ public class DbCacheService {
//获得缓存实体
DbCacheEntity entity = getEntity(key);
//返回
return entity == null ? null : entity.getValue();
return entity == null ? null : entity.getV();
}
/**
@@ -4,6 +4,6 @@
<delete id="clearExpireCahce">
DELETE
FROM TF_DB_CACHE A
WHERE A.EXPIRE_TIME <![CDATA[ < ]]> (TO_NUMBER(SYSDATE - TO_DATE('1970-01-01 8:0:0', 'YYYY-MM-DD HH24:MI:SS')) * 24 * 60 * 60 * 1000)
WHERE A.EXPIRE_TIME <![CDATA[ < ]]> REPLACE(unix_timestamp(NOW(3)),'.','')
</delete>
</mapper>
</mapper>
@@ -97,8 +97,8 @@ public class DbFileInfoEntity {
/**
* 创建时间(这里单词写错,多多包涵)
*/
@TableField("CRETE_DATE")
private Date creteDate;
@TableField("CREATE_DATE")
private Date createDate;
/**
* 更新人
@@ -180,7 +180,7 @@ public class DbFileService {
.setBusinessPath(businessPath)
.setPreviewPdfFileId(previewPdfFileId)
.setCreateBy(userId)
.setCreteDate(new Date())
.setCreateDate(new Date())
.setUpdateBy(userId)
.setUpdateDate(new Date());
iDbFileInfoRepository.insert(dbFileInfoEntity);
@@ -9,16 +9,13 @@
AND A.STATUS = 2
</delete>
<select id="loadPendingConsumptionList" resultType="java.lang.String">
SELECT *
FROM (
SELECT ID
FROM TF_DB_QUEUE A
WHERE A.APPLICATION_NAME = #{applicationName}
AND A.PROFILES_ACTIVE = #{profilesActive}
AND A.QUEUE_NAME = #{queueName}
AND A.STATUS = 1
ORDER BY A.SEND_DATE ASC
)
WHERE ROWNUM <![CDATA[ <= ]]> #{limit}
SELECT ID
FROM TF_DB_QUEUE A
WHERE A.APPLICATION_NAME = #{applicationName}
AND A.PROFILES_ACTIVE = #{profilesActive}
AND A.QUEUE_NAME = #{queueName}
AND A.STATUS = 1
ORDER BY A.SEND_DATE,A.ID ASC
LIMIT #{limit}
</select>
</mapper>
</mapper>