@@ -97,7 +97,7 @@ public final class AttachHelper { | |||||
//批量删除 | //批量删除 | ||||
public boolean deleteAttachList(List<String> attachIdList) throws Exception { | public boolean deleteAttachList(List<String> attachIdList) throws Exception { | ||||
if (CommUtil.isEmpty(attachIdList)) return false; | if (CommUtil.isEmpty(attachIdList)) return false; | ||||
dbEngine.update("delete from " + AttachInfo.ENTITY_NAME + " where attach_id in(" + CommUtil.getSqlInStr(attachIdList) + ")"); | |||||
dbEngine.update("delete from " + AttachInfo.ENTITY_NAME + " where attach_id in(" + StringUtil.join(attachIdList,",") + ")"); | |||||
return true; | return true; | ||||
} | } | ||||
@@ -56,9 +56,9 @@ public class MenuHandler { | |||||
} | } | ||||
if (StringUtil.isNotEmpty(menu.getRight())) { | if (StringUtil.isNotEmpty(menu.getRight())) { | ||||
Map<String, List<String>> rightMap = JsonUtil.parseMap(menu.getRight()); | Map<String, List<String>> rightMap = JsonUtil.parseMap(menu.getRight()); | ||||
bean.put("sm_right_data", CommUtil.getSqlInStr(rightMap.get("data"))); | |||||
bean.put("sm_right_func", CommUtil.getSqlInStr(rightMap.get("func"))); | |||||
bean.put("sm_right_field", CommUtil.getSqlInStr(rightMap.get("field"))); | |||||
bean.put("sm_right_data", StringUtil.join(rightMap.get("data"), ",")); | |||||
bean.put("sm_right_func", StringUtil.join(rightMap.get("func"), ",")); | |||||
bean.put("sm_right_field", StringUtil.join(rightMap.get("field"), ",")); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -78,8 +78,8 @@ public class RoleHandler { | |||||
right = new RoleRight(); | right = new RoleRight(); | ||||
right.setId(item.getId()); | right.setId(item.getId()); | ||||
right.setMenuId(item.getMenu()); | right.setMenuId(item.getMenu()); | ||||
right.setMenu(1); | |||||
} | } | ||||
right.setMenu(1); | |||||
right.setFunc(formData.readStringSet("func")); | right.setFunc(formData.readStringSet("func")); | ||||
right.setData(formData.readListMap("data")); | right.setData(formData.readListMap("data")); | ||||
if (item.getMenu() > 0L) | if (item.getMenu() > 0L) | ||||
@@ -61,7 +61,7 @@ public class RoleRightContent { | |||||
public String getFuncRight(long key) { | public String getFuncRight(long key) { | ||||
RoleRight right = getRoleRight(key); | RoleRight right = getRoleRight(key); | ||||
if (right == null) return ""; | if (right == null) return ""; | ||||
return CommUtil.getSqlInStr(right.getRightFunc()); | |||||
return StringUtil.join(right.getRightFunc(),","); | |||||
} | } | ||||
public String getMenuRight() { | public String getMenuRight() { | ||||
@@ -70,7 +70,7 @@ public class RoleRightContent { | |||||
map.values().forEach(roleRight -> { | map.values().forEach(roleRight -> { | ||||
if (roleRight.getMenu() == 1) menus.add(roleRight.getId() + ""); | if (roleRight.getMenu() == 1) menus.add(roleRight.getId() + ""); | ||||
}); | }); | ||||
return CommUtil.getSqlInStr(menus); | |||||
return StringUtil.join(menus,","); | |||||
} | } | ||||
public Set<Long> getMenuRightIds() { | public Set<Long> getMenuRightIds() { | ||||
Set<Long> ids = new HashSet<>(); | Set<Long> ids = new HashSet<>(); | ||||
@@ -89,7 +89,7 @@ public class RoleRightContent { | |||||
cache.forEach((k, v) -> { | cache.forEach((k, v) -> { | ||||
if (v == type) fields.add(k); | if (v == type) fields.add(k); | ||||
}); | }); | ||||
return CommUtil.getSqlInStr(fields); | |||||
return StringUtil.join(fields,","); | |||||
} | } | ||||
public Map<String, Object> getDataRight(long key) { | public Map<String, Object> getDataRight(long key) { | ||||
@@ -8,7 +8,7 @@ import cc.smtweb.framework.core.db.DbEngine; | |||||
import cc.smtweb.framework.core.db.EntityDao; | import cc.smtweb.framework.core.db.EntityDao; | ||||
import cc.smtweb.framework.core.db.vo.ModelDatabase; | import cc.smtweb.framework.core.db.vo.ModelDatabase; | ||||
import cc.smtweb.framework.core.db.vo.ModelProject; | import cc.smtweb.framework.core.db.vo.ModelProject; | ||||
import cc.smtweb.framework.core.util.CommUtil; | |||||
import cc.smtweb.framework.core.util.StringUtil; | |||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
import java.util.List; | import java.util.List; | ||||
@@ -38,7 +38,7 @@ public class ModelDatabaseCache extends AbstractCache<ModelDatabase> { | |||||
EntityDao<ModelDatabase> dao = DbEngine.getInstance().findDao(ModelDatabase.class); | EntityDao<ModelDatabase> dao = DbEngine.getInstance().findDao(ModelDatabase.class); | ||||
if (StringUtils.isEmpty(SwConsts.SysParam.RUN_PROJECTS)) | if (StringUtils.isEmpty(SwConsts.SysParam.RUN_PROJECTS)) | ||||
return dao.query(); | return dao.query(); | ||||
return dao.queryEx(" inner join " + ModelProject.ENTITY_NAME + " on db_prj_id=prj_id where prj_module in (" + CommUtil.getSqlInStr(SwConsts.SysParam.RUN_PROJECTS.split(",")) + ")"); | |||||
return dao.queryEx(" inner join " + ModelProject.ENTITY_NAME + " on db_prj_id=prj_id where prj_module in (" + StringUtil.join(SwConsts.SysParam.RUN_PROJECTS.split(","), ",") + ")"); | |||||
} | } | ||||
public final ModelDatabase getByName(String key) { | public final ModelDatabase getByName(String key) { | ||||
@@ -47,6 +47,6 @@ public class ModelDatabaseCache extends AbstractCache<ModelDatabase> { | |||||
public final String getName(long id) { | public final String getName(long id) { | ||||
ModelDatabase db = get(id); | ModelDatabase db = get(id); | ||||
return db != null ? db.getName(): ""; | |||||
return db != null ? db.getName() : ""; | |||||
} | } | ||||
} | } |
@@ -8,7 +8,7 @@ import cc.smtweb.framework.core.db.DbEngine; | |||||
import cc.smtweb.framework.core.db.vo.ModelField; | import cc.smtweb.framework.core.db.vo.ModelField; | ||||
import cc.smtweb.framework.core.db.vo.ModelProject; | import cc.smtweb.framework.core.db.vo.ModelProject; | ||||
import cc.smtweb.framework.core.db.vo.ModelTable; | import cc.smtweb.framework.core.db.vo.ModelTable; | ||||
import cc.smtweb.framework.core.util.CommUtil; | |||||
import cc.smtweb.framework.core.util.StringUtil; | |||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
import org.springframework.dao.DataAccessException; | import org.springframework.dao.DataAccessException; | ||||
import org.springframework.jdbc.core.ResultSetExtractor; | import org.springframework.jdbc.core.ResultSetExtractor; | ||||
@@ -54,7 +54,7 @@ public class ModelTableCache extends AbstractCache<ModelTable> { | |||||
protected List<ModelTable> loadAll() { | protected List<ModelTable> loadAll() { | ||||
String sql; | String sql; | ||||
if (!StringUtils.isEmpty(SwConsts.SysParam.RUN_PROJECTS)) { | if (!StringUtils.isEmpty(SwConsts.SysParam.RUN_PROJECTS)) { | ||||
sql = " inner join " + ModelProject.ENTITY_NAME + " on tb_prj_id=prj_id where prj_module in (" + CommUtil.getSqlInStr(SwConsts.SysParam.RUN_PROJECTS.split(",")) + ")"; | |||||
sql = " inner join " + ModelProject.ENTITY_NAME + " on tb_prj_id=prj_id where prj_module in (" + StringUtil.join(SwConsts.SysParam.RUN_PROJECTS.split(","), ",") + ")"; | |||||
} else sql = ""; | } else sql = ""; | ||||
return DbEngine.getInstance().query("SELECT\n" + | return DbEngine.getInstance().query("SELECT\n" + | ||||
"t.tb_id,\n" + | "t.tb_id,\n" + | ||||
@@ -122,7 +122,7 @@ public class ModelTableCache extends AbstractCache<ModelTable> { | |||||
public final String getTableName(long id) { | public final String getTableName(long id) { | ||||
ModelTable bean = get(id); | ModelTable bean = get(id); | ||||
return bean == null ? String.valueOf(id): bean.getTitle(); | |||||
return bean == null ? String.valueOf(id) : bean.getTitle(); | |||||
} | } | ||||
//根据外键 | //根据外键 | ||||
@@ -254,6 +254,11 @@ public class StringUtil { | |||||
return buf.toString(); | return buf.toString(); | ||||
} | } | ||||
public static String join(String[] list, String delim) { | |||||
return join(Arrays.asList(list), delim); | |||||
} | |||||
/** | /** | ||||
* Splits a String on a delimiter into a List of Strings. | * Splits a String on a delimiter into a List of Strings. | ||||
* | * | ||||
@@ -490,7 +495,7 @@ public class StringUtil { | |||||
* @return str | * @return str | ||||
*/ | */ | ||||
public static String checkNull(String strValue, String defaultValue) { | public static String checkNull(String strValue, String defaultValue) { | ||||
return strValue == null ? defaultValue: strValue; | |||||
return strValue == null ? defaultValue : strValue; | |||||
} | } | ||||
/** | /** | ||||