Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-enterprise
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
base_platform_enterprise
gic-platform-enterprise
Commits
edb15597
Commit
edb15597
authored
Aug 12, 2019
by
zhiwj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改品牌库
parent
88bc5a91
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
8 deletions
+52
-8
PlatformBrandApiService.java
...a/com/gic/enterprise/service/PlatformBrandApiService.java
+1
-1
TabPlatformBrandRefMapper.java
.../gic/enterprise/dao/mapper/TabPlatformBrandRefMapper.java
+7
-2
PlatformBrandRefService.java
...a/com/gic/enterprise/service/PlatformBrandRefService.java
+4
-0
PlatformBrandRefServiceImpl.java
.../enterprise/service/impl/PlatformBrandRefServiceImpl.java
+10
-0
PlatformBrandApiServiceImpl.java
...enterprise/service/outer/PlatformBrandApiServiceImpl.java
+11
-4
TabPlatformBrandRefMapper.xml
...e/src/main/resources/mapper/TabPlatformBrandRefMapper.xml
+18
-0
PlatformBrandController.java
...gic/operation/web/controller/PlatformBrandController.java
+1
-1
No files found.
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/service/PlatformBrandApiService.java
View file @
edb15597
...
...
@@ -147,7 +147,7 @@ public interface PlatformBrandApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse
<
Integer
>
mergeBrandRef
(
Integer
fromBrandId
,
String
toBrandName
);
ServiceResponse
<
Integer
>
mergeBrandRef
(
String
fromBrandId
,
String
toBrandName
);
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/dao/mapper/TabPlatformBrandRefMapper.java
View file @
edb15597
...
...
@@ -58,7 +58,7 @@ public interface TabPlatformBrandRefMapper {
Integer
countByPlatformBrandId
(
@Param
(
"platformBrandId"
)
Integer
platformBrandId
);
List
<
Map
<
String
,
Integer
>>
countByPlatformBrandIds
(
@Param
(
"ids"
)
List
<
Integer
>
platformBrandIdList
);
List
<
Map
<
String
,
Integer
>>
countByPlatformBrandIds
(
@Param
(
"ids"
)
List
<
Integer
>
platformBrandIdList
);
Integer
delRef
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
,
@Param
(
"enterpriseBrandId"
)
Integer
enterpriseBrandId
);
...
...
@@ -66,5 +66,9 @@ public interface TabPlatformBrandRefMapper {
Page
<
TabPlatformBrandRef
>
listByPlatformBrandRef
(
TabPlatformBrandRef
brandRef
);
Integer
updateRef
(
@Param
(
"fromBrandId"
)
Integer
fromBrandId
,
@Param
(
"toBrandId"
)
Integer
toBrandId
);
Integer
updateRef
(
@Param
(
"fromBrandId"
)
Integer
fromBrandId
,
@Param
(
"toBrandId"
)
Integer
toBrandId
);
Integer
updateRefs
(
@Param
(
"ids"
)
List
<
Integer
>
fromBrandIds
,
@Param
(
"toBrandId"
)
Integer
platformBrandId
);
Integer
delBrandByIds
(
@Param
(
"ids"
)
List
<
Integer
>
fromBrandIds
);
}
\ No newline at end of file
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/PlatformBrandRefService.java
View file @
edb15597
...
...
@@ -21,4 +21,8 @@ public interface PlatformBrandRefService {
Page
<
TabPlatformBrandRef
>
listByPlatformBrandRef
(
Integer
platformBrandId
);
Integer
updateRef
(
Integer
fromBrandId
,
Integer
toBrandId
);
Integer
updateRefs
(
List
<
Integer
>
fromBrandIds
,
Integer
platformBrandId
);
Integer
delBrandByIds
(
List
<
Integer
>
fromBrandIds
);
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/impl/PlatformBrandRefServiceImpl.java
View file @
edb15597
...
...
@@ -73,4 +73,14 @@ public class PlatformBrandRefServiceImpl implements PlatformBrandRefService {
public
Integer
updateRef
(
Integer
fromBrandId
,
Integer
toBrandId
)
{
return
tabPlatformBrandRefMapper
.
updateRef
(
fromBrandId
,
toBrandId
);
}
@Override
public
Integer
updateRefs
(
List
<
Integer
>
fromBrandIds
,
Integer
platformBrandId
)
{
return
tabPlatformBrandRefMapper
.
updateRefs
(
fromBrandIds
,
platformBrandId
);
}
@Override
public
Integer
delBrandByIds
(
List
<
Integer
>
fromBrandIds
)
{
return
tabPlatformBrandRefMapper
.
delBrandByIds
(
fromBrandIds
);
}
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/PlatformBrandApiServiceImpl.java
View file @
edb15597
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.GlobalInfo
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.enterprise.constant.BrandCreateTypeEnum
;
import
com.gic.enterprise.constant.Constants
;
...
...
@@ -26,6 +27,7 @@ import org.springframework.stereotype.Service;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
@Service
(
"platformBrandApiService"
)
public
class
PlatformBrandApiServiceImpl
implements
PlatformBrandApiService
{
...
...
@@ -200,17 +202,22 @@ public class PlatformBrandApiServiceImpl implements PlatformBrandApiService {
}
@Override
public
ServiceResponse
<
Integer
>
mergeBrandRef
(
Integer
fromBrandId
,
String
toBrandName
)
{
if
(
fromBrandId
==
null
||
StringUtils
.
isBlank
(
toBrandName
))
{
public
ServiceResponse
<
Integer
>
mergeBrandRef
(
String
fromBrandId
,
String
toBrandName
)
{
if
(
StringUtils
.
isBlank
(
fromBrandId
)
||
StringUtils
.
isBlank
(
toBrandName
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
ErrorCode
.
PARAMETER_ERROR
.
getMsg
());
}
TabPlatformBrand
platformBrand
=
this
.
platformBrandService
.
getByBrandName
(
toBrandName
);
if
(
platformBrand
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
NOTEXISTS
.
getCode
(),
"品牌名称不存在或已失效"
);
}
Integer
line
=
this
.
platformBrandRefService
.
updateRef
(
fromBrandId
,
platformBrand
.
getPlatformBrandId
());
List
<
Integer
>
fromBrandIds
=
Stream
.
of
(
fromBrandId
.
split
(
GlobalInfo
.
FLAG_COMMA
)).
map
(
Integer:
:
valueOf
).
collect
(
Collectors
.
toList
());
if
(
fromBrandIds
.
contains
(
platformBrand
.
getPlatformBrandId
()))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
OPERATION_FAILED
.
getCode
(),
"目标品牌存在在源品牌中,请重新选择品牌"
);
}
Integer
line
=
this
.
platformBrandRefService
.
updateRefs
(
fromBrandIds
,
platformBrand
.
getPlatformBrandId
());
if
(
line
>
0
)
{
return
this
.
delBrandById
(
fromBrandId
);
platformBrandRefService
.
delBrandByIds
(
fromBrandIds
);
return
ServiceResponse
.
success
();
}
else
{
return
ServiceResponse
.
failure
(
ErrorCode
.
NOTEXISTS
.
getCode
(),
ErrorCode
.
NOTEXISTS
.
getMsg
());
}
...
...
gic-platform-enterprise-service/src/main/resources/mapper/TabPlatformBrandRefMapper.xml
View file @
edb15597
...
...
@@ -180,4 +180,22 @@
<update
id=
"updateRef"
>
update tab_platform_brand_ref set platform_brand_id = #{toBrandId} where status = 1 and platform_brand_id = #{fromBrandId}
</update>
<update
id=
"updateRefs"
>
update tab_platform_brand_ref set platform_brand_id = #{toBrandId} where status = 1
<if
test=
"null != ids"
>
and platform_brand_id in
<foreach
collection=
"ids"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</update>
<update
id=
"delBrandByIds"
>
update tab_platform_brand_ref set status = 0 where status = 1
<if
test=
"null != ids"
>
and platform_brand_id in
<foreach
collection=
"ids"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</update>
</mapper>
gic-platform-operation-web/src/main/java/com/gic/operation/web/controller/PlatformBrandController.java
View file @
edb15597
...
...
@@ -69,7 +69,7 @@ public class PlatformBrandController {
}
@RequestMapping
(
"/brand-merge"
)
public
RestResponse
mergeBrand
(
Integer
fromBrandId
,
String
toBrandName
)
{
public
RestResponse
mergeBrand
(
String
fromBrandId
,
String
toBrandName
)
{
if
(
fromBrandId
==
null
||
StringUtils
.
isBlank
(
toBrandName
))
{
return
RestResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
ErrorCode
.
PARAMETER_ERROR
.
getMsg
());
}
...
...
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