Commit 46a7bb79 by fudahua

字典

parent f05cdc43
......@@ -4,6 +4,8 @@ import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.DictDTO;
import java.util.List;
/**
* Created by tgs on 2020/2/9.
*/
......@@ -15,4 +17,12 @@ public interface DictApiService {
Page<DictDTO> pageList(BasePageInfo pageInfo);
void deleteOne(String dictId);
/**
* 根据key 获取列表
*
* @param dictKeys
* @return
*/
List<DictDTO> queryList(List<String> dictKeys);
}
......@@ -3,6 +3,8 @@ package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabHaobanDict;
import com.github.pagehelper.Page;
import java.util.List;
public interface DictMapper {
int deleteByPrimaryKey(String dictId);
......@@ -18,4 +20,6 @@ public interface DictMapper {
Page<TabHaobanDict> pageList();
List<TabHaobanDict> queryList(List<String> keys);
}
\ No newline at end of file
......@@ -16,6 +16,8 @@ import com.gic.haoban.manage.service.dao.mapper.DictMapper;
import com.gic.haoban.manage.service.entity.TabHaobanDict;
import com.github.pagehelper.PageHelper;
import java.util.List;
/**
* Created by tgs on 2020/2/9.
*/
......@@ -56,4 +58,10 @@ public class DictApiServiceImpl implements DictApiService{
public void deleteOne(String dictId) {
dictMapper.deleteByPrimaryKey(dictId);
}
@Override
public List<DictDTO> queryList(List<String> dictKeys) {
List<TabHaobanDict> list = dictMapper.queryList(dictKeys);
return EntityUtil.changeEntityListByJSON(DictDTO.class, list);
}
}
......@@ -120,4 +120,16 @@
<include refid="Base_Column_List" />
from tab_haoban_dict
</select>
<select id="queryList" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_dict
WHERE
status_flag = 1
AND dict_key in
<foreach collection="keys" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
package com.gic.haoban.manage.web.controller;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DictDTO;
import com.gic.haoban.manage.api.service.DictApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.Arrays;
import java.util.List;
/**
* Created 2020/3/26.
*
* @author hua
*/
@Controller
public class DictController extends WebBaseController {
@Autowired
private DictApiService dictApiService;
@RequestMapping("/dict-list")
public HaobanResponse queryDictList(String dictKeys) {
if (StringUtils.isBlank(dictKeys)) {
return resultResponse(HaoBanErrCode.ERR_5);
}
String[] split = dictKeys.split(",");
List<DictDTO> ret = dictApiService.queryList(Arrays.asList(split));
return resultResponse(HaoBanErrCode.ERR_1, ret);
}
}
......@@ -38,4 +38,6 @@
<dubbo:reference interface="com.gic.thirdparty.api.service.QQCloudPicService" id="qqCloudPicServiceImpl"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.DictApiService" id="dictApiService"/>
</beans>
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