新增按照编码查询

This commit is contained in:
wenc000 2020-04-07 18:03:57 +08:00
parent 80c0b28ceb
commit 258a425d45
4 changed files with 36 additions and 3 deletions

View File

@ -135,4 +135,14 @@ public class DataDictionaryController extends AbstractController {
return dataDictionaryService.listZTreeDictionary(params); return dataDictionaryService.listZTreeDictionary(params);
} }
@ApiOperation(value = "字典列表(通过字典编码)", notes = "字典列表(通过字典编码)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "dictionaryCode", value = "字典编码", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listdictionarybydictionarycode/{dictionaryCode}")
public List<DataDictionaryDTO> listDictionaryByDictionaryCode(@PathVariable("dictionaryCode") String dictionaryCode) {
return dataDictionaryService.listDictionaryByDictionaryCode(dictionaryCode);
}
} }

View File

@ -148,5 +148,12 @@ public interface IDataDictionaryService {
*/ */
List<ZTreeDTO> listZTreeDictionary(Map<String, Object> params) throws SearchException; List<ZTreeDTO> listZTreeDictionary(Map<String, Object> params) throws SearchException;
/**
* 字典列表通过字典编码
*
* @param dictionaryCode
* @return
* @throws SearchException
*/
List<DataDictionaryDTO> listDictionaryByDictionaryCode(String dictionaryCode) throws SearchException;
} }

View File

@ -170,6 +170,13 @@ public class DataDictionaryServiceImpl extends AbstractService implements IDataD
return zTreeDTOs; return zTreeDTOs;
} }
@Override
public List<DataDictionaryDTO> listDictionaryByDictionaryCode(String dictionaryCode) throws SearchException {
Map<String, Object> params = getHashMap(1);
params.put("dictionaryCode", dictionaryCode);
return dictionaryDao.listDictionary(params);
}
/** /**
* 递归查询子组 * 递归查询子组
* *

View File

@ -104,7 +104,12 @@
<!-- 字典列表 --> <!-- 字典列表 -->
<select id="listDictionary" parameterType="map" resultMap="dictionaryDTO"> <select id="listDictionary" parameterType="map" resultMap="dictionaryDTO">
SELECT SELECT
* dictionary_id,
dictionary_parent_id,
dictionary_name,
dictionary_summary,
dictionary_code,
dictionary_sort
FROM FROM
data_dictionary data_dictionary
WHERE WHERE
@ -121,10 +126,14 @@
AND AND
LEFT(gmt_create, 10) <![CDATA[ >= ]]> #{startTime} LEFT(gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if> </if>
<if test="startTime != null and startTime != ''"> <if test="endTime != null and endTime != ''">
AND AND
LEFT(gmt_create, 10) <![CDATA[ <= ]]> #{endTime} LEFT(gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if> </if>
<if test="dictionaryCode != null and dictionaryCode != ''">
AND
dictionary_code LIKE CONCAT(#{dictionaryCode}, '%')
</if>
<if test="dictionaryIds != null and dictionaryIds.size > 0"> <if test="dictionaryIds != null and dictionaryIds.size > 0">
AND AND
dictionary_id IN dictionary_id IN