Browse Source

增加:LC_SINGLE模型

4.0
郑根木 2 years ago
parent
commit
27c588d0bf
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/dao/AbstractEntityDao.java

+ 5
- 1
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/dao/AbstractEntityDao.java View File

@@ -12,6 +12,7 @@ import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.DbException;
import cc.smtweb.framework.core.util.DateUtil;
import cc.smtweb.framework.core.util.NumberUtil;
import cc.smtweb.framework.core.util.SpringUtil;
import cc.smtweb.framework.core.util.VariableUtil;
import com.esotericsoftware.minlog.Log;
@@ -388,7 +389,10 @@ public abstract class AbstractEntityDao<T> {
public Long readId(T entity) {
EntityColumn idColumn = findIdColumn();

return (Long) idColumn.readValue(entity);
Object o = idColumn.readValue(entity);
if (o == null) return 0L;
if (o instanceof Number) return ((Number) o).longValue();
return NumberUtil.getLongIgnoreErr(o.toString());
}

public T createBean() {


Loading…
Cancel
Save