|
@@ -7,15 +7,15 @@ import java.util.List;
|
|
public abstract class AbstractService<T extends Serializable> implements IServiceOperations<T> {
|
|
public abstract class AbstractService<T extends Serializable> implements IServiceOperations<T> {
|
|
|
|
|
|
protected abstract IOperations<T> getMapper();
|
|
protected abstract IOperations<T> getMapper();
|
|
-
|
|
|
|
|
|
+
|
|
protected String tableName = "";
|
|
protected String tableName = "";
|
|
|
|
|
|
public abstract void setTableName(String tableName);
|
|
public abstract void setTableName(String tableName);
|
|
-
|
|
|
|
|
|
+
|
|
protected String getTableName() {
|
|
protected String getTableName() {
|
|
return this.tableName;
|
|
return this.tableName;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void insert(T entity) {
|
|
public void insert(T entity) {
|
|
getMapper().insert(entity, this.getTableName());
|
|
getMapper().insert(entity, this.getTableName());
|
|
@@ -30,7 +30,7 @@ public abstract class AbstractService<T extends Serializable> implements IServic
|
|
public int update(List<T> list) {
|
|
public int update(List<T> list) {
|
|
return getMapper().update(list, this.getTableName());
|
|
return getMapper().update(list, this.getTableName());
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public int updateByBatch(LinkedHashMap<String, String> condition, String field) {
|
|
public int updateByBatch(LinkedHashMap<String, String> condition, String field) {
|
|
return getMapper().updateByBatch(condition, field, this.getTableName());
|
|
return getMapper().updateByBatch(condition, field, this.getTableName());
|
|
@@ -63,12 +63,12 @@ public abstract class AbstractService<T extends Serializable> implements IServic
|
|
int limit = pageSize;
|
|
int limit = pageSize;
|
|
return getMapper().getList(condition, offset, limit, order, field, this.getTableName());
|
|
return getMapper().getList(condition, offset, limit, order, field, this.getTableName());
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<T> getAllList(LinkedHashMap<String, String> condition) {
|
|
public List<T> getAllList(LinkedHashMap<String, String> condition) {
|
|
return this.getAllList(condition, null);
|
|
return this.getAllList(condition, null);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<T> getAllList(LinkedHashMap<String, String> condition, String order) {
|
|
public List<T> getAllList(LinkedHashMap<String, String> condition, String order) {
|
|
if(order == null || order.trim().length() == 0) {
|
|
if(order == null || order.trim().length() == 0) {
|
|
@@ -132,7 +132,7 @@ public abstract class AbstractService<T extends Serializable> implements IServic
|
|
public int update(List<T> list, String tableName) {
|
|
public int update(List<T> list, String tableName) {
|
|
return this.update(list, tableName);
|
|
return this.update(list, tableName);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public int updateByBatch(LinkedHashMap<String, String> condition, String field, String tableName) {
|
|
public int updateByBatch(LinkedHashMap<String, String> condition, String field, String tableName) {
|
|
return this.getMapper().updateByBatch(condition, field, this.getTableName());
|
|
return this.getMapper().updateByBatch(condition, field, this.getTableName());
|