Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
75d97499
提交
75d97499
authored
4月 16, 2019
作者:
sin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- 添加查询多个 字典值
上级
371eba55
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
36 行增加
和
2 行删除
+36
-2
DataDictMapper.java
...c/main/java/cn/iocoder/mall/admin/dao/DataDictMapper.java
+11
-2
DataDictServiceImpl.java
...va/cn/iocoder/mall/admin/service/DataDictServiceImpl.java
+12
-0
DataDictMapper.xml
...service-impl/src/main/resources/mapper/DataDictMapper.xml
+13
-0
没有找到文件。
admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dao/DataDictMapper.java
浏览文件 @
75d97499
...
@@ -4,6 +4,7 @@ import cn.iocoder.mall.admin.dataobject.DataDictDO;
...
@@ -4,6 +4,7 @@ import cn.iocoder.mall.admin.dataobject.DataDictDO;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
@Repository
@Repository
...
@@ -11,8 +12,16 @@ public interface DataDictMapper {
...
@@ -11,8 +12,16 @@ public interface DataDictMapper {
DataDictDO
selectById
(
@Param
(
"id"
)
Integer
id
);
DataDictDO
selectById
(
@Param
(
"id"
)
Integer
id
);
DataDictDO
selectByEnumValueAndValue
(
@Param
(
"enumValue"
)
String
enumValue
,
DataDictDO
selectByEnumValueAndValue
(
@Param
(
"value"
)
String
value
);
@Param
(
"enumValue"
)
String
enumValue
,
@Param
(
"value"
)
String
value
);
List
<
DataDictDO
>
selectByEnumValueAndValues
(
@Param
(
"enumValue"
)
String
enumValue
,
@Param
(
"values"
)
Collection
<
String
>
values
);
List
<
DataDictDO
>
selectList
();
List
<
DataDictDO
>
selectList
();
...
...
admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/DataDictServiceImpl.java
浏览文件 @
75d97499
...
@@ -14,8 +14,11 @@ import cn.iocoder.mall.admin.dataobject.DataDictDO;
...
@@ -14,8 +14,11 @@ import cn.iocoder.mall.admin.dataobject.DataDictDO;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
/**
/**
* 数据字典 Service
* 数据字典 Service
...
@@ -93,4 +96,12 @@ public class DataDictServiceImpl implements DataDictService {
...
@@ -93,4 +96,12 @@ public class DataDictServiceImpl implements DataDictService {
DataDictBO
dataDictBO
=
DataDictConvert
.
INSTANCE
.
convert
(
dataDictDO
);
DataDictBO
dataDictBO
=
DataDictConvert
.
INSTANCE
.
convert
(
dataDictDO
);
return
CommonResult
.
success
(
dataDictBO
);
return
CommonResult
.
success
(
dataDictBO
);
}
}
@Override
public
CommonResult
<
List
<
DataDictBO
>>
getDataDict
(
String
dictKey
,
Collection
<
Object
>
dictValueList
)
{
Set
<
String
>
convertDictValueList
=
dictValueList
.
stream
().
map
(
o
->
String
.
valueOf
(
o
)).
collect
(
Collectors
.
toSet
());
List
<
DataDictDO
>
dataDictDOList
=
dataDictMapper
.
selectByEnumValueAndValues
(
dictKey
,
convertDictValueList
);
List
<
DataDictBO
>
dataDictBOList
=
DataDictConvert
.
INSTANCE
.
convert
(
dataDictDOList
);
return
CommonResult
.
success
(
dataDictBOList
);
}
}
}
\ No newline at end of file
admin/admin-service-impl/src/main/resources/mapper/DataDictMapper.xml
浏览文件 @
75d97499
...
@@ -17,6 +17,19 @@
...
@@ -17,6 +17,19 @@
LIMIT 1
LIMIT 1
</select>
</select>
<select
id=
"selectByEnumValueAndValues"
resultType=
"cn.iocoder.mall.admin.dataobject.DataDictDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM data_dict
WHERE deleted = 0
AND enum_value = #{enumValue}
AND `value` IN
<foreach
collection=
"values"
item=
"value"
separator=
","
open=
"("
close=
")"
>
#{value}
</foreach>
</select>
<select
id=
"selectById"
resultType=
"DataDictDO"
>
<select
id=
"selectById"
resultType=
"DataDictDO"
>
SELECT
SELECT
<include
refid=
"FIELDS"
/>
<include
refid=
"FIELDS"
/>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论