yaoq 2 лет назад
Родитель
Сommit
5f65d36c42
7 измененных файлов: 20 добавлений и 15 удалений
  1. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/spring/file/attach/AttachHelper.java
  2. +3
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menu/MenuHandler.java
  3. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/role/RoleHandler.java
  4. +3
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/role/RoleRightContent.java
  5. +3
    -3
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/cache/ModelDatabaseCache.java
  6. +3
    -3
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/cache/ModelTableCache.java
  7. +6
    -1
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/StringUtil.java

+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/spring/file/attach/AttachHelper.java Просмотреть файл

@@ -97,7 +97,7 @@ public final class AttachHelper {
//批量删除
public boolean deleteAttachList(List<String> attachIdList) throws Exception {
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;
}



+ 3
- 3
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menu/MenuHandler.java Просмотреть файл

@@ -56,9 +56,9 @@ public class MenuHandler {
}
if (StringUtil.isNotEmpty(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"), ","));
}
}
}


+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/role/RoleHandler.java Просмотреть файл

@@ -78,8 +78,8 @@ public class RoleHandler {
right = new RoleRight();
right.setId(item.getId());
right.setMenuId(item.getMenu());
right.setMenu(1);
}
right.setMenu(1);
right.setFunc(formData.readStringSet("func"));
right.setData(formData.readListMap("data"));
if (item.getMenu() > 0L)


+ 3
- 3
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/role/RoleRightContent.java Просмотреть файл

@@ -61,7 +61,7 @@ public class RoleRightContent {
public String getFuncRight(long key) {
RoleRight right = getRoleRight(key);
if (right == null) return "";
return CommUtil.getSqlInStr(right.getRightFunc());
return StringUtil.join(right.getRightFunc(),",");
}

public String getMenuRight() {
@@ -70,7 +70,7 @@ public class RoleRightContent {
map.values().forEach(roleRight -> {
if (roleRight.getMenu() == 1) menus.add(roleRight.getId() + "");
});
return CommUtil.getSqlInStr(menus);
return StringUtil.join(menus,",");
}
public Set<Long> getMenuRightIds() {
Set<Long> ids = new HashSet<>();
@@ -89,7 +89,7 @@ public class RoleRightContent {
cache.forEach((k, v) -> {
if (v == type) fields.add(k);
});
return CommUtil.getSqlInStr(fields);
return StringUtil.join(fields,",");
}

public Map<String, Object> getDataRight(long key) {


+ 3
- 3
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/cache/ModelDatabaseCache.java Просмотреть файл

@@ -8,7 +8,7 @@ import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.vo.ModelDatabase;
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 java.util.List;
@@ -38,7 +38,7 @@ public class ModelDatabaseCache extends AbstractCache<ModelDatabase> {
EntityDao<ModelDatabase> dao = DbEngine.getInstance().findDao(ModelDatabase.class);
if (StringUtils.isEmpty(SwConsts.SysParam.RUN_PROJECTS))
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) {
@@ -47,6 +47,6 @@ public class ModelDatabaseCache extends AbstractCache<ModelDatabase> {

public final String getName(long id) {
ModelDatabase db = get(id);
return db != null ? db.getName(): "";
return db != null ? db.getName() : "";
}
}

+ 3
- 3
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/cache/ModelTableCache.java Просмотреть файл

@@ -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.ModelProject;
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.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;
@@ -54,7 +54,7 @@ public class ModelTableCache extends AbstractCache<ModelTable> {
protected List<ModelTable> loadAll() {
String sql;
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 = "";
return DbEngine.getInstance().query("SELECT\n" +
"t.tb_id,\n" +
@@ -122,7 +122,7 @@ public class ModelTableCache extends AbstractCache<ModelTable> {

public final String getTableName(long id) {
ModelTable bean = get(id);
return bean == null ? String.valueOf(id): bean.getTitle();
return bean == null ? String.valueOf(id) : bean.getTitle();
}

//根据外键


+ 6
- 1
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/StringUtil.java Просмотреть файл

@@ -254,6 +254,11 @@ public class StringUtil {
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.
*
@@ -490,7 +495,7 @@ public class StringUtil {
* @return str
*/
public static String checkNull(String strValue, String defaultValue) {
return strValue == null ? defaultValue: strValue;
return strValue == null ? defaultValue : strValue;
}

/**


Загрузка…
Отмена
Сохранить