1. 添加字典功能

topo_dev
xueqingkun 9 months ago
parent 4beed05826
commit ac4ad5443e

@ -37,6 +37,7 @@ public class ComDictionaryController {
@PostMapping("/queryByType")
@ApiOperation(value = "通过type查询字典,可一次性查询多个", httpMethod = "POST")
public R<?> findDictionaryListByType(@RequestBody @Validated DictionaryByTypeParam dictionaryByTypeParam) {
dictionaryByTypeParam.setStatus("1");
return dictionaryService.findDictionaryListByType(dictionaryByTypeParam);
}
@ -52,6 +53,13 @@ public class ComDictionaryController {
return dictionaryService.updateDictionary(dictionary);
}
@PostMapping("/updateCategory")
@ApiOperation(value = "修改字典分类", httpMethod = "POST")
public R<?> updateCategory(@RequestBody ComDictionary dictionary) {
Boolean success = dictionaryService.updateCategory(dictionary);
return R.ok(success);
}
@PostMapping("/deleteByStatus/delete")
@ApiOperation(value = "逻辑删除字典", httpMethod = "POST")
public R<?> logicDeleteDictionary(@RequestParam Long id){

@ -47,10 +47,16 @@ public class ComDictionary implements Serializable {
private String type;
/**
* 01
* 01
*/
@Deprecated
private String status;
/**
*
*/
private Integer priority;
/**
*
*/

@ -34,4 +34,6 @@ public interface ComDictionaryService extends IService<ComDictionary> {
String getName(List<ComDictionary> list, String type, String value);
String getValue(List<ComDictionary> list, String type, String name);
Boolean updateCategory(ComDictionary dictionary);
}

@ -90,6 +90,7 @@ public class ComDictionaryServiceImpl extends ServiceImpl<ComDictionaryMapper, C
List<ComDictionary> otherList = new ArrayList<>();
ComDictionary comDictionary = new ComDictionary();
comDictionary.setType(dictType);
comDictionary.setDataStatus(dictionaryByTypeParam.getStatus());
Wrapper<ComDictionary> wrapper = Wrappers.query(comDictionary);
queryList = this.comDictionaryMapper.selectList(wrapper);
changeTree(queryList,otherList);
@ -105,7 +106,7 @@ public class ComDictionaryServiceImpl extends ServiceImpl<ComDictionaryMapper, C
} else {
// 平铺数据
if (Integer.valueOf(0).equals(dictionaryByTypeParam.getIsTree())){
resultMap.put(dictType,otherList.get(0).getChild());
resultMap.put(dictType,CollUtil.isNotEmpty(otherList) ? otherList.get(0).getChild() : new ArrayList<>());
}else {
// 树形数据
resultMap.put(dictType,otherList);
@ -209,4 +210,15 @@ public class ComDictionaryServiceImpl extends ServiceImpl<ComDictionaryMapper, C
return "";
}
@Override
public Boolean updateCategory(ComDictionary dictionary) {
Assert.notNull(dictionary.getId(), "id不能为空");
Assert.notEmpty(dictionary.getLabel(), "字典名称不能为空");
this.lambdaUpdate().eq(ComDictionary::getId,dictionary.getId())
.set(ComDictionary::getNote,dictionary.getNote())
.set(ComDictionary::getLabel,dictionary.getLabel()).update();
return true;
}
}

@ -4,7 +4,7 @@
<update id="updateDataStatusByIdAndPid">
update com_dictionary
set data_status = 0
where id = #{id} or pid = #{id}
where id = #{id}
</update>
<select id="queryAllChildrenInfoForPid" resultType="com.supervision.police.domain.ComDictionary">

Loading…
Cancel
Save