增加字典模块-表名axzo_dictionary更新成nanopart_dictionary
This commit is contained in:
parent
8a9e52baf6
commit
8833fc5a78
@ -16,6 +16,7 @@ import com.google.common.collect.Maps;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@ -49,13 +50,24 @@ public class DictionaryController implements DictionaryApi {
|
||||
@Override
|
||||
public Map<String, List<QueryByDictTypeResp>> queryByBatchType(@RequestBody @Valid QueryByBatchDictTypeReq req) {
|
||||
List<Dictionary> list = dictionaryService.query(BeanUtil.copyProperties(req, QueryDictReq.class));
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
Map<String, List<Dictionary>> map = list.stream().collect(Collectors.groupingBy(Dictionary::getDictType, Collectors.toList()));
|
||||
return this.buildDictTypeMap(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建QueryByDictTypeResp集合Map
|
||||
*/
|
||||
private Map<String, List<QueryByDictTypeResp>> buildDictTypeMap(Map<String, List<Dictionary>> map) {
|
||||
Map<String, List<QueryByDictTypeResp>> resultMap = Maps.newHashMap();
|
||||
if (!CollectionUtils.isEmpty(map)) {
|
||||
map.forEach((dictType, dictList) -> {
|
||||
List<QueryByDictTypeResp> respList = BeanUtil.copyToList(dictList, QueryByDictTypeResp.class);
|
||||
resultMap.put(dictType, respList);
|
||||
});
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ import lombok.experimental.Accessors;
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName(value = "axzo_dictionary", autoResultMap = true)
|
||||
@TableName(value = "nanopart_dictionary", autoResultMap = true)
|
||||
public class Dictionary extends BaseEntity<Dictionary> {
|
||||
|
||||
/**
|
||||
@ -42,7 +42,7 @@ public class Dictionary extends BaseEntity<Dictionary> {
|
||||
private String dictValue;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
* 排序:倒序,值越大越靠前
|
||||
*/
|
||||
@TableField(value = "order_by")
|
||||
private Integer orderBy;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user