Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hooloo
ms
soss
Commits
af4d8834
Commit
af4d8834
authored
Feb 23, 2023
by
caiyt
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/v2' into v2
parents
e0e203ee
0e138be9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
106 additions
and
38 deletions
+106
-38
soss-admin/pom.xml
+1
-0
soss-admin/src/main/java/com/soss/web/controller/system/BannerController.java
+2
-1
soss-system/src/main/java/com/soss/system/domain/po/BannerListPo.java
+34
-0
soss-system/src/main/java/com/soss/system/mapper/SysBannerMapper.java
+2
-1
soss-system/src/main/java/com/soss/system/service/ISysBannerService.java
+2
-1
soss-system/src/main/java/com/soss/system/service/impl/SysBannerServiceImpl.java
+60
-30
soss-system/src/main/resources/mapper/system/SysBannerMapper.xml
+5
-5
No files found.
soss-admin/pom.xml
View file @
af4d8834
...
...
@@ -70,6 +70,7 @@
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
2.2.6.RELEASE
</version>
<executions>
<execution>
<goals>
...
...
soss-admin/src/main/java/com/soss/web/controller/system/BannerController.java
View file @
af4d8834
...
...
@@ -6,6 +6,7 @@ import com.soss.common.core.domain.AjaxResult;
import
com.soss.common.core.page.TableDataInfo
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.system.domain.SysBanner
;
import
com.soss.system.domain.po.BannerListPo
;
import
com.soss.system.domain.po.BannerPo
;
import
com.soss.system.domain.vo.BannerVo
;
import
com.soss.system.service.ISysBannerService
;
...
...
@@ -27,7 +28,7 @@ public class BannerController extends BaseController {
private
ISysBannerService
bannerService
;
@PostMapping
(
"/list"
)
public
TableDataInfo
list
(
@RequestBody
SysBanner
banner
)
{
public
TableDataInfo
list
(
@RequestBody
BannerListPo
banner
)
{
startPage
();
List
<
SysBanner
>
list
=
bannerService
.
selectBanner
(
banner
);
List
<
BannerVo
>
bannerVos
=
bannerService
.
copyBanner
(
list
);
...
...
soss-system/src/main/java/com/soss/system/domain/po/BannerListPo.java
0 → 100644
View file @
af4d8834
package
com
.
soss
.
system
.
domain
.
po
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"轮播图查询参数类"
)
public
class
BannerListPo
{
/**
* 类型:1-小程序,2-KDS,3-点单屏
*/
private
Integer
type
;
/**
* 目标:1-小程序首页,2-小程序我的,0-其它
*/
private
Integer
target
;
/**
* 状态
*/
private
Integer
state
;
@ApiModelProperty
(
"省份"
)
private
String
province
;
@ApiModelProperty
(
"城市"
)
private
String
city
;
@ApiModelProperty
(
"区域"
)
private
String
area
;
@ApiModelProperty
(
"店铺ID"
)
private
String
shopId
;
}
soss-system/src/main/java/com/soss/system/mapper/SysBannerMapper.java
View file @
af4d8834
package
com
.
soss
.
system
.
mapper
;
import
com.soss.system.domain.SysBanner
;
import
com.soss.system.domain.po.BannerListPo
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -12,7 +13,7 @@ import java.util.List;
* @date 2022-04-28
*/
public
interface
SysBannerMapper
{
List
<
SysBanner
>
selectBanner
(
SysBanner
banner
);
List
<
SysBanner
>
selectBanner
(
BannerListPo
banner
);
Long
createBanner
(
SysBanner
banner
);
...
...
soss-system/src/main/java/com/soss/system/service/ISysBannerService.java
View file @
af4d8834
package
com
.
soss
.
system
.
service
;
import
com.soss.system.domain.SysBanner
;
import
com.soss.system.domain.po.BannerListPo
;
import
com.soss.system.domain.po.BannerPo
;
import
com.soss.system.domain.vo.BannerVo
;
...
...
@@ -13,7 +14,7 @@ import java.util.List;
* @date 2022-04-28
*/
public
interface
ISysBannerService
{
List
<
SysBanner
>
selectBanner
(
SysBanner
banner
);
List
<
SysBanner
>
selectBanner
(
BannerListPo
banner
);
Long
createBanner
(
BannerPo
banner
);
...
...
soss-system/src/main/java/com/soss/system/service/impl/SysBannerServiceImpl.java
View file @
af4d8834
...
...
@@ -4,6 +4,7 @@ import com.soss.common.exception.ServiceException;
import
com.soss.common.utils.StringUtils
;
import
com.soss.system.domain.Shop
;
import
com.soss.system.domain.SysBanner
;
import
com.soss.system.domain.po.BannerListPo
;
import
com.soss.system.domain.po.BannerPo
;
import
com.soss.system.domain.vo.BannerVo
;
import
com.soss.system.mapper.ShopMapper
;
...
...
@@ -39,7 +40,7 @@ public class SysBannerServiceImpl implements ISysBannerService {
private
AreaUtil
areaUtil
;
@Override
public
List
<
SysBanner
>
selectBanner
(
SysBanner
banner
)
{
public
List
<
SysBanner
>
selectBanner
(
BannerListPo
banner
)
{
return
sysBannerMapper
.
selectBanner
(
banner
);
}
...
...
@@ -113,29 +114,20 @@ public class SysBannerServiceImpl implements ISysBannerService {
banner
.
setSort
(
bannerPo
.
getSort
());
banner
.
setState
(
bannerPo
.
getState
());
if
(
bannerPo
.
getProvince
()
!=
null
&&
bannerPo
.
getProvince
().
length
>
0
)
{
banner
.
setProvince
(
Arrays
.
asList
(
bannerPo
.
getProvince
()).
stream
().
collect
(
Collectors
.
joining
(
","
))
);
banner
.
setProvince
(
","
+
Arrays
.
asList
(
bannerPo
.
getProvince
()).
stream
().
collect
(
Collectors
.
joining
(
","
))
+
","
);
}
if
(
bannerPo
.
getCity
()
!=
null
&&
bannerPo
.
getCity
().
length
>
0
)
{
banner
.
setCity
(
Arrays
.
asList
(
bannerPo
.
getCity
()).
stream
().
collect
(
Collectors
.
joining
(
","
))
);
banner
.
setCity
(
","
+
Arrays
.
asList
(
bannerPo
.
getCity
()).
stream
().
collect
(
Collectors
.
joining
(
","
))
+
","
);
}
if
(
bannerPo
.
getArea
()
!=
null
&&
bannerPo
.
getArea
().
length
>
0
)
{
banner
.
setArea
(
Arrays
.
asList
(
bannerPo
.
getArea
()).
stream
().
collect
(
Collectors
.
joining
(
","
))
);
banner
.
setArea
(
","
+
Arrays
.
asList
(
bannerPo
.
getArea
()).
stream
().
collect
(
Collectors
.
joining
(
","
))
+
","
);
}
if
(
bannerPo
.
getShopIds
()
!=
null
&&
bannerPo
.
getShopIds
().
length
>
0
)
{
banner
.
setShopIds
(
Arrays
.
asList
(
bannerPo
.
getShopIds
()).
stream
().
map
(
x
->
String
.
valueOf
(
x
)).
collect
(
Collectors
.
joining
(
","
))
);
banner
.
setShopIds
(
","
+
Arrays
.
asList
(
bannerPo
.
getShopIds
()).
stream
().
map
(
x
->
String
.
valueOf
(
x
)).
collect
(
Collectors
.
joining
(
","
))
+
","
);
}
return
banner
;
}
public
List
<
BannerVo
>
copyBanner
(
List
<
SysBanner
>
banners
)
{
List
<
BannerVo
>
bannerVos
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isEmpty
(
banners
))
{
return
bannerVos
;
}
banners
.
forEach
(
banner
->
bannerVos
.
add
(
copyBanner
(
banner
)));
return
bannerVos
;
}
private
BannerVo
copyBanner
(
SysBanner
banner
)
{
BannerVo
bannerVo
=
new
BannerVo
();
bannerVo
.
setId
(
banner
.
getId
());
...
...
@@ -144,21 +136,27 @@ public class SysBannerServiceImpl implements ISysBannerService {
bannerVo
.
setType
(
banner
.
getType
());
bannerVo
.
setTarget
(
banner
.
getTarget
());
bannerVo
.
setSort
(
banner
.
getSort
());
bannerVo
.
setProvinceStr
(
banner
.
getProvince
());
bannerVo
.
setCityStr
(
banner
.
getCity
());
bannerVo
.
setAreaStr
(
banner
.
getArea
());
bannerVo
.
setShopIdsStr
(
banner
.
getShopIds
());
bannerVo
.
setState
(
banner
.
getState
());
if
(!
StringUtils
.
isEmpty
(
banner
.
getProvince
()))
{
bannerVo
.
setProvince
(
banner
.
getProvince
().
split
(
","
));
String
str
=
trim
(
banner
.
getProvince
());
bannerVo
.
setProvinceStr
(
str
);
bannerVo
.
setProvince
(
str
.
split
(
","
));
}
if
(!
StringUtils
.
isEmpty
(
banner
.
getCity
()))
{
bannerVo
.
setCity
(
banner
.
getCity
().
split
(
","
));
String
str
=
trim
(
banner
.
getCity
());
bannerVo
.
setCityStr
(
str
);
bannerVo
.
setCity
(
str
.
split
(
","
));
}
if
(!
StringUtils
.
isEmpty
(
banner
.
getArea
()))
{
bannerVo
.
setArea
(
banner
.
getArea
().
split
(
","
));
String
str
=
trim
(
banner
.
getArea
());
bannerVo
.
setAreaStr
(
str
);
bannerVo
.
setArea
(
str
.
split
(
","
));
}
if
(!
StringUtils
.
isEmpty
(
banner
.
getShopIds
()))
{
String
[]
shopIds
=
banner
.
getShopIds
().
split
(
","
);
String
str
=
trim
(
banner
.
getShopIds
());
bannerVo
.
setShopIdsStr
(
str
);
String
[]
shopIds
=
str
.
split
(
","
);
Long
[]
ids
=
new
Long
[
shopIds
.
length
];
for
(
int
i
=
0
;
i
<
shopIds
.
length
;
i
++)
{
ids
[
i
]
=
Long
.
parseLong
(
shopIds
[
i
]);
...
...
@@ -168,6 +166,22 @@ public class SysBannerServiceImpl implements ISysBannerService {
return
bannerVo
;
}
private
String
trim
(
String
str
)
{
if
(
StringUtils
.
isEmpty
(
str
))
{
return
str
;
}
return
str
.
substring
(
1
,
str
.
length
()
-
1
);
}
public
List
<
BannerVo
>
copyBanner
(
List
<
SysBanner
>
banners
)
{
List
<
BannerVo
>
bannerVos
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isEmpty
(
banners
))
{
return
bannerVos
;
}
banners
.
forEach
(
banner
->
bannerVos
.
add
(
copyBanner
(
banner
)));
return
bannerVos
;
}
@Override
public
Boolean
updateState
(
Long
bannerId
,
Integer
state
)
{
SysBanner
banner
=
new
SysBanner
();
...
...
@@ -207,7 +221,12 @@ public class SysBannerServiceImpl implements ISysBannerService {
List
<
SysBanner
>
list
=
new
ArrayList
<>();
banners
.
forEach
(
banner
->
{
if
(!
StringUtils
.
isEmpty
(
banner
.
getProvince
()))
{
Arrays
.
stream
(
banner
.
getProvince
().
split
(
","
)).
forEach
(
p
->
{
String
province
=
trim
(
banner
.
getProvince
());
if
(
province
.
equals
(
"0"
))
{
list
.
add
(
banner
);
return
;
}
Arrays
.
stream
(
province
.
split
(
","
)).
forEach
(
p
->
{
if
(
p
.
equals
(
shop
.
getProvince
()))
{
list
.
add
(
banner
);
return
;
...
...
@@ -215,7 +234,8 @@ public class SysBannerServiceImpl implements ISysBannerService {
});
}
if
(!
StringUtils
.
isEmpty
(
banner
.
getCity
()))
{
Arrays
.
stream
(
banner
.
getCity
().
split
(
","
)).
forEach
(
p
->
{
String
city
=
trim
(
banner
.
getCity
());
Arrays
.
stream
(
city
.
split
(
","
)).
forEach
(
p
->
{
if
(
p
.
equals
(
shop
.
getCity
()))
{
list
.
add
(
banner
);
return
;
...
...
@@ -223,7 +243,8 @@ public class SysBannerServiceImpl implements ISysBannerService {
});
}
if
(!
StringUtils
.
isEmpty
(
banner
.
getArea
()))
{
Arrays
.
stream
(
banner
.
getArea
().
split
(
","
)).
forEach
(
p
->
{
String
area
=
trim
(
banner
.
getArea
());
Arrays
.
stream
(
area
.
split
(
","
)).
forEach
(
p
->
{
if
(
p
.
equals
(
shop
.
getZone
()))
{
list
.
add
(
banner
);
return
;
...
...
@@ -231,7 +252,8 @@ public class SysBannerServiceImpl implements ISysBannerService {
});
}
if
(!
StringUtils
.
isEmpty
(
banner
.
getShopIds
()))
{
Arrays
.
stream
(
banner
.
getShopIds
().
split
(
","
)).
forEach
(
p
->
{
String
shopIds
=
trim
(
banner
.
getShopIds
());
Arrays
.
stream
(
shopIds
.
split
(
","
)).
forEach
(
p
->
{
if
(
p
.
equals
(
String
.
valueOf
(
shop
.
getId
())))
{
list
.
add
(
banner
);
return
;
...
...
@@ -257,6 +279,11 @@ public class SysBannerServiceImpl implements ISysBannerService {
List
<
String
>
list
=
new
ArrayList
<>();
banners
.
forEach
(
banner
->
{
if
(!
StringUtils
.
isEmpty
(
banner
.
getProvince
()))
{
String
province
=
trim
(
banner
.
getProvince
());
if
(
province
.
equals
(
"0"
))
{
list
.
add
(
banner
.
getImage
());
return
;
}
Arrays
.
stream
(
banner
.
getProvince
().
split
(
","
)).
forEach
(
p
->
{
if
(
p
.
equals
(
shop
.
getProvince
()))
{
list
.
add
(
banner
.
getImage
());
...
...
@@ -265,7 +292,8 @@ public class SysBannerServiceImpl implements ISysBannerService {
});
}
if
(!
StringUtils
.
isEmpty
(
banner
.
getCity
()))
{
Arrays
.
stream
(
banner
.
getCity
().
split
(
","
)).
forEach
(
p
->
{
String
city
=
trim
(
banner
.
getCity
());
Arrays
.
stream
(
city
.
split
(
","
)).
forEach
(
p
->
{
if
(
p
.
equals
(
shop
.
getCity
()))
{
list
.
add
(
banner
.
getImage
());
return
;
...
...
@@ -273,7 +301,8 @@ public class SysBannerServiceImpl implements ISysBannerService {
});
}
if
(!
StringUtils
.
isEmpty
(
banner
.
getArea
()))
{
Arrays
.
stream
(
banner
.
getArea
().
split
(
","
)).
forEach
(
p
->
{
String
area
=
trim
(
banner
.
getArea
());
Arrays
.
stream
(
area
.
split
(
","
)).
forEach
(
p
->
{
if
(
p
.
equals
(
shop
.
getZone
()))
{
list
.
add
(
banner
.
getImage
());
return
;
...
...
@@ -281,7 +310,8 @@ public class SysBannerServiceImpl implements ISysBannerService {
});
}
if
(!
StringUtils
.
isEmpty
(
banner
.
getShopIds
()))
{
Arrays
.
stream
(
banner
.
getShopIds
().
split
(
","
)).
forEach
(
p
->
{
String
shopIds
=
trim
(
banner
.
getShopIds
());
Arrays
.
stream
(
shopIds
.
split
(
","
)).
forEach
(
p
->
{
if
(
p
.
equals
(
String
.
valueOf
(
shop
.
getId
())))
{
list
.
add
(
banner
.
getImage
());
return
;
...
...
@@ -293,7 +323,7 @@ public class SysBannerServiceImpl implements ISysBannerService {
}
public
void
translateArea
(
List
<
BannerVo
>
bannerVos
)
{
if
(
CollectionUtils
.
isEmpty
(
bannerVos
))
{
if
(
CollectionUtils
.
isEmpty
(
bannerVos
))
{
return
;
}
List
<
String
>
province
=
new
ArrayList
<>(
16
);
...
...
soss-system/src/main/resources/mapper/system/SysBannerMapper.xml
View file @
af4d8834
...
...
@@ -19,15 +19,15 @@
<result
property=
"updatedAt"
column=
"updated_at"
/>
</resultMap>
<select
id=
"selectBanner"
resultMap=
"BannerResult"
parameterType=
"
SysBanner
"
>
<select
id=
"selectBanner"
resultMap=
"BannerResult"
parameterType=
"
BannerListPo
"
>
select * from sys_banner
<where>
<if
test=
"type != null "
>
type = #{type}
</if>
<if
test=
"target != null "
>
and target = #{target}
</if>
<if
test=
"province != null and province != ''"
>
and province like concat('%
', #{province}, '
%')
</if>
<if
test=
"city != null and city != ''"
>
and city like concat('%
', #{city}, '
%')
</if>
<if
test=
"area != null and area != ''"
>
and area like concat('%
', #{area}, '
%')
</if>
<if
test=
"shopId
s != null and shopIds != ''"
>
and shop_ids like concat('%', #{shopIds}, '
%')
</if>
<if
test=
"province != null and province != ''"
>
and province like concat('%
,', #{province}, ',
%')
</if>
<if
test=
"city != null and city != ''"
>
and city like concat('%
,', #{city}, ',
%')
</if>
<if
test=
"area != null and area != ''"
>
and area like concat('%
,', #{area}, ',
%')
</if>
<if
test=
"shopId
!= null and shopId != ''"
>
and shop_ids like concat('%,', #{shopId}, ',
%')
</if>
<if
test=
"state != null "
>
and state = #{state}
</if>
</where>
order by created_at desc
...
...
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