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
0eb9817c
Commit
0eb9817c
authored
Jul 24, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
0a8e0c89
bbf82a07
Changes
27
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
1715 additions
and
289 deletions
+1715
-289
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesItemsRelationMapper.java
...java/com/wwdz/ch/db/dao/FavoritesItemsRelationMapper.java
+53
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesMapper.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesMapper.java
+2
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/UsersItemsRelationMapper.java
...ain/java/com/wwdz/ch/db/dao/UsersItemsRelationMapper.java
+52
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/Favorites.java
ch-dao/src/main/java/com/wwdz/ch/db/domain/Favorites.java
+8
-7
ch-dao/src/main/java/com/wwdz/ch/db/domain/FavoritesExample.java
...src/main/java/com/wwdz/ch/db/domain/FavoritesExample.java
+36
-36
ch-dao/src/main/java/com/wwdz/ch/db/domain/FavoritesItemsRelation.java
...in/java/com/wwdz/ch/db/domain/FavoritesItemsRelation.java
+34
-24
ch-dao/src/main/java/com/wwdz/ch/db/domain/FavoritesItemsRelationExample.java
.../com/wwdz/ch/db/domain/FavoritesItemsRelationExample.java
+204
-71
ch-dao/src/main/java/com/wwdz/ch/db/domain/UsersItemsRelation.java
...c/main/java/com/wwdz/ch/db/domain/UsersItemsRelation.java
+239
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/UsersItemsRelationExample.java
...java/com/wwdz/ch/db/domain/UsersItemsRelationExample.java
+566
-0
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/CoinRequestDto.java
.../main/java/com/wwdz/ch/db/dto/request/CoinRequestDto.java
+5
-0
ch-dao/src/main/java/com/wwdz/ch/db/manager/FavoritesItemsRelationManager.java
...com/wwdz/ch/db/manager/FavoritesItemsRelationManager.java
+15
-0
ch-dao/src/main/java/com/wwdz/ch/db/manager/FavoritesManager.java
...rc/main/java/com/wwdz/ch/db/manager/FavoritesManager.java
+2
-2
ch-dao/src/main/java/com/wwdz/ch/db/manager/ItemManager.java
ch-dao/src/main/java/com/wwdz/ch/db/manager/ItemManager.java
+2
-0
ch-dao/src/main/java/com/wwdz/ch/db/manager/UsersItemsRelationManager.java
...ava/com/wwdz/ch/db/manager/UsersItemsRelationManager.java
+9
-0
ch-dao/src/main/java/com/wwdz/ch/db/manager/impl/FavoritesCoinsRelationManagerImpl.java
...ch/db/manager/impl/FavoritesCoinsRelationManagerImpl.java
+0
-59
ch-dao/src/main/java/com/wwdz/ch/db/manager/impl/FavoritesItemsRelationManagerImpl.java
...ch/db/manager/impl/FavoritesItemsRelationManagerImpl.java
+61
-0
ch-dao/src/main/java/com/wwdz/ch/db/manager/impl/FavoritesManagerImpl.java
...ava/com/wwdz/ch/db/manager/impl/FavoritesManagerImpl.java
+7
-10
ch-dao/src/main/java/com/wwdz/ch/db/manager/impl/ItemManagerImpl.java
...ain/java/com/wwdz/ch/db/manager/impl/ItemManagerImpl.java
+13
-0
ch-dao/src/main/java/com/wwdz/ch/db/manager/impl/UsersItemsRelationManagerImpl.java
...wdz/ch/db/manager/impl/UsersItemsRelationManagerImpl.java
+26
-0
ch-dao/src/main/resources/com/wwdz/ch/db/dao/FavoritesItemsRelationMapper.xml
...urces/com/wwdz/ch/db/dao/FavoritesItemsRelationMapper.xml
+46
-33
ch-dao/src/main/resources/com/wwdz/ch/db/dao/FavoritesMapper.xml
...src/main/resources/com/wwdz/ch/db/dao/FavoritesMapper.xml
+22
-22
ch-dao/src/main/resources/com/wwdz/ch/db/dao/UsersItemsRelationMapper.xml
...resources/com/wwdz/ch/db/dao/UsersItemsRelationMapper.xml
+215
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/request/FavoritesItemRequestDto.java
...om/wwdz/ch/wx/entity/request/FavoritesItemRequestDto.java
+15
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/request/FavoritesRequestDto.java
...va/com/wwdz/ch/wx/entity/request/FavoritesRequestDto.java
+3
-5
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FavoritesService.java
...rc/main/java/com/wwdz/ch/wx/service/FavoritesService.java
+3
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/impl/FavoritesServiceImpl.java
...ava/com/wwdz/ch/wx/service/impl/FavoritesServiceImpl.java
+65
-20
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
...c/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
+12
-0
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/dao/Favorites
Coin
sRelationMapper.java
→
ch-dao/src/main/java/com/wwdz/ch/db/dao/Favorites
Item
sRelationMapper.java
View file @
0eb9817c
package
com.wwdz.ch.db.dao
;
import
com.wwdz.ch.db.domain.FavoritesCoinsRelation
;
import
com.wwdz.ch.db.domain.FavoritesCoinsRelationExample
;
import
java.util.List
;
import
com.wwdz.ch.db.domain.FavoritesItemsRelation
;
import
com.wwdz.ch.db.domain.FavoritesItemsRelationExample
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
@Mapper
public
interface
FavoritesCoinsRelationMapper
{
long
countByExample
(
FavoritesCoinsRelationExample
example
);
import
java.util.List
;
int
deleteByExample
(
FavoritesCoinsRelationExample
example
);
@Mapper
public
interface
FavoritesItemsRelationMapper
{
long
countByExample
(
FavoritesItemsRelationExample
example
);
int
insert
(
FavoritesCoinsRelation
record
);
int
deleteByExample
(
FavoritesItemsRelationExample
example
);
int
batchInsert
(
List
<
FavoritesCoinsRelation
>
list
);
int
insert
(
FavoritesItemsRelation
record
);
int
insertSelective
(
FavoritesCoinsRelation
record
);
int
batchInsert
(
List
<
FavoritesItemsRelation
>
list
);
int
insertSelective
(
FavoritesItemsRelation
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table favorites_
coin
s_relation
* This method corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Favorites
CoinsRelation
selectOneByExample
(
FavoritesCoin
sRelationExample
example
);
Favorites
ItemsRelation
selectOneByExample
(
FavoritesItem
sRelationExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table favorites_
coin
s_relation
* This method corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Favorites
CoinsRelation
selectOneByExampleSelective
(
@Param
(
"example"
)
FavoritesCoinsRelationExample
example
,
@Param
(
"selective"
)
FavoritesCoin
sRelation
.
Column
...
selective
);
Favorites
ItemsRelation
selectOneByExampleSelective
(
@Param
(
"example"
)
FavoritesItemsRelationExample
example
,
@Param
(
"selective"
)
FavoritesItem
sRelation
.
Column
...
selective
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table favorites_
coin
s_relation
* This method corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List
<
Favorites
CoinsRelation
>
selectByExampleSelective
(
@Param
(
"example"
)
FavoritesCoinsRelationExample
example
,
@Param
(
"selective"
)
FavoritesCoin
sRelation
.
Column
...
selective
);
List
<
Favorites
ItemsRelation
>
selectByExampleSelective
(
@Param
(
"example"
)
FavoritesItemsRelationExample
example
,
@Param
(
"selective"
)
FavoritesItem
sRelation
.
Column
...
selective
);
List
<
Favorites
CoinsRelation
>
selectByExample
(
FavoritesCoin
sRelationExample
example
);
List
<
Favorites
ItemsRelation
>
selectByExample
(
FavoritesItem
sRelationExample
example
);
int
updateByExampleSelective
(
@Param
(
"record"
)
Favorites
CoinsRelation
record
,
@Param
(
"example"
)
FavoritesCoin
sRelationExample
example
);
int
updateByExampleSelective
(
@Param
(
"record"
)
Favorites
ItemsRelation
record
,
@Param
(
"example"
)
FavoritesItem
sRelationExample
example
);
int
updateByExample
(
@Param
(
"record"
)
Favorites
CoinsRelation
record
,
@Param
(
"example"
)
FavoritesCoin
sRelationExample
example
);
int
updateByExample
(
@Param
(
"record"
)
Favorites
ItemsRelation
record
,
@Param
(
"example"
)
FavoritesItem
sRelationExample
example
);
}
\ No newline at end of file
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesMapper.java
View file @
0eb9817c
...
...
@@ -2,6 +2,8 @@ package com.wwdz.ch.db.dao;
import
com.wwdz.ch.db.domain.Favorites
;
import
com.wwdz.ch.db.domain.FavoritesExample
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dao/UsersItemsRelationMapper.java
0 → 100644
View file @
0eb9817c
package
com.wwdz.ch.db.dao
;
import
com.wwdz.ch.db.domain.UsersItemsRelation
;
import
com.wwdz.ch.db.domain.UsersItemsRelationExample
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
@Mapper
public
interface
UsersItemsRelationMapper
{
long
countByExample
(
UsersItemsRelationExample
example
);
int
deleteByExample
(
UsersItemsRelationExample
example
);
int
insert
(
UsersItemsRelation
record
);
int
insertSelective
(
UsersItemsRelation
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UsersItemsRelation
selectOneByExample
(
UsersItemsRelationExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UsersItemsRelation
selectOneByExampleSelective
(
@Param
(
"example"
)
UsersItemsRelationExample
example
,
@Param
(
"selective"
)
UsersItemsRelation
.
Column
...
selective
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List
<
UsersItemsRelation
>
selectByExampleSelective
(
@Param
(
"example"
)
UsersItemsRelationExample
example
,
@Param
(
"selective"
)
UsersItemsRelation
.
Column
...
selective
);
List
<
UsersItemsRelation
>
selectByExample
(
UsersItemsRelationExample
example
);
int
updateByExampleSelective
(
@Param
(
"record"
)
UsersItemsRelation
record
,
@Param
(
"example"
)
UsersItemsRelationExample
example
);
int
updateByExample
(
@Param
(
"record"
)
UsersItemsRelation
record
,
@Param
(
"example"
)
UsersItemsRelationExample
example
);
}
\ No newline at end of file
ch-dao/src/main/java/com/wwdz/ch/db/domain/Favorites.java
View file @
0eb9817c
package
com.wwdz.ch.db.domain
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
lombok.Data
;
/**
* @author shiyu
* @date 2023/07/
18
* @date 2023/07/
21
*/
@Data
public
class
Favorites
implements
Serializable
{
...
...
@@ -35,7 +36,7 @@ public class Favorites implements Serializable {
/**
* 用户id
*/
private
Long
u
i
d
;
private
Long
u
serI
d
;
/**
* 标题
...
...
@@ -76,7 +77,7 @@ public class Favorites implements Serializable {
sb
.
append
(
" ["
);
sb
.
append
(
"Hash = "
).
append
(
hashCode
());
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", u
id="
).
append
(
ui
d
);
sb
.
append
(
", u
serId="
).
append
(
userI
d
);
sb
.
append
(
", title="
).
append
(
title
);
sb
.
append
(
", description="
).
append
(
description
);
sb
.
append
(
", addTime="
).
append
(
addTime
);
...
...
@@ -101,7 +102,7 @@ public class Favorites implements Serializable {
}
Favorites
other
=
(
Favorites
)
that
;
return
(
this
.
getId
()
==
null
?
other
.
getId
()
==
null
:
this
.
getId
().
equals
(
other
.
getId
()))
&&
(
this
.
getU
id
()
==
null
?
other
.
getUid
()
==
null
:
this
.
getUid
().
equals
(
other
.
getUi
d
()))
&&
(
this
.
getU
serId
()
==
null
?
other
.
getUserId
()
==
null
:
this
.
getUserId
().
equals
(
other
.
getUserI
d
()))
&&
(
this
.
getTitle
()
==
null
?
other
.
getTitle
()
==
null
:
this
.
getTitle
().
equals
(
other
.
getTitle
()))
&&
(
this
.
getDescription
()
==
null
?
other
.
getDescription
()
==
null
:
this
.
getDescription
().
equals
(
other
.
getDescription
()))
&&
(
this
.
getAddTime
()
==
null
?
other
.
getAddTime
()
==
null
:
this
.
getAddTime
().
equals
(
other
.
getAddTime
()))
...
...
@@ -115,7 +116,7 @@ public class Favorites implements Serializable {
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
getId
()
==
null
)
?
0
:
getId
().
hashCode
());
result
=
prime
*
result
+
((
getU
id
()
==
null
)
?
0
:
getUi
d
().
hashCode
());
result
=
prime
*
result
+
((
getU
serId
()
==
null
)
?
0
:
getUserI
d
().
hashCode
());
result
=
prime
*
result
+
((
getTitle
()
==
null
)
?
0
:
getTitle
().
hashCode
());
result
=
prime
*
result
+
((
getDescription
()
==
null
)
?
0
:
getDescription
().
hashCode
());
result
=
prime
*
result
+
((
getAddTime
()
==
null
)
?
0
:
getAddTime
().
hashCode
());
...
...
@@ -145,7 +146,7 @@ public class Favorites implements Serializable {
*/
public
enum
Column
{
id
(
"id"
,
"id"
,
"BIGINT"
,
false
),
u
id
(
"uid"
,
"uid"
,
"BIGINT"
,
tru
e
),
u
serId
(
"user_id"
,
"userId"
,
"BIGINT"
,
fals
e
),
title
(
"title"
,
"title"
,
"VARCHAR"
,
false
),
description
(
"description"
,
"description"
,
"VARCHAR"
,
false
),
addTime
(
"add_time"
,
"addTime"
,
"TIMESTAMP"
,
false
),
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/FavoritesExample.java
View file @
0eb9817c
...
...
@@ -280,18 +280,18 @@ public class FavoritesExample {
return
(
Criteria
)
this
;
}
public
Criteria
andU
i
dIsNull
()
{
addCriterion
(
"
`uid`
is null"
);
public
Criteria
andU
serI
dIsNull
()
{
addCriterion
(
"
user_id
is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andU
i
dIsNotNull
()
{
addCriterion
(
"
`uid`
is not null"
);
public
Criteria
andU
serI
dIsNotNull
()
{
addCriterion
(
"
user_id
is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andU
i
dEqualTo
(
Long
value
)
{
addCriterion
(
"
`uid` ="
,
value
,
"ui
d"
);
public
Criteria
andU
serI
dEqualTo
(
Long
value
)
{
addCriterion
(
"
user_id ="
,
value
,
"userI
d"
);
return
(
Criteria
)
this
;
}
...
...
@@ -302,13 +302,13 @@ public class FavoritesExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andU
i
dEqualToColumn
(
Favorites
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"
`uid`
= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
public
Criteria
andU
serI
dEqualToColumn
(
Favorites
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"
user_id
= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andU
i
dNotEqualTo
(
Long
value
)
{
addCriterion
(
"
`uid` <>"
,
value
,
"ui
d"
);
public
Criteria
andU
serI
dNotEqualTo
(
Long
value
)
{
addCriterion
(
"
user_id <>"
,
value
,
"userI
d"
);
return
(
Criteria
)
this
;
}
...
...
@@ -319,13 +319,13 @@ public class FavoritesExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andU
i
dNotEqualToColumn
(
Favorites
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"
`uid`
<> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
public
Criteria
andU
serI
dNotEqualToColumn
(
Favorites
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"
user_id
<> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andU
i
dGreaterThan
(
Long
value
)
{
addCriterion
(
"
`uid` >"
,
value
,
"ui
d"
);
public
Criteria
andU
serI
dGreaterThan
(
Long
value
)
{
addCriterion
(
"
user_id >"
,
value
,
"userI
d"
);
return
(
Criteria
)
this
;
}
...
...
@@ -336,13 +336,13 @@ public class FavoritesExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andU
i
dGreaterThanColumn
(
Favorites
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"
`uid`
> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
public
Criteria
andU
serI
dGreaterThanColumn
(
Favorites
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"
user_id
> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andU
i
dGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"
`uid` >="
,
value
,
"ui
d"
);
public
Criteria
andU
serI
dGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"
user_id >="
,
value
,
"userI
d"
);
return
(
Criteria
)
this
;
}
...
...
@@ -353,13 +353,13 @@ public class FavoritesExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andU
i
dGreaterThanOrEqualToColumn
(
Favorites
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"
`uid`
>= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
public
Criteria
andU
serI
dGreaterThanOrEqualToColumn
(
Favorites
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"
user_id
>= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andU
i
dLessThan
(
Long
value
)
{
addCriterion
(
"
`uid` <"
,
value
,
"ui
d"
);
public
Criteria
andU
serI
dLessThan
(
Long
value
)
{
addCriterion
(
"
user_id <"
,
value
,
"userI
d"
);
return
(
Criteria
)
this
;
}
...
...
@@ -370,13 +370,13 @@ public class FavoritesExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andU
i
dLessThanColumn
(
Favorites
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"
`uid`
< "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
public
Criteria
andU
serI
dLessThanColumn
(
Favorites
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"
user_id
< "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andU
i
dLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"
`uid` <="
,
value
,
"ui
d"
);
public
Criteria
andU
serI
dLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"
user_id <="
,
value
,
"userI
d"
);
return
(
Criteria
)
this
;
}
...
...
@@ -387,28 +387,28 @@ public class FavoritesExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andU
i
dLessThanOrEqualToColumn
(
Favorites
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"
`uid`
<= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
public
Criteria
andU
serI
dLessThanOrEqualToColumn
(
Favorites
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"
user_id
<= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andU
i
dIn
(
List
<
Long
>
values
)
{
addCriterion
(
"
`uid` in"
,
values
,
"ui
d"
);
public
Criteria
andU
serI
dIn
(
List
<
Long
>
values
)
{
addCriterion
(
"
user_id in"
,
values
,
"userI
d"
);
return
(
Criteria
)
this
;
}
public
Criteria
andU
i
dNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"
`uid` not in"
,
values
,
"ui
d"
);
public
Criteria
andU
serI
dNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"
user_id not in"
,
values
,
"userI
d"
);
return
(
Criteria
)
this
;
}
public
Criteria
andU
i
dBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"
`uid` between"
,
value1
,
value2
,
"ui
d"
);
public
Criteria
andU
serI
dBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"
user_id between"
,
value1
,
value2
,
"userI
d"
);
return
(
Criteria
)
this
;
}
public
Criteria
andU
i
dNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"
`uid` not between"
,
value1
,
value2
,
"ui
d"
);
public
Criteria
andU
serI
dNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"
user_id not between"
,
value1
,
value2
,
"userI
d"
);
return
(
Criteria
)
this
;
}
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/Favorites
Coin
sRelation.java
→
ch-dao/src/main/java/com/wwdz/ch/db/domain/Favorites
Item
sRelation.java
View file @
0eb9817c
...
...
@@ -3,14 +3,15 @@ package com.wwdz.ch.db.domain;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
lombok.Data
;
/**
* @author shiyu
* @date 2023/07/
18
* @date 2023/07/
21
*/
@Data
public
class
Favorites
Coin
sRelation
implements
Serializable
{
public
class
Favorites
Item
sRelation
implements
Serializable
{
/**
* 收藏册id
*/
...
...
@@ -19,7 +20,12 @@ public class FavoritesCoinsRelation implements Serializable {
/**
* 钱币id
*/
private
Long
coinsId
;
private
Long
itemId
;
/**
* 创建时间
*/
private
Date
addTime
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -30,7 +36,8 @@ public class FavoritesCoinsRelation implements Serializable {
sb
.
append
(
" ["
);
sb
.
append
(
"Hash = "
).
append
(
hashCode
());
sb
.
append
(
", favoritesId="
).
append
(
favoritesId
);
sb
.
append
(
", coinsId="
).
append
(
coinsId
);
sb
.
append
(
", itemId="
).
append
(
itemId
);
sb
.
append
(
", addTime="
).
append
(
addTime
);
sb
.
append
(
", serialVersionUID="
).
append
(
serialVersionUID
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
...
...
@@ -47,9 +54,10 @@ public class FavoritesCoinsRelation implements Serializable {
if
(
getClass
()
!=
that
.
getClass
())
{
return
false
;
}
Favorites
CoinsRelation
other
=
(
FavoritesCoin
sRelation
)
that
;
Favorites
ItemsRelation
other
=
(
FavoritesItem
sRelation
)
that
;
return
(
this
.
getFavoritesId
()
==
null
?
other
.
getFavoritesId
()
==
null
:
this
.
getFavoritesId
().
equals
(
other
.
getFavoritesId
()))
&&
(
this
.
getCoinsId
()
==
null
?
other
.
getCoinsId
()
==
null
:
this
.
getCoinsId
().
equals
(
other
.
getCoinsId
()));
&&
(
this
.
getItemId
()
==
null
?
other
.
getItemId
()
==
null
:
this
.
getItemId
().
equals
(
other
.
getItemId
()))
&&
(
this
.
getAddTime
()
==
null
?
other
.
getAddTime
()
==
null
:
this
.
getAddTime
().
equals
(
other
.
getAddTime
()));
}
@Override
...
...
@@ -57,24 +65,26 @@ public class FavoritesCoinsRelation implements Serializable {
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
getFavoritesId
()
==
null
)
?
0
:
getFavoritesId
().
hashCode
());
result
=
prime
*
result
+
((
getCoinsId
()
==
null
)
?
0
:
getCoinsId
().
hashCode
());
result
=
prime
*
result
+
((
getItemId
()
==
null
)
?
0
:
getItemId
().
hashCode
());
result
=
prime
*
result
+
((
getAddTime
()
==
null
)
?
0
:
getAddTime
().
hashCode
());
return
result
;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table favorites_
coin
s_relation
* This enum corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
enum
Column
{
favoritesId
(
"favorites_id"
,
"favoritesId"
,
"BIGINT"
,
false
),
coinsId
(
"coins_id"
,
"coinsId"
,
"BIGINT"
,
false
);
itemId
(
"item_id"
,
"itemId"
,
"BIGINT"
,
false
),
addTime
(
"add_time"
,
"addTime"
,
"TIMESTAMP"
,
false
);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table favorites_
coin
s_relation
* This field corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
...
...
@@ -83,7 +93,7 @@ public class FavoritesCoinsRelation implements Serializable {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table favorites_
coin
s_relation
* This field corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
...
...
@@ -92,7 +102,7 @@ public class FavoritesCoinsRelation implements Serializable {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table favorites_
coin
s_relation
* This field corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
...
...
@@ -101,7 +111,7 @@ public class FavoritesCoinsRelation implements Serializable {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table favorites_
coin
s_relation
* This field corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
...
...
@@ -110,7 +120,7 @@ public class FavoritesCoinsRelation implements Serializable {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table favorites_
coin
s_relation
* This field corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
...
...
@@ -119,7 +129,7 @@ public class FavoritesCoinsRelation implements Serializable {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table favorites_
coin
s_relation
* This field corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
...
...
@@ -128,7 +138,7 @@ public class FavoritesCoinsRelation implements Serializable {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table favorites_
coin
s_relation
* This method corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
...
...
@@ -139,7 +149,7 @@ public class FavoritesCoinsRelation implements Serializable {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table favorites_
coin
s_relation
* This method corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
...
...
@@ -150,7 +160,7 @@ public class FavoritesCoinsRelation implements Serializable {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table favorites_
coin
s_relation
* This method corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
...
...
@@ -161,7 +171,7 @@ public class FavoritesCoinsRelation implements Serializable {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table favorites_
coin
s_relation
* This method corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
...
...
@@ -172,7 +182,7 @@ public class FavoritesCoinsRelation implements Serializable {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table favorites_
coin
s_relation
* This method corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
...
...
@@ -186,7 +196,7 @@ public class FavoritesCoinsRelation implements Serializable {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table favorites_
coin
s_relation
* This method corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
...
...
@@ -197,7 +207,7 @@ public class FavoritesCoinsRelation implements Serializable {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table favorites_
coin
s_relation
* This method corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
...
...
@@ -208,7 +218,7 @@ public class FavoritesCoinsRelation implements Serializable {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table favorites_
coin
s_relation
* This method corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
...
...
@@ -223,7 +233,7 @@ public class FavoritesCoinsRelation implements Serializable {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table favorites_
coin
s_relation
* This method corresponds to the database table favorites_
item
s_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/Favorites
Coin
sRelationExample.java
→
ch-dao/src/main/java/com/wwdz/ch/db/domain/Favorites
Item
sRelationExample.java
View file @
0eb9817c
This diff is collapsed.
Click to expand it.
ch-dao/src/main/java/com/wwdz/ch/db/domain/UsersItemsRelation.java
0 → 100644
View file @
0eb9817c
package
com.wwdz.ch.db.domain
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
lombok.Data
;
/**
* @author shiyu
* @date 2023/07/21
*/
@Data
public
class
UsersItemsRelation
implements
Serializable
{
/**
* 用户id
*/
private
Long
userId
;
/**
* 钱币id
*/
private
Long
itemId
;
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
getClass
().
getSimpleName
());
sb
.
append
(
" ["
);
sb
.
append
(
"Hash = "
).
append
(
hashCode
());
sb
.
append
(
", userId="
).
append
(
userId
);
sb
.
append
(
", itemId="
).
append
(
itemId
);
sb
.
append
(
", serialVersionUID="
).
append
(
serialVersionUID
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
}
@Override
public
boolean
equals
(
Object
that
)
{
if
(
this
==
that
)
{
return
true
;
}
if
(
that
==
null
)
{
return
false
;
}
if
(
getClass
()
!=
that
.
getClass
())
{
return
false
;
}
UsersItemsRelation
other
=
(
UsersItemsRelation
)
that
;
return
(
this
.
getUserId
()
==
null
?
other
.
getUserId
()
==
null
:
this
.
getUserId
().
equals
(
other
.
getUserId
()))
&&
(
this
.
getItemId
()
==
null
?
other
.
getItemId
()
==
null
:
this
.
getItemId
().
equals
(
other
.
getItemId
()));
}
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
getUserId
()
==
null
)
?
0
:
getUserId
().
hashCode
());
result
=
prime
*
result
+
((
getItemId
()
==
null
)
?
0
:
getItemId
().
hashCode
());
return
result
;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
enum
Column
{
userId
(
"user_id"
,
"userId"
,
"BIGINT"
,
false
),
itemId
(
"item_id"
,
"itemId"
,
"BIGINT"
,
false
);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
static
final
String
BEGINNING_DELIMITER
=
"`"
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
static
final
String
ENDING_DELIMITER
=
"`"
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
final
String
column
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
final
boolean
isColumnNameDelimited
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
final
String
javaProperty
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
final
String
jdbcType
;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
value
()
{
return
this
.
column
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
getValue
()
{
return
this
.
column
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
getJavaProperty
()
{
return
this
.
javaProperty
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
getJdbcType
()
{
return
this
.
jdbcType
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Column
(
String
column
,
String
javaProperty
,
String
jdbcType
,
boolean
isColumnNameDelimited
)
{
this
.
column
=
column
;
this
.
javaProperty
=
javaProperty
;
this
.
jdbcType
=
jdbcType
;
this
.
isColumnNameDelimited
=
isColumnNameDelimited
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
desc
()
{
return
this
.
getEscapedColumnName
()
+
" DESC"
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
asc
()
{
return
this
.
getEscapedColumnName
()
+
" ASC"
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
static
Column
[]
excludes
(
Column
...
excludes
)
{
ArrayList
<
Column
>
columns
=
new
ArrayList
<>(
Arrays
.
asList
(
Column
.
values
()));
if
(
excludes
!=
null
&&
excludes
.
length
>
0
)
{
columns
.
removeAll
(
new
ArrayList
<>(
Arrays
.
asList
(
excludes
)));
}
return
columns
.
toArray
(
new
Column
[]{});
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table users_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
getEscapedColumnName
()
{
if
(
this
.
isColumnNameDelimited
)
{
return
new
StringBuilder
().
append
(
BEGINNING_DELIMITER
).
append
(
this
.
column
).
append
(
ENDING_DELIMITER
).
toString
();
}
else
{
return
this
.
column
;
}
}
}
}
\ No newline at end of file
ch-dao/src/main/java/com/wwdz/ch/db/domain/UsersItemsRelationExample.java
0 → 100644
View file @
0eb9817c
This diff is collapsed.
Click to expand it.
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/CoinRequestDto.java
View file @
0eb9817c
...
...
@@ -56,4 +56,9 @@ public class CoinRequestDto extends BaseRequestDto implements Entity {
* 查询时要排除
*/
private
List
<
Long
>
idExcludeList
;
/**
* ids
*/
private
List
<
Long
>
ids
;
}
ch-dao/src/main/java/com/wwdz/ch/db/manager/Favorites
Coin
sRelationManager.java
→
ch-dao/src/main/java/com/wwdz/ch/db/manager/Favorites
Item
sRelationManager.java
View file @
0eb9817c
package
com.wwdz.ch.db.manager
;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.db.domain.Favorites
Coin
sRelation
;
import
com.wwdz.ch.db.domain.Favorites
Item
sRelation
;
import
java.util.List
;
public
interface
Favorites
Coin
sRelationManager
{
int
add
(
Favorites
Coin
sRelation
record
);
int
batchAdd
(
List
<
Favorites
Coin
sRelation
>
list
);
public
interface
Favorites
Item
sRelationManager
{
int
add
(
Favorites
Item
sRelation
record
);
int
batchAdd
(
List
<
Favorites
Item
sRelation
>
list
);
int
deleteByFavoritesId
(
Long
favoritesId
,
List
<
Long
>
favoritesIds
);
List
<
FavoritesCoinsRelation
>
listByFavoritesId
(
Long
favoritesId
,
List
<
Long
>
favoritesIds
);
PageInfo
<
FavoritesCoinsRelation
>
pageByFavoritesId
(
Long
favoritesId
,
int
page
,
int
size
);
int
deleteByChosen
(
Long
favoritesId
,
List
<
Long
>
itemIds
);
List
<
FavoritesItemsRelation
>
listByFavoritesId
(
Long
favoritesId
,
List
<
Long
>
favoritesIds
);
PageInfo
<
FavoritesItemsRelation
>
pageByFavoritesId
(
Long
favoritesId
,
int
page
,
int
size
);
}
ch-dao/src/main/java/com/wwdz/ch/db/manager/FavoritesManager.java
View file @
0eb9817c
...
...
@@ -11,9 +11,9 @@ public interface FavoritesManager {
int
update
(
Favorites
record
);
Favorites
info
(
Long
id
);
PageInfo
<
Favorites
>
pageByU
id
(
Long
ui
d
,
int
page
,
int
size
);
PageInfo
<
Favorites
>
pageByU
serId
(
Long
userI
d
,
int
page
,
int
size
);
boolean
isExisted
(
Long
id
,
Long
u
i
d
,
String
title
);
boolean
isExisted
(
Long
id
,
Long
u
serI
d
,
String
title
);
int
delete
(
Long
id
,
List
<
Long
>
ids
);
}
ch-dao/src/main/java/com/wwdz/ch/db/manager/ItemManager.java
View file @
0eb9817c
...
...
@@ -15,4 +15,6 @@ public interface ItemManager {
Item
findDetails
(
Long
id
);
boolean
setCoin
(
Item
item
);
int
deleteUserItems
(
CoinRequestDto
coinRequestDto
);
}
ch-dao/src/main/java/com/wwdz/ch/db/manager/UsersItemsRelationManager.java
0 → 100644
View file @
0eb9817c
package
com.wwdz.ch.db.manager
;
import
com.wwdz.ch.db.domain.UsersItemsRelation
;
import
java.util.List
;
public
interface
UsersItemsRelationManager
{
List
<
UsersItemsRelation
>
listByUserIds
(
Long
userId
,
List
<
Long
>
userIds
);
}
ch-dao/src/main/java/com/wwdz/ch/db/manager/impl/FavoritesCoinsRelationManagerImpl.java
deleted
100644 → 0
View file @
0a8e0c89
package
com.wwdz.ch.db.manager.impl
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.db.dao.FavoritesCoinsRelationMapper
;
import
com.wwdz.ch.db.domain.FavoritesCoinsRelation
;
import
com.wwdz.ch.db.domain.FavoritesCoinsRelationExample
;
import
com.wwdz.ch.db.manager.FavoritesCoinsRelationManager
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.util.CollectionUtils
;
import
java.util.List
;
@Repository
public
class
FavoritesCoinsRelationManagerImpl
implements
FavoritesCoinsRelationManager
{
@Autowired
private
FavoritesCoinsRelationMapper
favoritesCoinsRelationMapper
;
@Override
public
int
add
(
FavoritesCoinsRelation
record
)
{
return
favoritesCoinsRelationMapper
.
insert
(
record
);
}
@Override
public
int
batchAdd
(
List
<
FavoritesCoinsRelation
>
list
)
{
return
favoritesCoinsRelationMapper
.
batchInsert
(
list
);
}
@Override
public
int
deleteByFavoritesId
(
Long
favoritesId
,
List
<
Long
>
favoritesIds
)
{
FavoritesCoinsRelationExample
example
=
new
FavoritesCoinsRelationExample
();
FavoritesCoinsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
CollectionUtils
.
isEmpty
(
favoritesIds
))
{
criteria
.
andFavoritesIdIn
(
favoritesIds
);
}
else
{
criteria
.
andFavoritesIdEqualTo
(
favoritesId
);
}
return
favoritesCoinsRelationMapper
.
deleteByExample
(
example
);
}
@Override
public
List
<
FavoritesCoinsRelation
>
listByFavoritesId
(
Long
favoritesId
,
List
<
Long
>
favoritesIds
)
{
FavoritesCoinsRelationExample
example
=
new
FavoritesCoinsRelationExample
();
FavoritesCoinsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
CollectionUtils
.
isEmpty
(
favoritesIds
))
{
criteria
.
andFavoritesIdIn
(
favoritesIds
);
}
else
{
criteria
.
andFavoritesIdEqualTo
(
favoritesId
);
}
return
favoritesCoinsRelationMapper
.
selectByExample
(
example
);
}
@Override
public
PageInfo
<
FavoritesCoinsRelation
>
pageByFavoritesId
(
Long
favoritesId
,
int
page
,
int
size
)
{
FavoritesCoinsRelationExample
example
=
new
FavoritesCoinsRelationExample
();
FavoritesCoinsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andFavoritesIdEqualTo
(
favoritesId
);
PageHelper
.
startPage
(
page
,
size
);
List
<
FavoritesCoinsRelation
>
list
=
favoritesCoinsRelationMapper
.
selectByExample
(
example
);
return
new
PageInfo
<>(
list
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/manager/impl/FavoritesItemsRelationManagerImpl.java
0 → 100644
View file @
0eb9817c
package
com.wwdz.ch.db.manager.impl
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.db.dao.FavoritesItemsRelationMapper
;
import
com.wwdz.ch.db.domain.FavoritesItemsRelation
;
import
com.wwdz.ch.db.domain.FavoritesItemsRelationExample
;
import
com.wwdz.ch.db.manager.FavoritesItemsRelationManager
;
import
com.xxdxxs.db.component.JdbcHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
class
FavoritesItemsRelationManagerImpl
implements
FavoritesItemsRelationManager
{
@Autowired
private
FavoritesItemsRelationMapper
favoritesItemsRelationMapper
;
@Override
public
int
add
(
FavoritesItemsRelation
record
)
{
return
favoritesItemsRelationMapper
.
insert
(
record
);
}
@Override
public
int
batchAdd
(
List
<
FavoritesItemsRelation
>
list
)
{
return
favoritesItemsRelationMapper
.
batchInsert
(
list
);
}
@Override
public
int
deleteByFavoritesId
(
Long
favoritesId
,
List
<
Long
>
favoritesIds
)
{
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
JdbcHelper
.
ifPresent
(
favoritesId
,
criteria:
:
andFavoritesIdEqualTo
);
JdbcHelper
.
ifPresent
(
favoritesIds
,
criteria:
:
andFavoritesIdIn
);
return
favoritesItemsRelationMapper
.
deleteByExample
(
example
);
}
@Override
public
int
deleteByChosen
(
Long
favoritesId
,
List
<
Long
>
itemIds
)
{
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andFavoritesIdEqualTo
(
favoritesId
);
criteria
.
andItemIdIn
(
itemIds
);
return
favoritesItemsRelationMapper
.
deleteByExample
(
example
);
}
@Override
public
List
<
FavoritesItemsRelation
>
listByFavoritesId
(
Long
favoritesId
,
List
<
Long
>
favoritesIds
)
{
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
JdbcHelper
.
ifPresent
(
favoritesId
,
criteria:
:
andFavoritesIdEqualTo
);
JdbcHelper
.
ifPresent
(
favoritesIds
,
criteria:
:
andFavoritesIdIn
);
return
favoritesItemsRelationMapper
.
selectByExample
(
example
);
}
@Override
public
PageInfo
<
FavoritesItemsRelation
>
pageByFavoritesId
(
Long
favoritesId
,
int
page
,
int
size
)
{
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andFavoritesIdEqualTo
(
favoritesId
);
PageHelper
.
startPage
(
page
,
size
);
List
<
FavoritesItemsRelation
>
list
=
favoritesItemsRelationMapper
.
selectByExample
(
example
);
return
new
PageInfo
<>(
list
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/manager/impl/FavoritesManagerImpl.java
View file @
0eb9817c
...
...
@@ -6,9 +6,9 @@ import com.wwdz.ch.db.dao.FavoritesMapper;
import
com.wwdz.ch.db.domain.Favorites
;
import
com.wwdz.ch.db.domain.FavoritesExample
;
import
com.wwdz.ch.db.manager.FavoritesManager
;
import
com.xxdxxs.db.component.JdbcHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.util.CollectionUtils
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -44,10 +44,10 @@ public class FavoritesManagerImpl implements FavoritesManager {
}
@Override
public
PageInfo
<
Favorites
>
pageByU
id
(
Long
ui
d
,
int
page
,
int
size
)
{
public
PageInfo
<
Favorites
>
pageByU
serId
(
Long
userI
d
,
int
page
,
int
size
)
{
FavoritesExample
example
=
new
FavoritesExample
();
FavoritesExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andU
idEqualTo
(
ui
d
);
criteria
.
andU
serIdEqualTo
(
userI
d
);
criteria
.
andDeletedEqualTo
(
false
);
PageHelper
.
startPage
(
page
,
size
);
List
<
Favorites
>
list
=
favoritesMapper
.
selectByExample
(
example
);
...
...
@@ -55,10 +55,10 @@ public class FavoritesManagerImpl implements FavoritesManager {
}
@Override
public
boolean
isExisted
(
Long
id
,
Long
u
i
d
,
String
title
)
{
public
boolean
isExisted
(
Long
id
,
Long
u
serI
d
,
String
title
)
{
FavoritesExample
example
=
new
FavoritesExample
();
FavoritesExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andU
idEqualTo
(
ui
d
);
criteria
.
andU
serIdEqualTo
(
userI
d
);
criteria
.
andTitleEqualTo
(
title
);
criteria
.
andDeletedEqualTo
(
false
);
if
(
Objects
.
nonNull
(
id
))
{
...
...
@@ -71,11 +71,8 @@ public class FavoritesManagerImpl implements FavoritesManager {
public
int
delete
(
Long
id
,
List
<
Long
>
ids
)
{
FavoritesExample
example
=
new
FavoritesExample
();
FavoritesExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
CollectionUtils
.
isEmpty
(
ids
))
{
criteria
.
andIdIn
(
ids
);
}
else
{
criteria
.
andIdEqualTo
(
id
);
}
JdbcHelper
.
ifPresent
(
id
,
criteria:
:
andIdEqualTo
);
JdbcHelper
.
ifPresent
(
ids
,
criteria:
:
andIdIn
);
Favorites
favorites
=
new
Favorites
();
favorites
.
setDeleted
(
true
);
favorites
.
setUpdateTime
(
new
Date
());
...
...
ch-dao/src/main/java/com/wwdz/ch/db/manager/impl/ItemManagerImpl.java
View file @
0eb9817c
...
...
@@ -64,4 +64,17 @@ public class ItemManagerImpl implements ItemManager {
int
num
=
itemMapper
.
updateByExampleSelective
(
item
,
example
);
return
num
>
0
;
}
@Override
public
int
deleteUserItems
(
CoinRequestDto
coinRequestDto
)
{
ItemExample
example
=
new
ItemExample
();
ItemExample
.
Criteria
criteria
=
example
.
createCriteria
();
JdbcHelper
.
ifPresent
(
coinRequestDto
.
getId
(),
criteria:
:
andIdEqualTo
);
JdbcHelper
.
ifPresent
(
coinRequestDto
.
getIds
(),
criteria:
:
andIdIn
);
criteria
.
andSourceTypeEqualTo
(
2
);
Item
item
=
new
Item
();
item
.
setUpdateTime
(
new
Date
());
item
.
setIsDeleted
(
true
);
return
itemMapper
.
updateByExampleSelective
(
item
,
example
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/manager/impl/UsersItemsRelationManagerImpl.java
0 → 100644
View file @
0eb9817c
package
com.wwdz.ch.db.manager.impl
;
import
com.wwdz.ch.db.dao.UsersItemsRelationMapper
;
import
com.wwdz.ch.db.domain.UsersItemsRelation
;
import
com.wwdz.ch.db.domain.UsersItemsRelationExample
;
import
com.wwdz.ch.db.manager.UsersItemsRelationManager
;
import
com.xxdxxs.db.component.JdbcHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
class
UsersItemsRelationManagerImpl
implements
UsersItemsRelationManager
{
@Autowired
private
UsersItemsRelationMapper
usersItemsRelationMapper
;
@Override
public
List
<
UsersItemsRelation
>
listByUserIds
(
Long
userId
,
List
<
Long
>
userIds
)
{
UsersItemsRelationExample
example
=
new
UsersItemsRelationExample
();
UsersItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
JdbcHelper
.
ifPresent
(
userId
,
criteria:
:
andUserIdEqualTo
);
JdbcHelper
.
ifPresent
(
userIds
,
criteria:
:
andUserIdIn
);
return
usersItemsRelationMapper
.
selectByExample
(
example
);
}
}
ch-dao/src/main/resources/com/wwdz/ch/db/dao/Favorites
Coin
sRelationMapper.xml
→
ch-dao/src/main/resources/com/wwdz/ch/db/dao/Favorites
Item
sRelationMapper.xml
View file @
0eb9817c
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.wwdz.ch.db.dao.Favorites
Coin
sRelationMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.wwdz.ch.db.domain.Favorites
Coin
sRelation"
>
<mapper
namespace=
"com.wwdz.ch.db.dao.Favorites
Item
sRelationMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.wwdz.ch.db.domain.Favorites
Item
sRelation"
>
<result
column=
"favorites_id"
jdbcType=
"BIGINT"
property=
"favoritesId"
/>
<result
column=
"coins_id"
jdbcType=
"BIGINT"
property=
"coinsId"
/>
<result
column=
"item_id"
jdbcType=
"BIGINT"
property=
"itemId"
/>
<result
column=
"add_time"
jdbcType=
"TIMESTAMP"
property=
"addTime"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<where>
...
...
@@ -64,16 +65,16 @@
</where>
</sql>
<sql
id=
"Base_Column_List"
>
favorites_id,
coins_id
favorites_id,
item_id, add_time
</sql>
<select
id=
"selectByExample"
parameterType=
"com.wwdz.ch.db.domain.Favorites
Coin
sRelationExample"
resultMap=
"BaseResultMap"
>
<select
id=
"selectByExample"
parameterType=
"com.wwdz.ch.db.domain.Favorites
Item
sRelationExample"
resultMap=
"BaseResultMap"
>
select
<if
test=
"distinct"
>
distinct
</if>
'true' as QUERYID,
<include
refid=
"Base_Column_List"
/>
from favorites_
coin
s_relation
from favorites_
item
s_relation
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
...
...
@@ -99,10 +100,10 @@
</foreach>
</when>
<otherwise>
favorites_id,
coins_id
favorites_id,
item_id, add_time
</otherwise>
</choose>
from favorites_
coin
s_relation
from favorites_
item
s_relation
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
...
...
@@ -110,56 +111,67 @@
order by ${example.orderByClause}
</if>
</select>
<delete
id=
"deleteByExample"
parameterType=
"com.wwdz.ch.db.domain.Favorites
Coin
sRelationExample"
>
delete from favorites_
coin
s_relation
<delete
id=
"deleteByExample"
parameterType=
"com.wwdz.ch.db.domain.Favorites
Item
sRelationExample"
>
delete from favorites_
item
s_relation
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"com.wwdz.ch.db.domain.FavoritesCoinsRelation"
>
insert into favorites_coins_relation (favorites_id, coins_id)
values (#{favoritesId,jdbcType=BIGINT}, #{coinsId,jdbcType=BIGINT})
<insert
id=
"insert"
parameterType=
"com.wwdz.ch.db.domain.FavoritesItemsRelation"
>
insert into favorites_items_relation (favorites_id, item_id, add_time
)
values (#{favoritesId,jdbcType=BIGINT}, #{itemId,jdbcType=BIGINT}, #{addTime,jdbcType=TIMESTAMP}
)
</insert>
<insert
id=
"batchInsert"
parameterType=
"com.wwdz.ch.db.domain.Favorites
Coin
sRelation"
>
insert into favorites_coins_relation (favorites_id,
coins_id
)
<insert
id=
"batchInsert"
parameterType=
"com.wwdz.ch.db.domain.Favorites
Item
sRelation"
>
insert into favorites_coins_relation (favorites_id,
item_id, add_time
)
values
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(#{item.favoritesId,jdbcType=BIGINT}, #{item.
coinsId,jdbcType=BIGINT
})
(#{item.favoritesId,jdbcType=BIGINT}, #{item.
itemId,jdbcType=BIGINT}, #{item.addTime,jdbcType=TIMESTAMP
})
</foreach>
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.wwdz.ch.db.domain.Favorites
Coin
sRelation"
>
insert into favorites_
coin
s_relation
<insert
id=
"insertSelective"
parameterType=
"com.wwdz.ch.db.domain.Favorites
Item
sRelation"
>
insert into favorites_
item
s_relation
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"favoritesId != null"
>
favorites_id,
</if>
<if
test=
"coinsId != null"
>
coins_id,
<if
test=
"itemId != null"
>
item_id,
</if>
<if
test=
"addTime != null"
>
add_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"favoritesId != null"
>
#{favoritesId,jdbcType=BIGINT},
</if>
<if
test=
"coinsId != null"
>
#{coinsId,jdbcType=BIGINT},
<if
test=
"itemId != null"
>
#{itemId,jdbcType=BIGINT},
</if>
<if
test=
"addTime != null"
>
#{addTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"com.wwdz.ch.db.domain.Favorites
Coin
sRelationExample"
resultType=
"java.lang.Long"
>
select count(*) from favorites_
coin
s_relation
<select
id=
"countByExample"
parameterType=
"com.wwdz.ch.db.domain.Favorites
Item
sRelationExample"
resultType=
"java.lang.Long"
>
select count(*) from favorites_
item
s_relation
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
update favorites_
coin
s_relation
update favorites_
item
s_relation
<set>
<if
test=
"record.favoritesId != null"
>
favorites_id = #{record.favoritesId,jdbcType=BIGINT},
</if>
<if
test=
"record.coinsId != null"
>
coins_id = #{record.coinsId,jdbcType=BIGINT},
<if
test=
"record.itemId != null"
>
item_id = #{record.itemId,jdbcType=BIGINT},
</if>
<if
test=
"record.addTime != null"
>
add_time = #{record.addTime,jdbcType=TIMESTAMP},
</if>
</set>
<if
test=
"_parameter != null"
>
...
...
@@ -167,14 +179,15 @@
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
update favorites_
coin
s_relation
update favorites_
item
s_relation
set favorites_id = #{record.favoritesId,jdbcType=BIGINT},
coins_id = #{record.coinsId,jdbcType=BIGINT}
item_id = #{record.itemId,jdbcType=BIGINT},
add_time = #{record.addTime,jdbcType=TIMESTAMP}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<select
id=
"selectOneByExample"
parameterType=
"com.wwdz.ch.db.domain.Favorites
Coin
sRelationExample"
resultMap=
"BaseResultMap"
>
<select
id=
"selectOneByExample"
parameterType=
"com.wwdz.ch.db.domain.Favorites
Item
sRelationExample"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
...
...
@@ -183,7 +196,7 @@
select
'true' as QUERYID,
<include
refid=
"Base_Column_List"
/>
from favorites_
coin
s_relation
from favorites_
item
s_relation
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
...
...
@@ -207,10 +220,10 @@
</foreach>
</when>
<otherwise>
favorites_id,
coins_id
favorites_id,
item_id, add_time
</otherwise>
</choose>
from favorites_
coin
s_relation
from favorites_
item
s_relation
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
...
...
ch-dao/src/main/resources/com/wwdz/ch/db/dao/FavoritesMapper.xml
View file @
0eb9817c
...
...
@@ -3,7 +3,7 @@
<mapper
namespace=
"com.wwdz.ch.db.dao.FavoritesMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.wwdz.ch.db.domain.Favorites"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"u
id"
jdbcType=
"BIGINT"
property=
"ui
d"
/>
<result
column=
"u
ser_id"
jdbcType=
"BIGINT"
property=
"userI
d"
/>
<result
column=
"title"
jdbcType=
"VARCHAR"
property=
"title"
/>
<result
column=
"description"
jdbcType=
"VARCHAR"
property=
"description"
/>
<result
column=
"add_time"
jdbcType=
"TIMESTAMP"
property=
"addTime"
/>
...
...
@@ -72,7 +72,7 @@
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id,
`uid`
, title, description, add_time, update_time, deleted
id,
user_id
, title, description, add_time, update_time, deleted
</sql>
<sql
id=
"Blob_Column_List"
>
images
...
...
@@ -121,13 +121,13 @@
distinct
</if>
<choose>
<when
test=
"selective != null and selective.length
>
0"
>
<when
test=
"selective != null and selective.length
>
0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id,
`uid`
, title, description, add_time, update_time, deleted, images
id,
user_id
, title, description, add_time, update_time, deleted, images
</otherwise>
</choose>
from favorites
...
...
@@ -176,13 +176,13 @@
-->
select
<choose>
<when
test=
"selective != null and selective.length
>
0"
>
<when
test=
"selective != null and selective.length
>
0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id,
`uid`
, title, description, add_time, update_time, deleted, images
id,
user_id
, title, description, add_time, update_time, deleted, images
</otherwise>
</choose>
from favorites
...
...
@@ -202,10 +202,10 @@
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Long"
>
SELECT LAST_INSERT_ID()
</selectKey>
insert into favorites (
`uid`
, title, description,
insert into favorites (
user_id
, title, description,
add_time, update_time, deleted,
images)
values (#{u
i
d,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
values (#{u
serI
d,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{addTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT},
#{images,jdbcType=LONGVARCHAR})
</insert>
...
...
@@ -215,8 +215,8 @@
</selectKey>
insert into favorites
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"u
i
d != null"
>
`uid`
,
<if
test=
"u
serI
d != null"
>
user_id
,
</if>
<if
test=
"title != null"
>
title,
...
...
@@ -238,8 +238,8 @@
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"u
i
d != null"
>
#{u
i
d,jdbcType=BIGINT},
<if
test=
"u
serI
d != null"
>
#{u
serI
d,jdbcType=BIGINT},
</if>
<if
test=
"title != null"
>
#{title,jdbcType=VARCHAR},
...
...
@@ -273,8 +273,8 @@
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=BIGINT},
</if>
<if
test=
"record.u
i
d != null"
>
`uid` = #{record.ui
d,jdbcType=BIGINT},
<if
test=
"record.u
serI
d != null"
>
user_id = #{record.userI
d,jdbcType=BIGINT},
</if>
<if
test=
"record.title != null"
>
title = #{record.title,jdbcType=VARCHAR},
...
...
@@ -302,7 +302,7 @@
<update
id=
"updateByExampleWithBLOBs"
parameterType=
"map"
>
update favorites
set id = #{record.id,jdbcType=BIGINT},
`uid` = #{record.ui
d,jdbcType=BIGINT},
user_id = #{record.userI
d,jdbcType=BIGINT},
title = #{record.title,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
...
...
@@ -316,7 +316,7 @@
<update
id=
"updateByExample"
parameterType=
"map"
>
update favorites
set id = #{record.id,jdbcType=BIGINT},
`uid` = #{record.ui
d,jdbcType=BIGINT},
user_id = #{record.userI
d,jdbcType=BIGINT},
title = #{record.title,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
...
...
@@ -329,8 +329,8 @@
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.wwdz.ch.db.domain.Favorites"
>
update favorites
<set>
<if
test=
"u
i
d != null"
>
`uid` = #{ui
d,jdbcType=BIGINT},
<if
test=
"u
serI
d != null"
>
user_id = #{userI
d,jdbcType=BIGINT},
</if>
<if
test=
"title != null"
>
title = #{title,jdbcType=VARCHAR},
...
...
@@ -355,7 +355,7 @@
</update>
<update
id=
"updateByPrimaryKeyWithBLOBs"
parameterType=
"com.wwdz.ch.db.domain.Favorites"
>
update favorites
set
`uid` = #{ui
d,jdbcType=BIGINT},
set
user_id = #{userI
d,jdbcType=BIGINT},
title = #{title,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
add_time = #{addTime,jdbcType=TIMESTAMP},
...
...
@@ -366,7 +366,7 @@
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.wwdz.ch.db.domain.Favorites"
>
update favorites
set
`uid` = #{ui
d,jdbcType=BIGINT},
set
user_id = #{userI
d,jdbcType=BIGINT},
title = #{title,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
add_time = #{addTime,jdbcType=TIMESTAMP},
...
...
@@ -421,13 +421,13 @@
select
'true' as QUERYID,
<choose>
<when
test=
"selective != null and selective.length
>
0"
>
<when
test=
"selective != null and selective.length
>
0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id,
`uid`
, title, description, add_time, update_time, deleted, images
id,
user_id
, title, description, add_time, update_time, deleted, images
</otherwise>
</choose>
from favorites
...
...
ch-dao/src/main/resources/com/wwdz/ch/db/dao/UsersItemsRelationMapper.xml
0 → 100644
View file @
0eb9817c
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.wwdz.ch.db.dao.UsersItemsRelationMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.wwdz.ch.db.domain.UsersItemsRelation"
>
<result
column=
"user_id"
jdbcType=
"BIGINT"
property=
"userId"
/>
<result
column=
"item_id"
jdbcType=
"BIGINT"
property=
"itemId"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<where>
<foreach
collection=
"oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Update_By_Example_Where_Clause"
>
<where>
<foreach
collection=
"example.oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Base_Column_List"
>
user_id, item_id
</sql>
<select
id=
"selectByExample"
parameterType=
"com.wwdz.ch.db.domain.UsersItemsRelationExample"
resultMap=
"BaseResultMap"
>
select
<if
test=
"distinct"
>
distinct
</if>
'true' as QUERYID,
<include
refid=
"Base_Column_List"
/>
from users_items_relation
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
</select>
<select
id=
"selectByExampleSelective"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<if
test=
"example.distinct"
>
distinct
</if>
<choose>
<when
test=
"selective != null and selective.length > 0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
user_id, item_id
</otherwise>
</choose>
from users_items_relation
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
<if
test=
"example.orderByClause != null"
>
order by ${example.orderByClause}
</if>
</select>
<delete
id=
"deleteByExample"
parameterType=
"com.wwdz.ch.db.domain.UsersItemsRelationExample"
>
delete from users_items_relation
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"com.wwdz.ch.db.domain.UsersItemsRelation"
>
insert into users_items_relation (user_id, item_id)
values (#{userId,jdbcType=BIGINT}, #{itemId,jdbcType=BIGINT})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.wwdz.ch.db.domain.UsersItemsRelation"
>
insert into users_items_relation
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"userId != null"
>
user_id,
</if>
<if
test=
"itemId != null"
>
item_id,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"userId != null"
>
#{userId,jdbcType=BIGINT},
</if>
<if
test=
"itemId != null"
>
#{itemId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"com.wwdz.ch.db.domain.UsersItemsRelationExample"
resultType=
"java.lang.Long"
>
select count(*) from users_items_relation
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
update users_items_relation
<set>
<if
test=
"record.userId != null"
>
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if
test=
"record.itemId != null"
>
item_id = #{record.itemId,jdbcType=BIGINT},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
update users_items_relation
set user_id = #{record.userId,jdbcType=BIGINT},
item_id = #{record.itemId,jdbcType=BIGINT}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<select
id=
"selectOneByExample"
parameterType=
"com.wwdz.ch.db.domain.UsersItemsRelationExample"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<include
refid=
"Base_Column_List"
/>
from users_items_relation
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
limit 1
</select>
<select
id=
"selectOneByExampleSelective"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<choose>
<when
test=
"selective != null and selective.length > 0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
user_id, item_id
</otherwise>
</choose>
from users_items_relation
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
<if
test=
"example.orderByClause != null"
>
order by ${example.orderByClause}
</if>
limit 1
</select>
</mapper>
\ No newline at end of file
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/request/FavoritesItemRequestDto.java
0 → 100644
View file @
0eb9817c
package
com.wwdz.ch.wx.entity.request
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
FavoritesItemRequestDto
implements
Entity
{
private
Long
favoritesId
;
private
List
<
Long
>
itemIds
;
private
Long
userId
;
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/request/FavoritesRequestDto.java
View file @
0eb9817c
package
com.wwdz.ch.wx.entity.request
;
import
com.github.pagehelper.Page
;
import
com.xxdxxs.entity.Entity
;
import
com.xxdxxs.support.Delete
;
import
com.xxdxxs.support.Insert
;
import
com.xxdxxs.support.Select
;
...
...
@@ -10,13 +11,10 @@ import org.hibernate.validator.constraints.Length;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
public
class
FavoritesRequestDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
public
class
FavoritesRequestDto
implements
Entity
{
@NotNull
(
groups
=
{
Update
.
class
,
Select
.
class
},
message
=
"id不能为空"
)
private
Long
id
;
...
...
@@ -30,7 +28,7 @@ public class FavoritesRequestDto implements Serializable {
private
String
images
;
@NotNull
(
groups
=
{
Insert
.
class
,
Update
.
class
,
Page
.
class
,
Delete
.
class
},
message
=
"用户id不能为空"
)
private
Long
u
i
d
;
private
Long
u
serI
d
;
@NotNull
(
groups
=
Page
.
class
,
message
=
"当前页不能为空"
)
private
Integer
page
;
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FavoritesService.java
View file @
0eb9817c
package
com.wwdz.ch.wx.service
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.wx.entity.request.FavoritesItemRequestDto
;
import
com.wwdz.ch.wx.entity.request.FavoritesRequestDto
;
public
interface
FavoritesService
{
...
...
@@ -15,4 +16,6 @@ public interface FavoritesService {
Result
delete
(
FavoritesRequestDto
dto
);
Result
batchDelete
(
FavoritesRequestDto
dto
);
Result
removeItem
(
FavoritesItemRequestDto
dto
);
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/impl/FavoritesServiceImpl.java
View file @
0eb9817c
...
...
@@ -2,9 +2,14 @@ package com.wwdz.ch.wx.service.impl;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.domain.Favorites
;
import
com.wwdz.ch.db.domain.FavoritesCoinsRelation
;
import
com.wwdz.ch.db.manager.FavoritesCoinsRelationManager
;
import
com.wwdz.ch.db.domain.FavoritesItemsRelation
;
import
com.wwdz.ch.db.domain.UsersItemsRelation
;
import
com.wwdz.ch.db.dto.request.CoinRequestDto
;
import
com.wwdz.ch.db.manager.FavoritesItemsRelationManager
;
import
com.wwdz.ch.db.manager.FavoritesManager
;
import
com.wwdz.ch.db.manager.ItemManager
;
import
com.wwdz.ch.db.manager.UsersItemsRelationManager
;
import
com.wwdz.ch.wx.entity.request.FavoritesItemRequestDto
;
import
com.wwdz.ch.wx.entity.request.FavoritesRequestDto
;
import
com.wwdz.ch.wx.service.FavoritesService
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -18,6 +23,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
@Service
public
class
FavoritesServiceImpl
implements
FavoritesService
{
...
...
@@ -26,12 +32,16 @@ public class FavoritesServiceImpl implements FavoritesService {
@Autowired
private
FavoritesManager
favoritesManager
;
@Autowired
private
FavoritesCoinsRelationManager
favoritesCoinsRelationManager
;
private
FavoritesItemsRelationManager
favoritesItemsRelationManager
;
@Autowired
private
UsersItemsRelationManager
usersItemsRelationManager
;
@Autowired
private
ItemManager
itemManager
;
@Override
public
Result
page
(
FavoritesRequestDto
dto
)
{
try
{
return
Result
.
success
(
favoritesManager
.
pageByU
id
(
dto
.
getUi
d
(),
dto
.
getPage
(),
dto
.
getSize
()));
return
Result
.
success
(
favoritesManager
.
pageByU
serId
(
dto
.
getUserI
d
(),
dto
.
getPage
(),
dto
.
getSize
()));
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询收藏册列表失败,原因:"
+
e
.
getMessage
(),
e
);
return
Result
.
failed
(-
1
,
"查询收藏册列表失败"
);
...
...
@@ -43,12 +53,12 @@ public class FavoritesServiceImpl implements FavoritesService {
public
Result
add
(
FavoritesRequestDto
dto
)
{
try
{
// 判断收藏册标题是否已存在
if
(
favoritesManager
.
isExisted
(
null
,
dto
.
getU
i
d
(),
dto
.
getTitle
()))
{
if
(
favoritesManager
.
isExisted
(
null
,
dto
.
getU
serI
d
(),
dto
.
getTitle
()))
{
return
Result
.
failed
(-
1
,
"收藏册的标题不能重复"
);
}
Favorites
favorites
=
new
Favorites
();
favorites
.
setU
id
(
dto
.
getUi
d
());
favorites
.
setU
serId
(
dto
.
getUserI
d
());
favorites
.
setTitle
(
dto
.
getTitle
());
favorites
.
setDescription
(
dto
.
getDescription
());
favorites
.
setImages
(
dto
.
getImages
());
...
...
@@ -74,7 +84,7 @@ public class FavoritesServiceImpl implements FavoritesService {
return
Result
.
failed
(
"数据异常,记录不存在"
);
}
// 判断收藏册标题是否已存在
if
(
favoritesManager
.
isExisted
(
dto
.
getId
(),
dto
.
getU
i
d
(),
dto
.
getTitle
()))
{
if
(
favoritesManager
.
isExisted
(
dto
.
getId
(),
dto
.
getU
serI
d
(),
dto
.
getTitle
()))
{
return
Result
.
failed
(
"收藏册的标题不能重复"
);
}
...
...
@@ -109,23 +119,18 @@ public class FavoritesServiceImpl implements FavoritesService {
@Override
public
Result
delete
(
FavoritesRequestDto
dto
)
{
try
{
List
<
Favorites
CoinsRelation
>
list
=
favoritesCoin
sRelationManager
.
listByFavoritesId
(
dto
.
getId
(),
null
);
if
(
CollectionUtils
.
isNotEmpty
(
l
ist
))
{
return
Result
.
failed
(
"收藏册内有藏品,
清
先移除藏品"
);
List
<
Favorites
ItemsRelation
>
favoritesItemsList
=
favoritesItem
sRelationManager
.
listByFavoritesId
(
dto
.
getId
(),
null
);
if
(
CollectionUtils
.
isNotEmpty
(
favoritesItemsL
ist
))
{
return
Result
.
failed
(
"收藏册内有藏品,
请
先移除藏品"
);
}
//TODO 删除该收藏册下用户创建的钱币
// 删除收藏册和钱币的关联
favoritesCoinsRelationManager
.
deleteByFavoritesId
(
dto
.
getId
(),
null
);
// 删除收藏册
favoritesManager
.
delete
(
dto
.
getId
(),
null
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"
批量
删除收藏册失败,原因:"
+
e
.
getMessage
(),
e
);
logger
.
error
(
"删除收藏册失败,原因:"
+
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
Result
.
failed
(
"
批量
删除收藏册失败"
);
return
Result
.
failed
(
"删除收藏册失败"
);
}
}
...
...
@@ -133,11 +138,25 @@ public class FavoritesServiceImpl implements FavoritesService {
@Override
public
Result
batchDelete
(
FavoritesRequestDto
dto
)
{
try
{
List
<
FavoritesCoinsRelation
>
list
=
favoritesCoinsRelationManager
.
listByFavoritesId
(
null
,
dto
.
getIds
());
//TODO 删除该收藏册下用户创建的钱币
// 批量删除收藏册下用户创建的钱币
List
<
FavoritesItemsRelation
>
list
=
favoritesItemsRelationManager
.
listByFavoritesId
(
null
,
dto
.
getIds
());
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
List
<
Long
>
favoritesItemsIds
=
list
.
stream
()
.
map
(
FavoritesItemsRelation:
:
getItemId
).
collect
(
Collectors
.
toList
());
List
<
UsersItemsRelation
>
usersItemsList
=
usersItemsRelationManager
.
listByUserIds
(
dto
.
getUserId
(),
null
);
if
(
CollectionUtils
.
isNotEmpty
(
usersItemsList
))
{
List
<
Long
>
usersItemsIds
=
usersItemsList
.
stream
()
.
map
(
UsersItemsRelation:
:
getItemId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
itemIds
=
favoritesItemsIds
.
stream
()
.
filter
(
usersItemsIds:
:
contains
).
collect
(
Collectors
.
toList
());
CoinRequestDto
coinRequestDto
=
new
CoinRequestDto
();
coinRequestDto
.
setIds
(
itemIds
);
itemManager
.
deleteUserItems
(
coinRequestDto
);
}
}
// 删除收藏册和钱币的关联
favorites
Coin
sRelationManager
.
deleteByFavoritesId
(
null
,
dto
.
getIds
());
favorites
Item
sRelationManager
.
deleteByFavoritesId
(
null
,
dto
.
getIds
());
// 删除收藏册
favoritesManager
.
delete
(
null
,
dto
.
getIds
());
...
...
@@ -148,4 +167,30 @@ public class FavoritesServiceImpl implements FavoritesService {
return
Result
.
failed
(
"批量删除收藏册失败"
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
Result
removeItem
(
FavoritesItemRequestDto
dto
)
{
try
{
// 批量删除收藏册下用户创建的钱币
List
<
UsersItemsRelation
>
usersItemsList
=
usersItemsRelationManager
.
listByUserIds
(
dto
.
getUserId
(),
null
);
if
(
CollectionUtils
.
isNotEmpty
(
usersItemsList
))
{
List
<
Long
>
usersItemsIds
=
usersItemsList
.
stream
()
.
map
(
UsersItemsRelation:
:
getItemId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
itemIds
=
dto
.
getItemIds
().
stream
()
.
filter
(
usersItemsIds:
:
contains
).
collect
(
Collectors
.
toList
());
CoinRequestDto
coinRequestDto
=
new
CoinRequestDto
();
coinRequestDto
.
setIds
(
itemIds
);
itemManager
.
deleteUserItems
(
coinRequestDto
);
}
// 删除收藏册和钱币的关联
favoritesItemsRelationManager
.
deleteByChosen
(
dto
.
getFavoritesId
(),
dto
.
getItemIds
());
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
info
(
"收藏册取消收藏失败,原因:"
+
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
Result
.
failed
(
"收藏册取消收藏失败"
);
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
View file @
0eb9817c
...
...
@@ -2,6 +2,7 @@ package com.wwdz.ch.wx.web;
import
com.github.pagehelper.Page
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.wx.entity.request.FavoritesItemRequestDto
;
import
com.wwdz.ch.wx.entity.request.FavoritesRequestDto
;
import
com.wwdz.ch.wx.service.FavoritesService
;
import
com.xxdxxs.support.Delete
;
...
...
@@ -63,4 +64,15 @@ public class WxFavoritesController {
}
return
favoritesService
.
batchDelete
(
dto
);
}
@PostMapping
(
"/removeItem"
)
public
Result
removeItem
(
@RequestBody
FavoritesItemRequestDto
dto
)
{
if
(
Objects
.
isNull
(
dto
.
getFavoritesId
()))
{
return
Result
.
failed
(
"收藏册不能为空"
);
}
if
(
CollectionUtils
.
isEmpty
(
dto
.
getItemIds
()))
{
return
Result
.
failed
(
"请选择藏品"
);
}
return
favoritesService
.
removeItem
(
dto
);
}
}
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