Commit 41556b93 by 墨竹

feat:增加查询好办字典表数据接口

parent f5fd2e61
......@@ -25,4 +25,14 @@ public interface DictApiService {
* @return
*/
List<DictDTO> queryList(List<String> dictKeys);
/**
* 根据key 获取一条
*
* @param dictKey dict关键
* @return {@link DictDTO }
* @author mozhu
* @date 2021-12-15 19:47:51
*/
DictDTO findOneDictByKey(String dictKey);
}
......@@ -26,5 +26,4 @@ public interface DictMapper {
TabHaobanDict selectByDictKey(String dictKey);
TabHaobanDict selectByDictName(String dictKey);
}
\ No newline at end of file
package com.gic.haoban.manage.service.service.out.impl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.DictDTO;
import com.gic.haoban.manage.api.service.DictApiService;
import com.gic.haoban.manage.service.dao.mapper.DictMapper;
import com.gic.haoban.manage.service.entity.TabHaobanDict;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -73,4 +71,9 @@ public class DictApiServiceImpl implements DictApiService{
List<TabHaobanDict> list = dictMapper.queryList(dictKeys);
return EntityUtil.changeEntityListByJSON(DictDTO.class, list);
}
@Override
public DictDTO findOneDictByKey(String dictKey) {
return EntityUtil.changeEntity(DictDTO.class, dictMapper.selectByDictKey(dictKey));
}
}
......@@ -140,13 +140,13 @@
<include refid="Base_Column_List" />
from tab_haoban_dict
where dict_key = #{dictKey,jdbcType=VARCHAR}
and status_flag = 1
and status_flag = 1 limit 1
</select>
<select id="selectByDictName" resultMap="BaseResultMap" parameterType="java.lang.String" >
<select id="selectByDictName" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from tab_haoban_dict
where dict_name = #{dictName,jdbcType=VARCHAR}
and status_flag = 1
and status_flag = 1 limit 1
</select>
</mapper>
\ No newline at end of file
......@@ -36,4 +36,19 @@ public class DictController extends WebBaseController {
List<DictDTO> ret = dictApiService.queryList(Arrays.asList(split));
return resultResponse(HaoBanErrCode.ERR_1, EntityUtil.changeEntityListByOrika(DictVo.class, ret));
}
/**
* 根据key查询一条数据
*
* @param dictKey
* @return
*/
@RequestMapping("/find-dict-key")
@ResponseBody
public HaobanResponse queryDictByKey(String dictKey) {
if (StringUtils.isBlank(dictKey)) {
return resultResponse(HaoBanErrCode.ERR_5);
}
return resultResponse(HaoBanErrCode.ERR_1, dictApiService.findOneDictByKey(dictKey));
}
}
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