Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
d14e02e3
Commit
d14e02e3
authored
Aug 12, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页列表随机展示
parent
64c6b1e5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
1 deletion
+54
-1
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/SupplierItemDao.java
...java/com/wwdz/ch/db/dao/distribution/SupplierItemDao.java
+7
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/SupplierItemDaoImpl.java
...com/wwdz/ch/db/impl/distribution/SupplierItemDaoImpl.java
+28
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
...wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
+19
-0
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/SupplierItemDao.java
View file @
d14e02e3
...
@@ -99,4 +99,11 @@ public interface SupplierItemDao {
...
@@ -99,4 +99,11 @@ public interface SupplierItemDao {
*/
*/
boolean
isSupplierIdExisted
(
long
supplierId
,
int
type
);
boolean
isSupplierIdExisted
(
long
supplierId
,
int
type
);
/**
* 查询所有商品的id
* @param supplierItemRequestDto
* @return
*/
List
<
SupplierItem
>
findAllItemId
(
SupplierItemRequestDto
supplierItemRequestDto
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/SupplierItemDaoImpl.java
View file @
d14e02e3
...
@@ -133,6 +133,7 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
...
@@ -133,6 +133,7 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
criteria
.
andTypeIn
(
dto
.
getTypeList
());
criteria
.
andTypeIn
(
dto
.
getTypeList
());
criteria
.
andStockGreaterThan
(
0
);
criteria
.
andStockGreaterThan
(
0
);
criteria
.
andIsDeletedEqualTo
(
false
);
criteria
.
andIsDeletedEqualTo
(
false
);
JdbcHelper
.
ifPresent
(
dto
.
getFilterIds
(),
criteria:
:
andIdNotIn
);
// criteria.andIsOnSaleEqualTo(true);
// criteria.andIsOnSaleEqualTo(true);
if
(!
CollectionUtils
.
isEmpty
(
dto
.
getIds
()))
{
if
(!
CollectionUtils
.
isEmpty
(
dto
.
getIds
()))
{
SupplierItemExample
.
Criteria
orCriteria
=
supplierItemExample
.
or
();
SupplierItemExample
.
Criteria
orCriteria
=
supplierItemExample
.
or
();
...
@@ -142,12 +143,25 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
...
@@ -142,12 +143,25 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
orCriteria
.
andIsDeletedEqualTo
(
false
);
orCriteria
.
andIsDeletedEqualTo
(
false
);
// orCriteria.andIsOnSaleEqualTo(true);
// orCriteria.andIsOnSaleEqualTo(true);
}
}
supplierItemExample
.
setOrderByClause
(
" create_time desc"
);
// supplierItemExample.setOrderByClause(" create_time desc");
supplierItemExample
.
setOrderByClause
(
" rand() "
);
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getLimit
());
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getLimit
());
return
supplierItemMapper
.
selectByExampleWithBLOBs
(
supplierItemExample
);
return
supplierItemMapper
.
selectByExampleWithBLOBs
(
supplierItemExample
);
}
}
/* public List<SupplierItem> findForHomePage(SupplierItemRequestDto dto) {
SupplierItemExample supplierItemExample = new SupplierItemExample();
SupplierItemExample.Criteria criteria = supplierItemExample.createCriteria();
criteria.andCreatorIdIn(dto.getCreatorIdList());
criteria.andTypeIn(dto.getTypeList());
criteria.andStockGreaterThan(0);
criteria.andIsDeletedEqualTo(false);
JdbcHelper.ifPresent(dto.getIds(), criteria::andIdIn);
return supplierItemMapper.selectByExampleWithBLOBs(supplierItemExample);
}*/
@Override
@Override
public
long
countByCreatorId
(
long
creatorId
)
{
public
long
countByCreatorId
(
long
creatorId
)
{
SupplierItemExample
supplierItemExample
=
new
SupplierItemExample
();
SupplierItemExample
supplierItemExample
=
new
SupplierItemExample
();
...
@@ -218,4 +232,17 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
...
@@ -218,4 +232,17 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
criteria
.
andIsDeletedEqualTo
(
false
);
criteria
.
andIsDeletedEqualTo
(
false
);
return
supplierItemMapper
.
countByExample
(
supplierItemExample
)
>
0
;
return
supplierItemMapper
.
countByExample
(
supplierItemExample
)
>
0
;
}
}
@Override
public
List
<
SupplierItem
>
findAllItemId
(
SupplierItemRequestDto
dto
)
{
SupplierItemExample
supplierItemExample
=
new
SupplierItemExample
();
SupplierItemExample
.
Criteria
criteria
=
supplierItemExample
.
createCriteria
();
criteria
.
andCreatorIdIn
(
dto
.
getCreatorIdList
());
criteria
.
andTypeIn
(
dto
.
getTypeList
());
criteria
.
andStockGreaterThan
(
0
);
criteria
.
andIsDeletedEqualTo
(
false
);
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getLimit
());
return
supplierItemMapper
.
selectByExampleSelective
(
supplierItemExample
,
SupplierItem
.
Column
.
id
);
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
View file @
d14e02e3
...
@@ -1151,8 +1151,24 @@ public class SupplierItemServiceImpl implements SupplierItemService {
...
@@ -1151,8 +1151,24 @@ public class SupplierItemServiceImpl implements SupplierItemService {
searchDto
.
setStock
(
0
);
//库存大于0
searchDto
.
setStock
(
0
);
//库存大于0
searchDto
.
setPage
(
dto
.
getPage
());
searchDto
.
setPage
(
dto
.
getPage
());
searchDto
.
setLimit
(
dto
.
getLimit
());
searchDto
.
setLimit
(
dto
.
getLimit
());
String
viewKey
=
userId
+
":homepage"
;
if
(
dto
.
getPage
()
==
1
)
{
redisUtils
.
delete
(
viewKey
);
}
if
(
redisUtils
.
hasKey
(
viewKey
))
{
List
<
Long
>
searchItemIds
=
(
List
<
Long
>)
redisUtils
.
get
(
viewKey
);
searchDto
.
setFilterIds
(
searchItemIds
);
}
List
<
SupplierItem
>
supplierItemList
=
supplierItemDao
.
findForHomePage
(
searchDto
);
List
<
SupplierItem
>
supplierItemList
=
supplierItemDao
.
findForHomePage
(
searchDto
);
PageInfo
<
SupplierItem
>
pageInfo
=
new
PageInfo
(
supplierItemList
);
PageInfo
<
SupplierItem
>
pageInfo
=
new
PageInfo
(
supplierItemList
);
List
<
Long
>
filterItemIds
=
supplierItemList
.
stream
().
map
(
SupplierItem:
:
getId
).
collect
(
Collectors
.
toList
());
if
(
redisUtils
.
hasKey
(
viewKey
))
{
List
<
Long
>
searchItemIds
=
(
List
<
Long
>)
redisUtils
.
get
(
viewKey
);
searchItemIds
.
addAll
(
filterItemIds
);
redisUtils
.
set
(
viewKey
,
searchItemIds
);
}
else
{
redisUtils
.
set
(
viewKey
,
filterItemIds
);
}
Date
now
=
new
Date
();
Date
now
=
new
Date
();
supplierItemList
.
forEach
(
supplierItem
->
{
supplierItemList
.
forEach
(
supplierItem
->
{
SupplierItemVo
supplierItemVo
=
new
SupplierItemVo
();
SupplierItemVo
supplierItemVo
=
new
SupplierItemVo
();
...
@@ -1284,4 +1300,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
...
@@ -1284,4 +1300,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
}
}
return
null
;
return
null
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment