mirror of
https://github.com/getrebuild/rebuild.git
synced 2025-10-22 05:25:55 +08:00
hotfix: clazz hide
This commit is contained in:
parent
fcd1a00a69
commit
4cb521f029
5 changed files with 27 additions and 37 deletions
|
@ -15,6 +15,7 @@ import com.rebuild.core.configuration.ConfigManager;
|
||||||
import com.rebuild.core.metadata.EntityHelper;
|
import com.rebuild.core.metadata.EntityHelper;
|
||||||
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
|
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
|
||||||
import com.rebuild.core.metadata.impl.EasyFieldConfigProps;
|
import com.rebuild.core.metadata.impl.EasyFieldConfigProps;
|
||||||
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
@ -47,7 +48,7 @@ public class ClassificationManager implements ConfigManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取全名称(包括父级,用 . 分割)
|
* 获取全名称(包括父级)
|
||||||
*
|
*
|
||||||
* @param itemId
|
* @param itemId
|
||||||
* @return
|
* @return
|
||||||
|
@ -61,39 +62,20 @@ public class ClassificationManager implements ConfigManager {
|
||||||
* @param itemId
|
* @param itemId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getColor(ID itemId) {
|
public Item getItem(ID itemId) {
|
||||||
Item item = getItem(itemId);
|
final String ckey = "ClassificationITEM40-" + itemId;
|
||||||
return item == null ? null : item.Color;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param itemId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getCode(ID itemId) {
|
|
||||||
Item item = getItem(itemId);
|
|
||||||
return item == null ? null : item.Code;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param itemId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Item getItem(ID itemId) {
|
|
||||||
final String ckey = "ClassificationITEM38-" + itemId;
|
|
||||||
Item ditem = (Item) Application.getCommonsCache().getx(ckey);
|
Item ditem = (Item) Application.getCommonsCache().getx(ckey);
|
||||||
if (ditem != null) {
|
if (ditem != null) {
|
||||||
return DELETED_ITEM.equals(ditem.Name) ? null : ditem;
|
return DELETED_ITEM.equals(ditem.Name) ? null : ditem;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object[] o = Application.createQueryNoFilter(
|
Object[] o = Application.createQueryNoFilter(
|
||||||
"select name,fullName,code,color from ClassificationData where itemId = ?")
|
"select name,fullName,code,color,isHide from ClassificationData where itemId = ?")
|
||||||
.setParameter(1, itemId)
|
.setParameter(1, itemId)
|
||||||
.unique();
|
.unique();
|
||||||
if (o != null) ditem = new Item((String) o[0], (String) o[1], (String) o[2], (String) o[3]);
|
if (o != null) ditem = new Item((String) o[0], (String) o[1], (String) o[2], (String) o[3], ObjectUtils.toBool(o[4]));
|
||||||
|
|
||||||
// 可能已删除
|
// 可能已删除
|
||||||
if (ditem == null) ditem = new Item(DELETED_ITEM, null, null, null);
|
if (ditem == null) ditem = new Item(DELETED_ITEM, null, null, null, true);
|
||||||
|
|
||||||
Application.getCommonsCache().putx(ckey, ditem);
|
Application.getCommonsCache().putx(ckey, ditem);
|
||||||
return DELETED_ITEM.equals(ditem.Name) ? null : ditem;
|
return DELETED_ITEM.equals(ditem.Name) ? null : ditem;
|
||||||
|
@ -188,18 +170,21 @@ public class ClassificationManager implements ConfigManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bean
|
// Bean
|
||||||
static class Item implements Serializable {
|
@Getter
|
||||||
|
public static class Item implements Serializable {
|
||||||
private static final long serialVersionUID = -1903227875771376652L;
|
private static final long serialVersionUID = -1903227875771376652L;
|
||||||
Item(String name, String fullName, String code, String color) {
|
Item(String name, String fullName, String code, String color, boolean isHide) {
|
||||||
this.Name = name;
|
this.Name = name;
|
||||||
this.FullName = fullName;
|
this.FullName = fullName;
|
||||||
this.Code = code;
|
this.Code = code;
|
||||||
this.Color = color;
|
this.Color = color;
|
||||||
|
this.Hide = isHide;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String Name;
|
final String Name;
|
||||||
final String FullName;
|
final String FullName;
|
||||||
final String Code;
|
final String Code;
|
||||||
final String Color;
|
final String Color;
|
||||||
|
final boolean Hide;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,8 @@ public class EasyClassification extends EasyReference {
|
||||||
JSONObject map = (JSONObject) super.wrapValue(value);
|
JSONObject map = (JSONObject) super.wrapValue(value);
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
map.remove("entity");
|
map.remove("entity");
|
||||||
String color = ClassificationManager.instance.getColor((ID) value);
|
ClassificationManager.Item item = ClassificationManager.instance.getItem((ID) value);
|
||||||
if (color != null) map.put("color", color);
|
if (item != null && item.getColor() != null) map.put("color", item.getColor());
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ package com.rebuild.core.service.general;
|
||||||
|
|
||||||
import cn.devezhao.persist4j.engine.ID;
|
import cn.devezhao.persist4j.engine.ID;
|
||||||
import com.rebuild.core.Application;
|
import com.rebuild.core.Application;
|
||||||
|
import com.rebuild.core.configuration.general.ClassificationManager;
|
||||||
import com.rebuild.core.metadata.EntityHelper;
|
import com.rebuild.core.metadata.EntityHelper;
|
||||||
import com.rebuild.core.metadata.MetadataHelper;
|
import com.rebuild.core.metadata.MetadataHelper;
|
||||||
import com.rebuild.core.privileges.UserFilters;
|
import com.rebuild.core.privileges.UserFilters;
|
||||||
|
@ -90,9 +91,12 @@ public class RecentlyUsedHelper {
|
||||||
|
|
||||||
// 是否符合条件
|
// 是否符合条件
|
||||||
if (checkFilter != null) {
|
if (checkFilter != null) {
|
||||||
if (!QueryHelper.isMatchFilter(raw, checkFilter)) {
|
if (!QueryHelper.isMatchFilter(raw, checkFilter)) continue;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
// fix:4.0.2
|
||||||
|
if (entityCode == EntityHelper.ClassificationData) {
|
||||||
|
ClassificationManager.Item item = ClassificationManager.instance.getItem(raw);
|
||||||
|
if (item == null || item.isHide()) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -252,10 +252,11 @@ public class DataListWrapper {
|
||||||
value = colorValue;
|
value = colorValue;
|
||||||
|
|
||||||
} else if (easyField.getDisplayType() == DisplayType.CLASSIFICATION) {
|
} else if (easyField.getDisplayType() == DisplayType.CLASSIFICATION) {
|
||||||
String color = ClassificationManager.instance.getColor((ID) originValue);
|
ClassificationManager.Item item = ClassificationManager.instance.getItem((ID) originValue);
|
||||||
if (StringUtils.isNotBlank(color)) {
|
if (item != null && StringUtils.isNotBlank(item.getColor())) {
|
||||||
value = JSONUtils.toJSONObject(
|
value = JSONUtils.toJSONObject(
|
||||||
new String[]{ "text", "color" }, new Object[]{ value, color });
|
new String[]{ "text", "color" },
|
||||||
|
new Object[]{ value, item.getColor() });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,10 +87,10 @@ public class RecentlyUsedSearchController extends BaseController {
|
||||||
label = FieldValueHelper.NO_LABEL_PREFIX + id.toLiteral().toUpperCase();
|
label = FieldValueHelper.NO_LABEL_PREFIX + id.toLiteral().toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
String code = isClazz ? ClassificationManager.instance.getCode(id) : null;
|
ClassificationManager.Item item = isClazz ? ClassificationManager.instance.getItem(id) : null;
|
||||||
data.add(JSONUtils.toJSONObject(
|
data.add(JSONUtils.toJSONObject(
|
||||||
new String[] { "id", "text", "code" },
|
new String[] { "id", "text", "code" },
|
||||||
new Object[] { id, label, code }));
|
new Object[] { id, label, item == null ? null : item.getCode() }));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useGroupName != null) {
|
if (useGroupName != null) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue