优化代码

增加主键
nacos
DongZeLiang 2023-10-09 20:57:53 +08:00
parent d36d5672a6
commit 7fb34049a3
3 changed files with 8 additions and 9 deletions

View File

@ -65,7 +65,7 @@ public class RedisCache {
* @return true=false=
*/
public boolean expire (final String key, final long timeout, final TimeUnit unit) {
return redisTemplate.expire(key, timeout, unit);
return Boolean.TRUE.equals(redisTemplate.expire(key, timeout, unit));
}
/**
@ -156,9 +156,8 @@ public class RedisCache {
*/
public <T> BoundSetOperations<String, T> setCacheSet (final String key, final Set<T> dataSet) {
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
Iterator<T> it = dataSet.iterator();
while (it.hasNext()) {
setOperation.add(it.next());
for (T t : dataSet) {
setOperation.add(t);
}
return setOperation;
}

View File

@ -3,6 +3,7 @@ package ${packageName}.domain;
#foreach ($import in $importList)
import ${import};
#end
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -56,16 +57,15 @@ public class ${ClassName} extends ${Entity} {
#else
@Excel(name = "${comment}")
#end
#end
#if($column.javaField == $pkColumn.javaField)
@TableId(value = "${pkColumn.javaField}",type = IdType.AUTO)
#end
private $column.javaType $column.javaField;
#end
#end
#if($table.sub)
/** $table.subTable.functionName信息 */
private List<${subClassName}> ${subclassName}List;
#end
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -31,7 +31,7 @@ public class BookInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(type = IdType.AUTO)
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/** 名称 */