mirror of
https://gitee.com/best_handsome/mybatis-plus-join
synced 2025-07-11 00:02:22 +08:00
style: 简化代码
This commit is contained in:
parent
42bb8eef3b
commit
6224140cc1
@ -1,7 +1,5 @@
|
|||||||
package com.github.yulichang.wrapper.interfaces;
|
package com.github.yulichang.wrapper.interfaces;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
|
||||||
import com.github.yulichang.interfaces.MPJBaseJoin;
|
import com.github.yulichang.interfaces.MPJBaseJoin;
|
||||||
import com.github.yulichang.toolkit.SqlHelper;
|
import com.github.yulichang.toolkit.SqlHelper;
|
||||||
|
|
||||||
@ -28,10 +26,7 @@ public interface UpdateChain<T> {
|
|||||||
* JoinWrappers.update(User.class)<br />
|
* JoinWrappers.update(User.class)<br />
|
||||||
*/
|
*/
|
||||||
default int update() {
|
default int update() {
|
||||||
return SqlHelper.exec(getEntityClass(), mapper -> {
|
return SqlHelper.exec(getEntityClass(), mapper -> mapper.updateJoin(null, (MPJBaseJoin<T>) this));
|
||||||
Assert.isTrue(mapper instanceof MPJBaseMapper, "mapper <%s> is not extends MPJBaseMapper", mapper.getClass().getSimpleName());
|
|
||||||
return ((MPJBaseMapper<T>) mapper).updateJoin(null, (MPJBaseJoin<T>) this);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,10 +37,7 @@ public interface UpdateChain<T> {
|
|||||||
* JoinWrappers.update(User.class)<br />
|
* JoinWrappers.update(User.class)<br />
|
||||||
*/
|
*/
|
||||||
default int update(T entity) {
|
default int update(T entity) {
|
||||||
return SqlHelper.exec(getEntityClass(), mapper -> {
|
return SqlHelper.exec(getEntityClass(), mapper -> mapper.updateJoin(entity, (MPJBaseJoin<T>) this));
|
||||||
Assert.isTrue(mapper instanceof MPJBaseMapper, "mapper <%s> is not extends MPJBaseMapper", mapper.getClass().getSimpleName());
|
|
||||||
return ((MPJBaseMapper<T>) mapper).updateJoin(entity, (MPJBaseJoin<T>) this);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,10 +48,7 @@ public interface UpdateChain<T> {
|
|||||||
* JoinWrappers.update(User.class)<br />
|
* JoinWrappers.update(User.class)<br />
|
||||||
*/
|
*/
|
||||||
default int updateAndNull() {
|
default int updateAndNull() {
|
||||||
return SqlHelper.exec(getEntityClass(), mapper -> {
|
return SqlHelper.exec(getEntityClass(), mapper -> mapper.updateJoinAndNull(null, (MPJBaseJoin<T>) this));
|
||||||
Assert.isTrue(mapper instanceof MPJBaseMapper, "mapper <%s> is not extends MPJBaseMapper", mapper.getClass().getSimpleName());
|
|
||||||
return ((MPJBaseMapper<T>) mapper).updateJoinAndNull(null, (MPJBaseJoin<T>) this);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,9 +59,6 @@ public interface UpdateChain<T> {
|
|||||||
* JoinWrappers.update(User.class)<br />
|
* JoinWrappers.update(User.class)<br />
|
||||||
*/
|
*/
|
||||||
default int updateAndNull(T entity) {
|
default int updateAndNull(T entity) {
|
||||||
return SqlHelper.exec(getEntityClass(), mapper -> {
|
return SqlHelper.exec(getEntityClass(), mapper -> mapper.updateJoinAndNull(entity, (MPJBaseJoin<T>) this));
|
||||||
Assert.isTrue(mapper instanceof MPJBaseMapper, "mapper <%s> is not extends MPJBaseMapper", mapper.getClass().getSimpleName());
|
|
||||||
return ((MPJBaseMapper<T>) mapper).updateJoinAndNull(entity, (MPJBaseJoin<T>) this);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user