【7.6.0】format类增加字典id的转化

pull/55/head
fengshuonan 2023-05-04 21:27:54 +08:00
parent fe55faf0a1
commit 8b910a6900
3 changed files with 46 additions and 0 deletions

View File

@ -66,4 +66,12 @@ public interface DictApi {
*/
void deleteByDictId(Long dictId);
/**
* id
*
* @author fengshuonan
* @since 2023/5/4 21:25
*/
String getDictNameByDictId(Long dictId);
}

View File

@ -0,0 +1,28 @@
package cn.stylefeng.roses.kernel.dict.api.format;
import cn.hutool.core.convert.Convert;
import cn.hutool.extra.spring.SpringUtil;
import cn.stylefeng.roses.kernel.dict.api.DictApi;
import cn.stylefeng.roses.kernel.rule.format.BaseSimpleFieldFormatProcess;
/**
* JSONid
*
* @author fengshuonan
* @since 2023/5/4 21:20
*/
public class DictFormatProcess extends BaseSimpleFieldFormatProcess {
@Override
public Class<?> getItemClass() {
return Long.class;
}
@Override
public Object simpleItemFormat(Object businessId) {
Long orgId = Convert.toLong(businessId);
DictApi bean = SpringUtil.getBean(DictApi.class);
return bean.getDictNameByDictId(orgId);
}
}

View File

@ -224,6 +224,16 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, SysDict> implements
this.removeById(dictId);
}
@Override
public String getDictNameByDictId(Long dictId) {
SysDict sysDict = this.getById(dictId);
if (sysDict == null) {
return "";
} else {
return sysDict.getDictName();
}
}
/**
*
*