Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
C
chinafrica
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
chinafrica
Commits
69a0a048
提交
69a0a048
authored
12月 25, 2020
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
属性管理
上级
59aa44e2
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
134 行增加
和
57 行删除
+134
-57
AttributesController.java
...in/java/com/platform/controller/AttributesController.java
+48
-11
AttributesDescDao.java
...min/src/main/java/com/platform/dao/AttributesDescDao.java
+2
-0
TbCfItemParamEntity.java
...rc/main/java/com/platform/entity/TbCfItemParamEntity.java
+13
-0
AttributesDescService.java
...main/java/com/platform/service/AttributesDescService.java
+2
-0
AttributesService.java
...src/main/java/com/platform/service/AttributesService.java
+2
-0
AttributesDescServiceImpl.java
.../com/platform/service/impl/AttributesDescServiceImpl.java
+5
-0
AttributesDescDao.xml
...src/main/resources/com/platform/dao/AttributesDescDao.xml
+62
-46
没有找到文件。
platform-admin/src/main/java/com/platform/controller/AttributesController.java
浏览文件 @
69a0a048
...
...
@@ -276,18 +276,55 @@ public class AttributesController {
// });
//===================================================================================================
//查询商品的属性
// //属性值
// List<String> names = paramList.stream().filter(t -> StringUtils.isBlank(t.getAttrId())).map(TbCfItemParamEntity::getParamName).collect(Collectors.toList());
// //所有的属性
// List<AttributesEntity> allAttributes = attributesService.queryList(null);
// //属性值
// List<String> list = allAttributes.stream().map(AttributesEntity::getAttrName).collect(Collectors.toList());
// //所有属性与商品属性的差集
// List<String> collect = list.stream().filter(attr -> !names.contains(attr)).collect(Collectors.toList());
// collect.forEach(c -> {
// //追加新的属性
// AttributesEntity attributes = attributesService.queryByAttrName(c);
// TbCfItemParamEntity param = new TbCfItemParamEntity();
// param.setParamName(attributes.getAttrName());
// param.setAttrId(attributes.getId());
// paramList.add(param);
// });
List
<
TbCfItemParamEntity
>
paramList
=
itemParamService
.
queryParamByItemId
(
itemId
);
List
<
String
>
names
=
paramList
.
stream
()
/*.filter(t -> StringUtils.isBlank(t.getAttrId()))*/
.
map
(
TbCfItemParamEntity:
:
getParamName
).
collect
(
Collectors
.
toList
());
List
<
AttributesEntity
>
allAttributes
=
attributesService
.
queryList
(
null
);
List
<
String
>
list
=
allAttributes
.
stream
().
map
(
AttributesEntity:
:
getAttrName
).
collect
(
Collectors
.
toList
());
List
<
String
>
collect
=
list
.
stream
().
filter
(
attr
->
!
names
.
contains
(
attr
)).
collect
(
Collectors
.
toList
());
collect
.
forEach
(
c
->
{
AttributesEntity
attributes
=
attributesService
.
queryByAttrName
(
c
);
TbCfItemParamEntity
param
=
new
TbCfItemParamEntity
();
param
.
setParamName
(
attributes
.
getAttrName
());
param
.
setAttrId
(
attributes
.
getId
());
paramList
.
add
(
param
);
paramList
.
forEach
(
param
->
{
AttributesEntity
attr
=
attributesService
.
queryObject
(
param
.
getAttrId
());
if
(
attr
!=
null
)
{
param
.
setAttrId
(
attr
.
getId
());
param
.
setParamName
(
attr
.
getAttrName
());
if
(!
StringUtils
.
isBlank
(
param
.
getAttrDescId
()))
{
String
[]
arr
=
param
.
getAttrDescId
().
split
(
","
);
List
<
AttributesDescEntity
>
descEntities
=
attributesDescService
.
queryDescByIds
(
arr
);
List
<
AttributesDescVo
>
list
=
new
ArrayList
<>();
descEntities
.
forEach
(
desc
->
{
AttributesDescVo
attVo
=
new
AttributesDescVo
();
param
.
setAttrDescId
(
desc
.
getAttrDescId
());
String
value
=
desc
.
getAttrValue
();
attVo
.
setAttrDescId
(
desc
.
getAttrDescId
());
if
(!
StringUtils
.
isBlank
(
desc
.
getAttrDesc
()))
{
value
=
value
+
"("
+
desc
.
getAttrDesc
()
+
")"
;
}
attVo
.
setAttrValue
(
value
);
list
.
add
(
attVo
);
});
param
.
setList
(
list
);
}
}
});
paramList
.
forEach
(
p
->
{
p
.
setParamName
(
null
);
p
.
setParamValue
(
null
);
});
return
R
.
ok
().
put
(
"list"
,
paramList
);
...
...
platform-admin/src/main/java/com/platform/dao/AttributesDescDao.java
浏览文件 @
69a0a048
...
...
@@ -14,5 +14,7 @@ public interface AttributesDescDao extends BaseDao<AttributesDescEntity> {
List
<
AttributesDescEntity
>
queryByAttrId
(
String
id
);
List
<
AttributesDescEntity
>
queryDescByIds
(
String
[]
ids
);
}
platform-admin/src/main/java/com/platform/entity/TbCfItemParamEntity.java
浏览文件 @
69a0a048
package
com
.
platform
.
entity
;
import
com.platform.vo.AttributesDescVo
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* 商品参数实体
...
...
@@ -46,6 +49,16 @@ public class TbCfItemParamEntity implements Serializable {
*/
private
String
attrDescId
;
private
List
<
AttributesDescVo
>
list
;
public
List
<
AttributesDescVo
>
getList
()
{
return
list
;
}
public
void
setList
(
List
<
AttributesDescVo
>
list
)
{
this
.
list
=
list
;
}
/**
* 设置:商品参数ID
*/
...
...
platform-admin/src/main/java/com/platform/service/AttributesDescService.java
浏览文件 @
69a0a048
...
...
@@ -70,4 +70,6 @@ public interface AttributesDescService {
int
deleteBatch
(
String
[]
attrDescIds
);
List
<
AttributesDescEntity
>
queryByAttrId
(
String
id
);
List
<
AttributesDescEntity
>
queryDescByIds
(
String
[]
ids
);
}
platform-admin/src/main/java/com/platform/service/AttributesService.java
浏览文件 @
69a0a048
...
...
@@ -73,4 +73,6 @@ public interface AttributesService {
List
<
AttributesExtends
>
queryAttributesList
(
Map
<
String
,
Object
>
map
);
AttributesEntity
queryByAttrName
(
String
name
);
}
platform-admin/src/main/java/com/platform/service/impl/AttributesDescServiceImpl.java
浏览文件 @
69a0a048
...
...
@@ -61,4 +61,9 @@ public class AttributesDescServiceImpl implements AttributesDescService {
public
List
<
AttributesDescEntity
>
queryByAttrId
(
String
id
)
{
return
attributesDescDao
.
queryByAttrId
(
id
);
}
@Override
public
List
<
AttributesDescEntity
>
queryDescByIds
(
String
[]
ids
)
{
return
attributesDescDao
.
queryDescByIds
(
ids
);
}
}
platform-admin/src/main/resources/com/platform/dao/AttributesDescDao.xml
浏览文件 @
69a0a048
...
...
@@ -13,7 +13,7 @@
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
<select
id=
"queryObject"
resultType=
"com.platform.entity.AttributesDescEntity"
>
<select
id=
"queryObject"
resultType=
"com.platform.entity.AttributesDescEntity"
>
select
`attr_desc_id`,
`attr_id`,
...
...
@@ -26,7 +26,23 @@
where attr_desc_id = #{id}
</select>
<select
id=
"queryByAttrId"
resultType=
"com.platform.entity.AttributesDescEntity"
>
<select
id=
"queryDescByIds"
resultType=
"com.platform.entity.AttributesDescEntity"
>
select
`attr_desc_id`,
`attr_id`,
`attr_value`,
`attr_desc`,
`status`,
`create_time`,
`update_time`
from attributes_desc
where attr_desc_id in
<foreach
item=
"attrDescId"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{attrDescId}
</foreach>
</select>
<select
id=
"queryByAttrId"
resultType=
"com.platform.entity.AttributesDescEntity"
>
select
`attr_desc_id`,
`attr_id`,
...
...
@@ -39,42 +55,42 @@
where attr_id = #{id}
</select>
<select
id=
"queryList"
resultType=
"com.platform.entity.AttributesDescEntity"
>
select
`attr_desc_id`,
`attr_id`,
`attr_value`,
`attr_desc`,
`status`,
`create_time`,
`update_time`
from attributes_desc
WHERE 1=1
<if
test=
"name != null and name.trim() != ''"
>
AND name LIKE concat('%',#{name},'%')
</if>
<select
id=
"queryList"
resultType=
"com.platform.entity.AttributesDescEntity"
>
select
`attr_desc_id`,
`attr_id`,
`attr_value`,
`attr_desc`,
`status`,
`create_time`,
`update_time`
from attributes_desc
WHERE 1=1
<if
test=
"name != null and name.trim() != ''"
>
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when
test=
"sidx != null and sidx.trim() != ''"
>
order by ${sidx} ${order}
</when>
<otherwise>
<otherwise>
order by attr_desc_id desc
</otherwise>
</otherwise>
</choose>
<if
test=
"offset != null and limit != null"
>
limit #{offset}, #{limit}
</if>
</select>
<if
test=
"offset != null and limit != null"
>
limit #{offset}, #{limit}
</if>
</select>
<select
id=
"queryTotal"
resultType=
"int"
>
select count(*) from attributes_desc
WHERE 1=1
<select
id=
"queryTotal"
resultType=
"int"
>
select count(*) from attributes_desc
WHERE 1=1
<if
test=
"name != null and name.trim() != ''"
>
AND name LIKE concat('%',#{name},'%')
</if>
</select>
</select>
<insert
id=
"save"
parameterType=
"com.platform.entity.AttributesDescEntity"
>
<insert
id=
"save"
parameterType=
"com.platform.entity.AttributesDescEntity"
>
insert into attributes_desc(
`attr_desc_id`,
`attr_id`,
...
...
@@ -93,28 +109,28 @@
#{updateTime})
</insert>
<update
id=
"update"
parameterType=
"com.platform.entity.AttributesDescEntity"
>
update attributes_desc
<set>
<if
test=
"attrId != null"
>
`attr_id` = #{attrId},
</if>
<if
test=
"attrValue != null"
>
`attr_value` = #{attrValue},
</if>
<if
test=
"attrDesc != null"
>
`attr_desc` = #{attrDesc},
</if>
<if
test=
"status != null"
>
`status` = #{status},
</if>
<if
test=
"createTime != null"
>
`create_time` = #{createTime},
</if>
<if
test=
"updateTime != null"
>
`update_time` = #{updateTime}
</if>
</set>
where attr_desc_id = #{attrDescId}
</update>
<update
id=
"update"
parameterType=
"com.platform.entity.AttributesDescEntity"
>
update attributes_desc
<set>
<if
test=
"attrId != null"
>
`attr_id` = #{attrId},
</if>
<if
test=
"attrValue != null"
>
`attr_value` = #{attrValue},
</if>
<if
test=
"attrDesc != null"
>
`attr_desc` = #{attrDesc},
</if>
<if
test=
"status != null"
>
`status` = #{status},
</if>
<if
test=
"createTime != null"
>
`create_time` = #{createTime},
</if>
<if
test=
"updateTime != null"
>
`update_time` = #{updateTime}
</if>
</set>
where attr_desc_id = #{attrDescId}
</update>
<delete
id=
"delete"
>
<delete
id=
"delete"
>
delete from attributes_desc where attr_desc_id = #{value}
</delete>
<delete
id=
"deleteBatch"
>
delete from attributes_desc where attr_desc_id in
<foreach
item=
"attrDescId"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{attrDescId}
</foreach>
</delete>
<delete
id=
"deleteBatch"
>
delete from attributes_desc where attr_desc_id in
<foreach
item=
"attrDescId"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{attrDescId}
</foreach>
</delete>
</mapper>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论