M - 继承自BaseMapper的Mapper接口T - 当前service对应的实体public abstract class BaseService<M extends BaseMapper<T>,T extends BaseEntity> extends Object
| 构造器和说明 |
|---|
BaseService() |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
batchInsert(List<T> list)
批量插入
|
boolean |
checkNotRepeat(Integer id,
String value,
String column)
查询列字段是否没有重复:
|
int |
delete(int id)
根据id删除记录
|
int |
delete(int[] ids)
批量删除
|
T |
findById(int id)
根据主键id查询对象
|
List<T> |
findByIds(int[] ids)
批量获取
|
protected abstract boolean |
hasAttachment()
当前实体是否包含附件
|
int |
insert(T entity)
插入对象
|
List<T> |
list(Lookup lookup)
查询列表
|
PageInfo<T> |
page(Lookup lookup)
查询分页列表
|
int |
save(T entity)
保存:根据id判断新增或更新实体
|
void |
setMapper(M mapper) |
void |
startPage(int pageNum,
int pageSize) |
int |
update(T entity)
更新数据
|
@Autowired(required=false) protected M extends BaseMapper<T> mapper
protected abstract boolean hasAttachment()
public void startPage(int pageNum,
int pageSize)
public void setMapper(M mapper)
public T findById(int id)
public int insert(T entity)
@Transactional(rollbackFor=java.lang.Exception.class) public int batchInsert(List<T> list)
list - listpublic int update(T entity)
public int save(T entity)
public int delete(int id)
public int delete(int[] ids)
Copyright © 2022. All rights reserved.