Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ufo
/
ufo-platform
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
kun
7 years ago
Commit
a79b9aae89a06b946a949077f5aef76dfff847f8
2 parents
c83e3755
67788c61
Merge remote-tracking branch 'origin/master'
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
11 deletions
common/src/main/java/com/yoho/ufo/util/CollectionUtil.java
dal/src/main/resources/META-INF/mybatis/ProductMapper.xml
dal/src/main/resources/META-INF/mybatis/StoragePriceMapper.xml
product/src/main/java/com/yoho/ufo/service/impl/ProductServiceImpl.java
common/src/main/java/com/yoho/ufo/util/CollectionUtil.java
View file @
a79b9aa
...
...
@@ -160,7 +160,7 @@ public class CollectionUtil {
});
return
r
;
}
/**
* 多个条件分组.
*
...
...
@@ -168,10 +168,10 @@ public class CollectionUtil {
* @param groupKey 多个分组方法
* @return 分组结果
*/
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
/*
@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T, U> Map groupingByMulti(Collection<U> collection, Function<? super U, ?>... groupKey) {
return groupingByMulti(collection.stream(), groupKey);
}
}
*/
/**
* 多个条件分组.
...
...
@@ -180,14 +180,14 @@ public class CollectionUtil {
* @param groupKey 多个分组方法
* @return 分组结果
*/
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
/*
@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T, U> Map groupingByMulti(Stream<U> stearm, Function<? super U, ?>... groupKey) {
Collector c = Collectors.groupingBy(groupKey[groupKey.length - 1]);
for (int i = groupKey.length - 2; i >= 0; i--) {
c = Collectors.groupingBy(groupKey[i], c);
}
return (Map) stearm.collect(c);
}
}
*/
/**
* 多条件排序
...
...
dal/src/main/resources/META-INF/mybatis/ProductMapper.xml
View file @
a79b9aa
...
...
@@ -175,7 +175,7 @@
</update>
<select
id=
"selectProductStorageCount"
resultType=
"java.lang.Integer"
>
select count(*) from
from
product p where
<include
refid=
"skcPageCondition"
/>
select count(*) from product p where
<include
refid=
"skcPageCondition"
/>
</select>
<select
id=
"selectProductStorageList"
resultMap=
"BaseResultMap"
>
...
...
@@ -185,6 +185,7 @@
</select>
<sql
id=
"skcPageCondition"
>
1 = 1
<if
test=
"product.id != null and product.id > 0"
>
and p.id = #{product.id}
</if>
...
...
dal/src/main/resources/META-INF/mybatis/StoragePriceMapper.xml
View file @
a79b9aa
...
...
@@ -120,6 +120,7 @@
</select>
<sql
id=
"skupPageCondition2"
>
1 = 1
<if
test=
"storagePrice.status != null and storagePrice.status > -1"
>
and status = #{storagePrice.status}
</if>
...
...
@@ -141,7 +142,7 @@
select id, skup, product_id, goods_id, storage_id, depot_num, seller_uid, price, status,
update_time, create_time
from storage_price
where
where
product_id in
where product_id in
<foreach
item=
"item"
index=
"index"
collection=
"list"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
and status = 1
...
...
product/src/main/java/com/yoho/ufo/service/impl/ProductServiceImpl.java
View file @
a79b9aa
...
...
@@ -253,8 +253,8 @@ public class ProductServiceImpl implements IProductService {
ProductEditResponceBo
bo
=
new
ProductEditResponceBo
();
BeanUtils
.
copyProperties
(
product
,
bo
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
bo
.
setSaleTime
(
sdf
.
format
((
product
.
getSaleTime
()
==
null
||
product
.
getSaleTime
()
==
0
)
?
""
:
sdf
.
format
(
product
.
getSaleTime
()
*
1000L
)));
bo
.
setSaleTime
((
product
.
getSaleTime
()
==
null
||
product
.
getSaleTime
()
==
0
)
?
""
:
sdf
.
format
(
product
.
getSaleTime
()
*
1000L
));
bo
.
setGender
(
new
Integer
(
product
.
getGender
()));
bo
.
setMinPrice
(
product
.
getMinPrice
().
toString
());
bo
.
setMaxPrice
(
product
.
getMaxPrice
().
toString
());
...
...
@@ -385,12 +385,13 @@ public static void main(String[] args) {
bo
.
getSkup
(),
bo
.
getStart
(),
bo
.
getRows
());
List
<
Integer
>
productIdList
=
CollectionUtil
.
distinct
(
productList
,
Product:
:
getId
);
productList
=
productMapper
.
selectProductListByIds
(
productIdList
);
productList
.
forEach
(
p
->
{
ProductResponceBo
b
=
new
ProductResponceBo
();
BeanUtils
.
copyProperties
(
p
,
b
);
boList
.
add
(
b
);
});
List
<
Integer
>
productIdList
=
CollectionUtil
.
distinct
(
productList
,
Product:
:
getId
);
List
<
Goods
>
goodsList
=
goodsMapper
.
selectByProductId
(
productIdList
);
Map
<
Integer
,
Goods
>
goodsMap
=
CollectionUtil
.
extractMap
(
goodsList
,
Goods:
:
getProductId
);
List
<
Brand
>
brandList
=
brandMapper
.
selectBrandByIdList
(
CollectionUtil
.
distinct
(
productList
,
Product:
:
getBrandId
));
...
...
@@ -463,7 +464,7 @@ public static void main(String[] args) {
bo
.
getStorageId
(),
bo
.
getStart
(),
bo
.
getRows
());
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd
HH:mm:ss
"
);
storagePrice
.
forEach
(
sp
->
{
ProductResponceBo
b
=
new
ProductResponceBo
();
b
.
setSkup
(
sp
.
getSkup
());
...
...
@@ -498,6 +499,9 @@ public static void main(String[] args) {
@Override
public
ApiResponse
<
Void
>
changeProductStatus
(
ProductRequestBo
bo
)
{
if
(
bo
.
getStatus
()
==
null
||
(
bo
.
getStatus
()
!=
1
&&
bo
.
getStatus
()
!=
0
))
{
return
new
ApiResponse
<>(
400
,
"上下架状态错误"
);
}
Product
product
=
productMapper
.
selectByPrimaryKey
(
bo
.
getId
());
if
(
product
==
null
)
{
return
new
ApiResponse
<>(
400
,
"商品不存在"
);
...
...
Please
register
or
login
to post a comment