Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
C
chinafrica
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
chinafrica
Commits
accbb39e
提交
accbb39e
authored
12月 21, 2020
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
属性管理
上级
4833a4f5
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
37 行增加
和
5 行删除
+37
-5
AttributesController.java
...in/java/com/platform/controller/AttributesController.java
+37
-5
没有找到文件。
platform-admin/src/main/java/com/platform/controller/AttributesController.java
浏览文件 @
accbb39e
package
com
.
platform
.
controller
;
package
com
.
platform
.
controller
;
import
com.platform.annotation.IgnoreAuth
;
import
com.platform.entity.AttributesEntity
;
import
com.platform.entity.AttributesEntity
;
import
com.platform.entity.TbCfItemParamEntity
;
import
com.platform.service.AttributesService
;
import
com.platform.service.AttributesService
;
import
com.platform.service.TbCfItemParamService
;
import
com.platform.utils.PageUtils
;
import
com.platform.utils.PageUtils
;
import
com.platform.utils.Query
;
import
com.platform.utils.Query
;
import
com.platform.utils.R
;
import
com.platform.utils.R
;
...
@@ -11,11 +14,7 @@ import org.apache.commons.lang.StringUtils;
...
@@ -11,11 +14,7 @@ import org.apache.commons.lang.StringUtils;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.util.*
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
...
@@ -34,6 +33,8 @@ import java.util.stream.Stream;
...
@@ -34,6 +33,8 @@ import java.util.stream.Stream;
public
class
AttributesController
{
public
class
AttributesController
{
@Autowired
@Autowired
private
AttributesService
attributesService
;
private
AttributesService
attributesService
;
@Autowired
private
TbCfItemParamService
itemParamService
;
/**
/**
* 查看列表
* 查看列表
...
@@ -115,6 +116,7 @@ public class AttributesController {
...
@@ -115,6 +116,7 @@ public class AttributesController {
@RequestMapping
(
"/queryAttrNames"
)
@RequestMapping
(
"/queryAttrNames"
)
@ResponseBody
@ResponseBody
@IgnoreAuth
public
R
queryAttrNames
(
@RequestParam
Map
<
String
,
Object
>
params
)
{
public
R
queryAttrNames
(
@RequestParam
Map
<
String
,
Object
>
params
)
{
LinkedList
<
AttributesVo
>
attrNameList
=
new
LinkedList
<>();
LinkedList
<
AttributesVo
>
attrNameList
=
new
LinkedList
<>();
List
<
AttributesEntity
>
list
=
attributesService
.
queryList
(
params
);
List
<
AttributesEntity
>
list
=
attributesService
.
queryList
(
params
);
...
@@ -129,6 +131,7 @@ public class AttributesController {
...
@@ -129,6 +131,7 @@ public class AttributesController {
@RequestMapping
(
"/queryAttrDescs"
)
@RequestMapping
(
"/queryAttrDescs"
)
@ResponseBody
@ResponseBody
@IgnoreAuth
public
R
queryAttrDescs
(
@RequestParam
(
"id"
)
String
id
,
public
R
queryAttrDescs
(
@RequestParam
(
"id"
)
String
id
,
@RequestParam
(
value
=
"attrDesc"
,
required
=
false
)
String
attrDesc
)
{
@RequestParam
(
value
=
"attrDesc"
,
required
=
false
)
String
attrDesc
)
{
if
(
StringUtils
.
isBlank
(
id
))
{
if
(
StringUtils
.
isBlank
(
id
))
{
...
@@ -152,4 +155,33 @@ public class AttributesController {
...
@@ -152,4 +155,33 @@ public class AttributesController {
return
R
.
ok
().
put
(
"list"
,
list
);
return
R
.
ok
().
put
(
"list"
,
list
);
}
}
/**
* 新版商品属性(整合旧版)
*
* @param itemId
* @return
*/
@IgnoreAuth
@GetMapping
(
"/queryAttrInfo"
)
@ResponseBody
public
R
queryAttrInfo
(
@RequestParam
(
"itemId"
)
String
itemId
)
{
List
<
TbCfItemParamEntity
>
paramList
=
itemParamService
.
queryParamByItemId
(
itemId
);
// List<String> names = paramList.stream().map(TbCfItemParamEntity::getParamName).collect(Collectors.toList());
Map
<
String
,
String
>
map
=
new
TreeMap
<>(
String
.
CASE_INSENSITIVE_ORDER
);
paramList
.
forEach
(
param
->
map
.
put
(
param
.
getParamName
(),
param
.
getParamValue
()));
List
<
AttributesEntity
>
attributes
=
attributesService
.
queryList
(
null
);
attributes
.
forEach
(
attr
->
{
if
(!
map
.
containsKey
(
attr
.
getAttrName
()))
{
TbCfItemParamEntity
param
=
new
TbCfItemParamEntity
();
param
.
setParamName
(
attr
.
getAttrName
());
paramList
.
add
(
param
);
}
});
return
R
.
ok
().
put
(
"list"
,
paramList
);
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论