Commit 205db241 authored by jiaorz's avatar jiaorz

修改数据字典接口

parent 81a14283
......@@ -79,13 +79,18 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
return ObjectRestResponse.succ();
}
public ObjectRestResponse getParent() {
Set<Dictionary> dictionaryList = mapper.selectByPid(0);
public ObjectRestResponse getParent(String type) {
if(StringUtils.isEmpty(type)) {
return ObjectRestResponse.paramIsEmpty();
}
Dictionary dictionary = new Dictionary();
dictionary.setType(type);
dictionary.setPid(0);
List<Dictionary> dictionaryList = mapper.selectByCodeAndType(dictionary);
for(Dictionary parent : dictionaryList) {
Set<Dictionary> dictionaryVoList = buildTree(parent.getId());
parent.setChildrens(dictionaryVoList);
}
return ObjectRestResponse.succ(dictionaryList);
}
......
......@@ -42,7 +42,7 @@ public class DictionaryController {
@GetMapping(value = "/getParents")
@ApiOperation(value = "获取所有的父类元素 pid=0")
public ObjectRestResponse getParent() {
return dictionaryBiz.getParent();
public ObjectRestResponse getParent(String type) {
return dictionaryBiz.getParent(type);
}
}
......@@ -14,22 +14,22 @@
</resultMap>
<select id="selectByCodeAndType" parameterType="com.xxfc.platform.universal.entity.Dictionary" resultType="com.xxfc.platform.universal.entity.Dictionary">
select * from dictionary
select * from data_dictionary
<where>
<if test="type != null">
and type = #{type}
</if>
<if test="code">
<if test="code != null">
and code = #{code}
</if>
<if test="pid">
<if test="pid != null">
and pid = #{pid}
</if>
</where>
</select>
<select id = "selectByPid" parameterType="java.lang.Integer" resultType="com.xxfc.platform.universal.entity.Dictionary">
select * from dictionary
select * from data_dictionary
where pid = #{pid}
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment