|
@@ -8,6 +8,7 @@ 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.service.RedisService;
|
|
|
+import com.boman.gen.controller.MyController;
|
|
|
import com.boman.gen.domain.GenTable;
|
|
|
import com.boman.gen.domain.GenTableColumn;
|
|
|
import com.boman.system.mapper.StandardlyMapper;
|
|
@@ -15,11 +16,13 @@ import com.boman.system.service.IBaseDeleteService;
|
|
|
import com.boman.system.service.IBaseSaveService;
|
|
|
import com.boman.system.service.IBaseSelectService;
|
|
|
import com.boman.system.utils.IdUtils;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -198,6 +201,38 @@ public class TableServiceCmdService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 功能描述: 获取表单查询字段和按钮
|
|
|
+ * 注意: 都是从redis中拿的,如果数据库和redis不一致,则需刷新一下redis
|
|
|
+ * 刷新的入口为 {@link MyController#loadTable(com.boman.gen.domain.GenTable)}
|
|
|
+ *
|
|
|
+ * eg:{
|
|
|
+ * "table": "sys_config",
|
|
|
+ * }
|
|
|
+ *
|
|
|
+ * @param condition condition
|
|
|
+ * @return com.boman.system.common.ValueHolder
|
|
|
+ */
|
|
|
+ public AjaxResult getTableQuery(BaseTableSaveDTO condition) {
|
|
|
+ String tableName = requireNonNull(condition.getTable());
|
|
|
+ GenTable genTable = redisService.getCacheObject(RedisKey.TABLE_INFO + tableName);
|
|
|
+ requireNonNull(genTable);
|
|
|
+
|
|
|
+ List<GenTableColumn> columns = genTable.getColumns();
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ ArrayList<GenTableColumn> queryList = Lists.newArrayListWithCapacity(16);
|
|
|
+ for (GenTableColumn column : columns) {
|
|
|
+ if (GenTableColumn.IS_QUERY.equalsIgnoreCase(column.getIsQuery())) {
|
|
|
+ queryList.add(column);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ jsonObject.put(FormDataConstant.QUERY_LIST, queryList);
|
|
|
+ // genTable.getMenuRole() 暂时数据库没有数据,
|
|
|
+ jsonObject.put(FormDataConstant.BUTTON_LIST, genTable.getMenuRole());
|
|
|
+ return AjaxResult.success(jsonObject);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 功能描述: 封装查询条件,在拼sql的时候按照此规则去取值
|
|
|
* {@link StandardlyMapper.SqlProvider#selectByCondition(java.util.Map)}
|