|
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.boman.common.core.utils.StringUtils;
|
|
import com.boman.common.core.utils.StringUtils;
|
|
import com.boman.common.core.utils.collection.CollectionUtils;
|
|
import com.boman.common.core.utils.collection.CollectionUtils;
|
|
import com.boman.common.core.utils.obj.ObjectUtils;
|
|
import com.boman.common.core.utils.obj.ObjectUtils;
|
|
|
|
+import com.boman.common.core.web.domain.AjaxResult;
|
|
import com.boman.common.redis.RedisKey;
|
|
import com.boman.common.redis.RedisKey;
|
|
import com.boman.common.redis.service.RedisService;
|
|
import com.boman.common.redis.service.RedisService;
|
|
import com.boman.gen.domain.GenTable;
|
|
import com.boman.gen.domain.GenTable;
|
|
@@ -56,7 +57,7 @@ public class TableServiceCmdService {
|
|
return baseTableDTO;
|
|
return baseTableDTO;
|
|
}
|
|
}
|
|
|
|
|
|
- public final ValueHolder<RowResult> objectSave(BaseTableSaveDTO baseTableSaveDTO) {
|
|
|
|
|
|
+ public final AjaxResult objectSave(BaseTableSaveDTO baseTableSaveDTO) {
|
|
BaseTableDTO baseTableDTO = packTableDTO(baseTableSaveDTO);
|
|
BaseTableDTO baseTableDTO = packTableDTO(baseTableSaveDTO);
|
|
TableServiceContext context = TableServiceContext.createFrom(baseTableDTO);
|
|
TableServiceContext context = TableServiceContext.createFrom(baseTableDTO);
|
|
// BaseSaveService baseSaveService = SpringUtils.getBean(BaseSaveService.class);
|
|
// BaseSaveService baseSaveService = SpringUtils.getBean(BaseSaveService.class);
|
|
@@ -72,7 +73,7 @@ public class TableServiceCmdService {
|
|
LOGGER.error("保存失败,保持的原始数据为: {}", JSON.toJSONString(baseTableSaveDTO));
|
|
LOGGER.error("保存失败,保持的原始数据为: {}", JSON.toJSONString(baseTableSaveDTO));
|
|
}
|
|
}
|
|
|
|
|
|
- return ValueHolder.ok(rowResult);
|
|
|
|
|
|
+ return AjaxResult.success(rowResult);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -81,7 +82,7 @@ public class TableServiceCmdService {
|
|
* @param dto 前台传过来的dto
|
|
* @param dto 前台传过来的dto
|
|
* @return com.boman.system.common.ValueHolder
|
|
* @return com.boman.system.common.ValueHolder
|
|
*/
|
|
*/
|
|
- public ValueHolder<RowResult> objectDelete(BaseTableSaveDTO dto) {
|
|
|
|
|
|
+ public AjaxResult objectDelete(BaseTableSaveDTO dto) {
|
|
requireNonNull(dto.getTable());
|
|
requireNonNull(dto.getTable());
|
|
Long[] idArr = CollectionUtils.listToArray(dto.getIdList());
|
|
Long[] idArr = CollectionUtils.listToArray(dto.getIdList());
|
|
requiredNonNull(idArr);
|
|
requiredNonNull(idArr);
|
|
@@ -92,7 +93,7 @@ public class TableServiceCmdService {
|
|
|
|
|
|
RowResult rowResult = deleteService.objectDelete(idArr, dto.getTable(), requireNonNull(pkName));
|
|
RowResult rowResult = deleteService.objectDelete(idArr, dto.getTable(), requireNonNull(pkName));
|
|
LOGGER.info(rowResult.getMessage() + ", id: {}", Arrays.toString(idArr));
|
|
LOGGER.info(rowResult.getMessage() + ", id: {}", Arrays.toString(idArr));
|
|
- return ValueHolder.ok(rowResult);
|
|
|
|
|
|
+ return AjaxResult.success(rowResult);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -102,7 +103,7 @@ public class TableServiceCmdService {
|
|
* @param dto 前台传过来的dto
|
|
* @param dto 前台传过来的dto
|
|
* @return com.boman.system.common.ValueHolder
|
|
* @return com.boman.system.common.ValueHolder
|
|
*/
|
|
*/
|
|
- public ValueHolder<RowResult> objectLogicDelete(BaseTableSaveDTO dto) {
|
|
|
|
|
|
+ public AjaxResult objectLogicDelete(BaseTableSaveDTO dto) {
|
|
requireNonNull(dto.getTable());
|
|
requireNonNull(dto.getTable());
|
|
Long[] idArr = CollectionUtils.listToArray(dto.getIdList());
|
|
Long[] idArr = CollectionUtils.listToArray(dto.getIdList());
|
|
requiredNonNull(idArr);
|
|
requiredNonNull(idArr);
|
|
@@ -117,7 +118,7 @@ public class TableServiceCmdService {
|
|
|
|
|
|
RowResult rowResult = deleteService.objectLogicDelete(idArr, dto.getTable(), requireNonNull(pkName), jsonObject);
|
|
RowResult rowResult = deleteService.objectLogicDelete(idArr, dto.getTable(), requireNonNull(pkName), jsonObject);
|
|
LOGGER.info(rowResult.getMessage() + ", id: {}", Arrays.toString(idArr));
|
|
LOGGER.info(rowResult.getMessage() + ", id: {}", Arrays.toString(idArr));
|
|
- return ValueHolder.ok(rowResult);
|
|
|
|
|
|
+ return AjaxResult.success(rowResult);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -126,7 +127,7 @@ public class TableServiceCmdService {
|
|
* @param dto condition
|
|
* @param dto condition
|
|
* @return com.boman.system.common.ValueHolder
|
|
* @return com.boman.system.common.ValueHolder
|
|
*/
|
|
*/
|
|
- public ValueHolder<List<JSONObject>> getObject(BaseTableSaveDTO dto) {
|
|
|
|
|
|
+ public AjaxResult getObject(BaseTableSaveDTO dto) {
|
|
requireNonNull(dto.getTable());
|
|
requireNonNull(dto.getTable());
|
|
|
|
|
|
// 拿到每个字段对应的查询类型,=、 like、 >、 <
|
|
// 拿到每个字段对应的查询类型,=、 like、 >、 <
|
|
@@ -143,7 +144,7 @@ public class TableServiceCmdService {
|
|
JSONArray showData = fixedData.getJSONArray(SHOW_DATA);
|
|
JSONArray showData = fixedData.getJSONArray(SHOW_DATA);
|
|
List<JSONObject> result = selectService.selectByCondition(genTable.getTableName(), condition, packCondition
|
|
List<JSONObject> result = selectService.selectByCondition(genTable.getTableName(), condition, packCondition
|
|
, showData, dto.getOrderBy(), dto.getLimit(), dto.getOffset());
|
|
, showData, dto.getOrderBy(), dto.getLimit(), dto.getOffset());
|
|
- return ValueHolder.ok(result);
|
|
|
|
|
|
+ return AjaxResult.success(result);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|