新增taskConfigDao

segment2.0
linrf 2 years ago
parent 3a87cee045
commit 0125221e91

@ -105,4 +105,10 @@ public class TaskConfig {
return this.startTime;
}
public String getLastErrorMsg() {
if (null != lastErrorMsg && lastErrorMsg.length() > 1000) {
return lastErrorMsg.substring(0, 1000);
}
return lastErrorMsg;
}
}

@ -0,0 +1,7 @@
package com.docus.server.collect.web.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.server.collect.web.common.entity.TaskConfig;
public interface ITaskConfigDao extends IBaseDao<TaskConfig> {
}

@ -0,0 +1,14 @@
package com.docus.server.collect.web.dao.impl;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.server.collect.web.common.entity.TaskConfig;
import com.docus.server.collect.web.dao.ITaskConfigDao;
import com.docus.server.collect.web.mapper.TaskConfigMapper;
import org.springframework.stereotype.Repository;
@Repository
public class TaskConfigDaoImpl extends BaseDaoImpl<TaskConfigMapper, TaskConfig> implements ITaskConfigDao {
}

@ -15,7 +15,6 @@ import com.docus.server.sys.service.IPowerThirdLoginService;
import com.docus.server.sys.service.IPowerUserService;
import com.xxl.job.core.context.XxlJobHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@ -117,21 +116,19 @@ public abstract class AbstractCollectJob<T> implements IJob<T> {
}
}
@Transactional
public void updateTaskState(TaskConfig taskConfig) {
taskConfig.setState(StateEnum.OK);
taskConfigService.updateById(taskConfig);
taskConfigService.updateTaskConfig(taskConfig);
}
@Transactional
public void updateTaskState(String message, TaskConfig taskConfig) {
taskConfig.setState(StateEnum.FAIL);
taskConfig.setLastErrorMsg(message.length() > 1000 ? message.substring(0, 1000) : message);
taskConfigService.updateById(taskConfig);
taskConfig.setLastErrorMsg(message);
taskConfigService.updateTaskConfig(taskConfig);
}
private TaskConfig getTaskConfig(String taskConfigId) {
return taskConfigService.getById(taskConfigId);
return taskConfigService.getTaskConfigById(taskConfigId);
}
protected String getJobParam() {

@ -1,14 +1,17 @@
package com.docus.server.collect.web.service;
import com.docus.infrastructure.core.db.service.IBaseService;
import com.docus.server.collect.web.common.entity.TaskConfig;
import java.util.Date;
public interface ITaskConfigService extends IBaseService<TaskConfig> {
public interface ITaskConfigService {
void updateAllPointerDate(String id, Date date);
void updateIncPointerDate(String id, Date date);
TaskConfig getTaskConfigById(String taskConfigId);
void updateTaskConfig(TaskConfig taskConfig);
}

@ -1,30 +1,46 @@
package com.docus.server.collect.web.service.impl;
import com.docus.infrastructure.core.db.service.impl.BaseServiceImpl;
import com.docus.server.collect.web.common.entity.TaskConfig;
import com.docus.server.collect.web.mapper.TaskConfigMapper;
import com.docus.server.collect.web.dao.ITaskConfigDao;
import com.docus.server.collect.web.service.ITaskConfigService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
@Service
public class TaskConfigServiceImpl extends BaseServiceImpl<TaskConfigMapper, TaskConfig> implements ITaskConfigService {
@Transactional
public class TaskConfigServiceImpl implements ITaskConfigService {
@Resource
private ITaskConfigDao taskConfigDao;
@Transactional(rollbackFor = Exception.class)
@Override
public void updateAllPointerDate(String id, Date date) {
TaskConfig taskConfig = super.getById(id);
TaskConfig taskConfig = getTaskConfigById(id);
taskConfig.setAllPointerTime(date);
super.updateById(taskConfig);
updateTaskConfig(taskConfig);
updateTaskConfig(taskConfig);
}
@Transactional
@Transactional(rollbackFor = Exception.class)
@Override
public void updateIncPointerDate(String id, Date date) {
TaskConfig taskConfig = super.getById(id);
TaskConfig taskConfig = getTaskConfigById(id);
taskConfig.setIncPointerTime(date);
super.updateById(taskConfig);
updateTaskConfig(taskConfig);
}
@Override
public TaskConfig getTaskConfigById(String taskConfigId) {
return taskConfigDao.findById(taskConfigId);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void updateTaskConfig(TaskConfig taskConfig) {
taskConfigDao.saveOrUpdate(taskConfig);
}
}

@ -1,6 +1,6 @@
package com.docus.server.sys.infrastructure.dao.impl;
import com.docus.server.common.BaseDaoImpl;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.server.sys.common.pojo.dto.UserModifyParam;
import com.docus.server.sys.common.pojo.entity.PowerUser;
import com.docus.server.sys.infrastructure.dao.IPowerUserDao;

@ -1,8 +1,5 @@
package com.docus.server.sys.service;
import com.docus.infrastructure.core.db.service.IBaseService;
import com.docus.server.sys.common.pojo.entity.PowerThirdLogin;
/**
* <p>
*
@ -11,6 +8,6 @@ import com.docus.server.sys.common.pojo.entity.PowerThirdLogin;
* @author jiashi
* @since 2021-04-26
*/
public interface IPowerThirdLoginService extends IBaseService<PowerThirdLogin> {
public interface IPowerThirdLoginService {
}

@ -1,8 +1,5 @@
package com.docus.server.sys.service.impl;
import com.docus.infrastructure.core.db.service.impl.BaseServiceImpl;
import com.docus.server.sys.common.pojo.entity.PowerThirdLogin;
import com.docus.server.sys.infrastructure.mapper.PowerThirdLoginMapper;
import com.docus.server.sys.service.IPowerThirdLoginService;
import org.springframework.stereotype.Service;
@ -15,7 +12,7 @@ import org.springframework.stereotype.Service;
* @since 2021-04-26
*/
@Service
public class PowerThirdLoginServiceImpl extends BaseServiceImpl<PowerThirdLoginMapper, PowerThirdLogin> implements IPowerThirdLoginService {
public class PowerThirdLoginServiceImpl implements IPowerThirdLoginService {
}

@ -1,112 +0,0 @@
package com.docus.server.common;
import com.docus.infrastructure.core.db.Sort;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
public abstract class AbstractBaseService<T> implements IService<T> {
protected abstract IDao<T> getDao();
@Override
public T findById(Serializable id) {
return getDao().findById(id);
}
@Override
public List<T> findByIds(Collection<Serializable> ids) {
return getDao().findByIds(ids);
}
@Override
public List<T> findBy(String propertyName, Object propertyValue) {
return getDao().findBy(propertyName, propertyValue);
}
@Override
public List<T> findByList(String propertyName, Collection<?> propertyValue) {
return getDao().findByList(propertyName, propertyValue);
}
@Override
public List<T> findActiveBy(String propertyName, Object propertyValue) {
return getDao().findActiveBy(propertyName, propertyValue);
}
@Override
public List<T> findBy(String propertyName, Object propertyValue, Sort sort) {
return getDao().findBy(propertyName, propertyValue, sort);
}
@Override
public List<T> findActiveBy(String propertyName, Object propertyValue, Sort sort) {
return getDao().findActiveBy(propertyName, propertyValue, sort);
}
@Override
public T findOneBy(String propertyName, Object propertyValue) {
return getDao().findOneBy(propertyName, propertyValue);
}
@Override
public T findOneByList(String propertyName, Collection<?> propertyValue) {
return getDao().findOneByList(propertyName, propertyValue);
}
@Override
public T findActiveOneBy(String propertyName, Object propertyValue) {
return getDao().findActiveOneBy(propertyName, propertyValue);
}
@Override
public List<T> findAll() {
return getDao().findAll();
}
@Override
public List<T> findAllActive() {
return getDao().findAllActive();
}
@Override
public List<T> findAll(Sort sort) {
return getDao().findAll(sort);
}
@Override
public List<T> findAllActive(Sort sort) {
return getDao().findAllActive(sort);
}
@Override
public int deleteByIdList(List<Serializable> idList) {
return getDao().deleteByIdList(idList);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveBatch(Collection<T> entityList, int batchSize) {
return getDao().saveBatch(entityList, batchSize);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveOrUpdate(T entity) {
return getDao().saveOrUpdate(entity);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean updateBatchById(Collection<T> entityList, int batchSize) {
return getDao().updateBatchById(entityList, batchSize);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveOrUpdateBatch(Collection<T> entityList, int batchSize) {
return getDao().saveOrUpdateBatch(entityList, batchSize);
}
}

@ -1,445 +0,0 @@
package com.docus.server.common;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.enums.SqlMethod;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.GlobalConfigUtils;
import com.baomidou.mybatisplus.core.toolkit.ReflectionKit;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.docus.infrastructure.core.db.Sort;
import com.github.pagehelper.PageHelper;
import org.apache.ibatis.binding.MapperMethod;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory;
import org.apache.ibatis.session.SqlSession;
import org.mybatis.spring.SqlSessionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
public class BaseDaoImpl<M extends BaseMapper<T>, T> implements IDao<T> {
protected Log log = LogFactory.getLog(getClass());
@Autowired
protected M baseMapper;
public M getBaseMapper() {
return baseMapper;
}
protected Class<T> entityClass = currentModelClass();
public Class<T> getEntityClass() {
return entityClass;
}
protected Class<T> mapperClass = currentMapperClass();
@Override
public T findById(Serializable id) {
if (id == null) {
throw new RuntimeException("param id is required");
}
return baseMapper.selectById(id);
}
@Override
public List<T> findByIds(Collection<Serializable> ids) {
if (ids == null || ids.size() == 0) {
return new ArrayList<>();
}
return baseMapper.selectBatchIds(ids);
}
/**
* , eq
*/
@Override
public List<T> findBy(String propertyName, Object propertyValue) {
String columnName = getColumnName(propertyName);
return baseMapper.selectList(new QueryWrapper<T>().eq(columnName, propertyValue));
}
/**
* , in
*/
@Override
public List<T> findByList(String propertyName, Collection<?> propertyValue) {
String columnName = getColumnName(propertyName);
return baseMapper.selectList(new QueryWrapper<T>().in(!Objects.isNull(propertyValue), columnName, propertyValue));
}
@Override
public List<T> findActiveBy(String propertyName, Object propertyValue) {
String columnName = getColumnName(propertyName);
QueryWrapper<T> queryWrapper = new QueryWrapper<T>().eq(columnName, propertyValue);
queryWrapper.ne("state", 1);
return baseMapper.selectList(queryWrapper);
}
//返回所有匹配的记录并排序
@Override
public List<T> findBy(String propertyName, Object propertyValue, Sort sort) {
String columnName = getColumnName(propertyName);
QueryWrapper<T> query = new QueryWrapper<T>().eq(columnName, propertyValue);
buildSort(sort, query);
return baseMapper.selectList(query);
}
/**
* Active
*/
@Override
public List<T> findActiveBy(String propertyName, Object propertyValue, Sort sort) {
String columnName = getColumnName(propertyName);
QueryWrapper<T> query = new QueryWrapper<T>().eq(columnName, propertyValue);
query.ne("state", 1);
buildSort(sort, query);
return baseMapper.selectList(query);
}
@Override
public T findOneBy(String propertyName, Object propertyValue) {
String columnName = getColumnName(propertyName);
PageHelper.startPage(1, 1);
List<T> list = baseMapper.selectList(new QueryWrapper<T>().eq(columnName, propertyValue));
return (list == null || list.size() == 0) ? null : list.get(0);
}
@Override
public T findOneByList(String propertyName, Collection<?> propertyValue) {
String columnName = getColumnName(propertyName);
List<T> list = baseMapper.selectList(new QueryWrapper<T>().eq(!Objects.isNull(propertyValue), columnName, propertyValue));
return (list == null || list.size() == 0) ? null : list.get(0);
}
//按字段查询返回第一条Active 记录
@Override
public T findActiveOneBy(String propertyName, Object propertyValue) {
String columnName = getColumnName(propertyName);
PageHelper.startPage(1, 1);
QueryWrapper<T> queryWrapper = new QueryWrapper<T>().eq(columnName, propertyValue);
queryWrapper.ne("state", 1);
List<T> list = baseMapper.selectList(queryWrapper);
return (list == null || list.size() == 0) ? null : list.get(0);
}
/*Lambda方式自由组合查询条件*/
public List<T> find(LambdaQueryWrapper<T> queryWrapper) {
return baseMapper.selectList(queryWrapper);
}
/*Lambda方式自由组合查询条件返回第一条记录*/
public T findOne(LambdaQueryWrapper<T> queryWrapper) {
PageHelper.startPage(1, 1);
List<T> list = baseMapper.selectList(queryWrapper);
return (list == null || list.size() == 0) ? null : list.get(0);
}
//返回表所有记录
@Override
public List<T> findAll() {
return baseMapper.selectList(null);
}
//返回表所有Active的记录
@Override
public List<T> findAllActive() {
return baseMapper.selectList(Wrappers.<T>query().ne("state", 1));
}
//返回表所有记录并排序
@Override
public List<T> findAll(Sort sort) {
QueryWrapper<T> query = new QueryWrapper<T>();
buildSort(sort, query);
return baseMapper.selectList(query);
}
//返回表所有Active记录并排序
@Override
public List<T> findAllActive(Sort sort) {
QueryWrapper<T> query = new QueryWrapper<T>();
query.ne("state", 1);
buildSort(sort, query);
return baseMapper.selectList(query);
}
//组装排序语句
private void buildSort(Sort sort, QueryWrapper<T> query) {
if (sort != null) {
List<Sort.SortItem> sortList = sort.getSortList();
for (Sort.SortItem sortItem : sortList) {
if (sortItem.getDirection() == Sort.Direction.ASC) {
query.orderByAsc(getColumnName(sortItem.getProperty()));
} else {
query.orderByDesc(getColumnName(sortItem.getProperty()));
}
}
}
}
@Override
public int deleteByIdList(List<Serializable> idList) {
if (idList == null || idList.size() == 0) {
return 0;
}
return baseMapper.deleteBatchIds(idList);
}
/**
*
*
* @param result
* @return boolean
* @deprecated 3.3.1
*/
@Deprecated
protected boolean retBool(Integer result) {
return SqlHelper.retBool(result);
}
@SuppressWarnings("unchecked")
protected Class<T> currentMapperClass() {
return (Class<T>) ReflectionKit.getSuperClassGenericType(getClass(), 0);
}
@SuppressWarnings("unchecked")
protected Class<T> currentModelClass() {
return (Class<T>) ReflectionKit.getSuperClassGenericType(getClass(), 1);
}
/**
* SqlSession
*
* @deprecated 3.3.0
*/
@Deprecated
protected SqlSession sqlSessionBatch() {
return SqlHelper.sqlSessionBatch(entityClass);
}
/**
* sqlSession
*
* @param sqlSession session
* @deprecated 3.3.0
*/
@Deprecated
protected void closeSqlSession(SqlSession sqlSession) {
SqlSessionUtils.closeSqlSession(sqlSession, GlobalConfigUtils.currentSessionFactory(entityClass));
}
/**
* SqlStatement
*
* @param sqlMethod ignore
* @return ignore
* @see #getSqlStatement(SqlMethod)
* @deprecated 3.4.0
*/
@Deprecated
protected String sqlStatement(SqlMethod sqlMethod) {
return SqlHelper.table(entityClass).getSqlStatement(sqlMethod.getMethod());
}
/**
*
*
* @param entityList ignore
* @param batchSize ignore
* @return ignore
*/
@Override
public boolean saveBatch(Collection<T> entityList, int batchSize) {
String sqlStatement = getSqlStatement(SqlMethod.INSERT_ONE);
return executeBatch(entityList, batchSize, (sqlSession, entity) -> sqlSession.insert(sqlStatement, entity));
}
/**
* mapperStatementId
*
* @param sqlMethod
* @return id
* @since 3.4.0
*/
protected String getSqlStatement(SqlMethod sqlMethod) {
return SqlHelper.getSqlStatement(mapperClass, sqlMethod);
}
/**
* TableId
*
* @param entity
* @return boolean
*/
@Override
public boolean saveOrUpdate(T entity) {
if (null != entity) {
TableInfo tableInfo = TableInfoHelper.getTableInfo(this.entityClass);
Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!");
String keyProperty = tableInfo.getKeyProperty();
Assert.notEmpty(keyProperty, "error: can not execute. because can not find column for id from entity!");
Object idVal = ReflectionKit.getFieldValue(entity, tableInfo.getKeyProperty());
return StringUtils.checkValNull(idVal) || Objects.isNull(getById((Serializable) idVal)) ? save(entity) : updateById(entity);
}
return false;
}
/**
* ID
*
* @param id ID
*/
public T getById(Serializable id) {
return getBaseMapper().selectById(id);
}
/**
* ID
*
* @param entity
*/
public boolean updateById(T entity) {
return SqlHelper.retBool(getBaseMapper().updateById(entity));
}
/**
*
*
* @param entity
*/
public boolean save(T entity) {
return SqlHelper.retBool(getBaseMapper().insert(entity));
}
@Override
public boolean saveOrUpdateBatch(Collection<T> entityList, int batchSize) {
TableInfo tableInfo = TableInfoHelper.getTableInfo(entityClass);
Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!");
String keyProperty = tableInfo.getKeyProperty();
Assert.notEmpty(keyProperty, "error: can not execute. because can not find column for id from entity!");
return SqlHelper.saveOrUpdateBatch(this.entityClass, this.mapperClass, this.log, entityList, batchSize, (sqlSession, entity) -> {
Object idVal = ReflectionKit.getFieldValue(entity, keyProperty);
return StringUtils.checkValNull(idVal)
|| CollectionUtils.isEmpty(sqlSession.selectList(getSqlStatement(SqlMethod.SELECT_BY_ID), entity));
}, (sqlSession, entity) -> {
MapperMethod.ParamMap<T> param = new MapperMethod.ParamMap<>();
param.put(Constants.ENTITY, entity);
sqlSession.update(getSqlStatement(SqlMethod.UPDATE_BY_ID), param);
});
}
@Override
public boolean updateBatchById(Collection<T> entityList, int batchSize) {
String sqlStatement = getSqlStatement(SqlMethod.UPDATE_BY_ID);
return executeBatch(entityList, batchSize, (sqlSession, entity) -> {
MapperMethod.ParamMap<T> param = new MapperMethod.ParamMap<>();
param.put(Constants.ENTITY, entity);
sqlSession.update(sqlStatement, param);
});
}
public T getOne(Wrapper<T> queryWrapper, boolean throwEx) {
if (throwEx) {
return baseMapper.selectOne(queryWrapper);
}
return SqlHelper.getObject(log, baseMapper.selectList(queryWrapper));
}
public Map<String, Object> getMap(Wrapper<T> queryWrapper) {
return SqlHelper.getObject(log, baseMapper.selectMaps(queryWrapper));
}
public <V> V getObj(Wrapper<T> queryWrapper, Function<? super Object, V> mapper) {
return SqlHelper.getObject(log, listObjs(queryWrapper, mapper));
}
private <V> List<V> listObjs(Wrapper<T> queryWrapper, Function<? super Object, V> mapper) {
return getBaseMapper().selectObjs(queryWrapper).stream().filter(Objects::nonNull).map(mapper).collect(Collectors.toList());
}
/**
*
*
* @param consumer consumer
* @since 3.3.0
* @deprecated 3.3.1 {@link #executeBatch(Collection, int, BiConsumer)} }.
*/
@Deprecated
protected boolean executeBatch(Consumer<SqlSession> consumer) {
return SqlHelper.executeBatch(this.entityClass, this.log, consumer);
}
/**
*
*
* @param list
* @param batchSize
* @param consumer
* @param <E>
* @return
* @since 3.3.1
*/
protected <E> boolean executeBatch(Collection<E> list, int batchSize, BiConsumer<SqlSession, E> consumer) {
return SqlHelper.executeBatch(this.entityClass, this.log, list, batchSize, consumer);
}
/**
* {@link IService#DEFAULT_BATCH_SIZE}
*
* @param list
* @param consumer
* @param <E>
* @return
* @since 3.3.1
*/
protected <E> boolean executeBatch(Collection<E> list, BiConsumer<SqlSession, E> consumer) {
return executeBatch(list, DEFAULT_BATCH_SIZE, consumer);
}
//通过实体属性获取对应的数据库字段名
public String getColumnName(String propertyName) {
Map<String, Field> fieldMap = ReflectionKit.getFieldMap(getEntityClass());
if (fieldMap != null) {
Field field = fieldMap.get(propertyName);
if (field != null) {
TableField annotation = field.getAnnotation(TableField.class);
if (annotation != null) {
return annotation.value();
}
TableId idAnnotation = field.getAnnotation(TableId.class);
if (idAnnotation != null) {
return idAnnotation.value();
}
}
}
throw new RuntimeException("获取不到属性" + propertyName + "的列名");
}
}

@ -1,19 +0,0 @@
package com.docus.server.common;
public class BaseService<T> extends AbstractBaseService<T> {
protected IDao<T> baseDao;
@Override
protected IDao<T> getDao() {
return this.getBaseDao();
}
public IDao<T> getBaseDao() {
return baseDao;
}
public void setBaseDao(IDao<T> baseDao) {
this.baseDao = baseDao;
}
}

@ -1,51 +0,0 @@
package com.docus.server.common;
import com.docus.infrastructure.core.db.Sort;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
public interface IDao<T> {
/*默认批次提交数量*/
int DEFAULT_BATCH_SIZE = 1000;
T findById(Serializable id);
List<T> findByIds(Collection<Serializable> ids);
List<T> findBy(String propertyName, Object propertyValue);
List<T> findByList(String propertyName, Collection<?> propertyValue);
List<T> findActiveBy(String propertyName, Object propertyValue);
List<T> findBy(String propertyName, Object propertyValue, Sort sort);
List<T> findActiveBy(String propertyName, Object propertyValue, Sort sort);
T findOneBy(String propertyName, Object propertyValue);
T findOneByList(String propertyName, Collection<?> propertyValue);
T findActiveOneBy(String propertyName, Object propertyValue);
List<T> findAll();
List<T> findAllActive();
List<T> findAll(Sort sort);
List<T> findAllActive(Sort sort);
int deleteByIdList(List<Serializable> idList);
boolean saveBatch(Collection<T> entityList, int batchSize);
boolean saveOrUpdate(T entity);
boolean updateBatchById(Collection<T> entityList, int batchSize);
boolean saveOrUpdateBatch(Collection<T> entityList, int batchSize);
}

@ -1,48 +0,0 @@
package com.docus.server.common;
import com.docus.infrastructure.core.db.Sort;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
public interface IService<T> {
T findById(Serializable id);
List<T> findByIds(Collection<Serializable> ids);
List<T> findBy(String propertyName, Object propertyValue);
List<T> findByList(String propertyName, Collection<?> propertyValue);
List<T> findActiveBy(String propertyName, Object propertyValue);
List<T> findBy(String propertyName, Object propertyValue, Sort sort);
List<T> findActiveBy(String propertyName, Object propertyValue, Sort sort);
T findOneBy(String propertyName, Object propertyValue);
T findOneByList(String propertyName, Collection<?> propertyValue);
T findActiveOneBy(String propertyName, Object propertyValue);
List<T> findAll();
List<T> findAllActive();
List<T> findAll(Sort sort);
List<T> findAllActive(Sort sort);
int deleteByIdList(List<Serializable> idList);
boolean saveBatch(Collection<T> entityList, int batchSize);
boolean saveOrUpdate(T entity);
boolean updateBatchById(Collection<T> entityList, int batchSize);
boolean saveOrUpdateBatch(Collection<T> entityList, int batchSize);
}
Loading…
Cancel
Save