forked from rongchao/epmet-cloud-rizhao
5 changed files with 64 additions and 2 deletions
@ -0,0 +1,23 @@ |
|||
package com.epmet.commons.mybatis.interceptor; |
|||
|
|||
import com.baomidou.mybatisplus.core.injector.AbstractMethod; |
|||
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector; |
|||
import com.baomidou.mybatisplus.extension.injector.methods.LogicDeleteByIdWithFill; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* desc:mybatisPlus拦截器 |
|||
* |
|||
* @author: LiuJanJun |
|||
* @date: 2022/3/16 6:33 下午 |
|||
* @version: 1.0 |
|||
*/ |
|||
public class MybatisPlusSqlInjector extends DefaultSqlInjector { |
|||
@Override |
|||
public List<AbstractMethod> getMethodList(Class<?> mapperClass) { |
|||
final List<AbstractMethod> methods = super.getMethodList(mapperClass); |
|||
methods.add(new LogicDeleteByIdWithFill()); |
|||
return methods; |
|||
} |
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.epmet.commons.mybatis.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* desc:自定义mapper方法 |
|||
* |
|||
* @author: LiuJanJun |
|||
* @date: 2022/3/16 6:42 下午 |
|||
* @version: 1.0 |
|||
*/ |
|||
public interface MyBaseMapper<Entity> extends BaseMapper<Entity> { |
|||
/** |
|||
* 根据Id逻辑删除 并 填充其他字段的值 id必填 |
|||
* |
|||
* @param entity 要删除的实体对象 |
|||
* @return 受影响记录数量 |
|||
*/ |
|||
int deleteByIdWithFill(Entity entity); |
|||
|
|||
} |
Loading…
Reference in new issue