@@ -153,7 +153,9 @@ public abstract class Model<T extends Model> implements Serializable {
throw new MybatisPlusException("updateById primaryKey is null.");
}
// updateById
- return SqlHelper.retBool(sqlSession().update(sqlStatement(SqlMethod.UPDATE_BY_ID), this));
+ Map<String, Object> map = new HashMap<>();
+ map.put("et", this);
+ return SqlHelper.retBool(sqlSession().update(sqlStatement(SqlMethod.UPDATE_BY_ID), map));
/**
@@ -166,8 +168,10 @@ public abstract class Model<T extends Model> implements Serializable {
if (StringUtils.checkValNull(pkVal())) {
throw new MybatisPlusException("updateAllColumnById primaryKey is null.");
- // updateById
- return SqlHelper.retBool(sqlSession().update(sqlStatement(SqlMethod.UPDATE_ALL_COLUMN_BY_ID), this));
+ // updateAllColumnById
+ return SqlHelper.retBool(sqlSession().update(sqlStatement(SqlMethod.UPDATE_ALL_COLUMN_BY_ID), map));
@@ -44,7 +44,7 @@ public class TenancyInterceptor implements Interceptor {
@Override
public Object intercept(Invocation invocation) throws Throwable {
-
+ // TODO 待完成
return null;
@@ -303,7 +303,7 @@ public class EntityWrapperTest {
String sqlPart = Condition.create().gt("gt", 1).le("le", 2).lt("le", 3).ge("ge", 4).eq("eq", 5).allEq(map).originalSql();
System.out.println("sql ==> " + sqlPart);
Assert.assertEquals(
- "AND (gt > ? AND le <= ? AND le < ? AND ge >= ? AND eq = ? AND allEq3 = ? AND allEq1 = ? AND allEq2 = ?)",
+ "AND (gt > ? AND le <= ? AND le < ? AND ge >= ? AND eq = ? AND allEq1 = ? AND allEq2 = ? AND allEq3 = ?)",
sqlPart);
@@ -46,6 +46,10 @@ public class ActiveRecordTest extends CrudTest {
print(" ar save=" + rlt + ", id=" + t1.getId());
// 根据ID更新
+ t1.setType("t1001");
+ rlt = t1.updateAllColumnById();
+ print(" ar updateAllColumnById:" + rlt);
+
t1.setType("t1023");
rlt = t1.updateById();
print(" ar updateById:" + rlt);