Commit 41556b93 by 墨竹

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

parent f5fd2e61
...@@ -15,7 +15,7 @@ public interface DictApiService { ...@@ -15,7 +15,7 @@ public interface DictApiService {
DictDTO findOneDict(String dictId); DictDTO findOneDict(String dictId);
Page<DictDTO> pageList(BasePageInfo pageInfo); Page<DictDTO> pageList(BasePageInfo pageInfo);
void deleteOne(String dictId); void deleteOne(String dictId);
/** /**
...@@ -25,4 +25,14 @@ public interface DictApiService { ...@@ -25,4 +25,14 @@ public interface DictApiService {
* @return * @return
*/ */
List<DictDTO> queryList(List<String> dictKeys); 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 { ...@@ -26,5 +26,4 @@ public interface DictMapper {
TabHaobanDict selectByDictKey(String dictKey); TabHaobanDict selectByDictKey(String dictKey);
TabHaobanDict selectByDictName(String dictKey); TabHaobanDict selectByDictName(String dictKey);
} }
\ No newline at end of file
package com.gic.haoban.manage.service.service.out.impl; 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.api.base.commons.Page;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.UuidUtil; 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.dto.DictDTO;
import com.gic.haoban.manage.api.service.DictApiService; import com.gic.haoban.manage.api.service.DictApiService;
import com.gic.haoban.manage.service.dao.mapper.DictMapper; import com.gic.haoban.manage.service.dao.mapper.DictMapper;
import com.gic.haoban.manage.service.entity.TabHaobanDict; import com.gic.haoban.manage.service.entity.TabHaobanDict;
import com.github.pagehelper.PageHelper; 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; import java.util.List;
...@@ -65,7 +63,7 @@ public class DictApiServiceImpl implements DictApiService{ ...@@ -65,7 +63,7 @@ public class DictApiServiceImpl implements DictApiService{
@Override @Override
public void deleteOne(String dictId) { public void deleteOne(String dictId) {
dictMapper.deleteByPrimaryKey(dictId); dictMapper.deleteByPrimaryKey(dictId);
} }
@Override @Override
...@@ -73,4 +71,9 @@ public class DictApiServiceImpl implements DictApiService{ ...@@ -73,4 +71,9 @@ public class DictApiServiceImpl implements DictApiService{
List<TabHaobanDict> list = dictMapper.queryList(dictKeys); List<TabHaobanDict> list = dictMapper.queryList(dictKeys);
return EntityUtil.changeEntityListByJSON(DictDTO.class, list); return EntityUtil.changeEntityListByJSON(DictDTO.class, list);
} }
@Override
public DictDTO findOneDictByKey(String dictKey) {
return EntityUtil.changeEntity(DictDTO.class, dictMapper.selectByDictKey(dictKey));
}
} }
...@@ -139,14 +139,14 @@ ...@@ -139,14 +139,14 @@
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from tab_haoban_dict from tab_haoban_dict
where dict_key = #{dictKey,jdbcType=VARCHAR} where dict_key = #{dictKey,jdbcType=VARCHAR}
and status_flag = 1 and status_flag = 1 limit 1
</select> </select>
<select id="selectByDictName" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByDictName" resultMap="BaseResultMap" parameterType="java.lang.String">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from tab_haoban_dict from tab_haoban_dict
where dict_name = #{dictName,jdbcType=VARCHAR} where dict_name = #{dictName,jdbcType=VARCHAR}
and status_flag = 1 and status_flag = 1 limit 1
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -36,4 +36,19 @@ public class DictController extends WebBaseController { ...@@ -36,4 +36,19 @@ public class DictController extends WebBaseController {
List<DictDTO> ret = dictApiService.queryList(Arrays.asList(split)); List<DictDTO> ret = dictApiService.queryList(Arrays.asList(split));
return resultResponse(HaoBanErrCode.ERR_1, EntityUtil.changeEntityListByOrika(DictVo.class, ret)); 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