Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
C
chinafrica
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
chinafrica
Commits
d3ce48a9
提交
d3ce48a9
authored
9月 09, 2020
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
商品置顶
上级
aa02bcd0
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
210 行增加
和
12 行删除
+210
-12
TbCfStationItemController.java
...va/com/platform/controller/TbCfStationItemController.java
+69
-0
TbCfStationItemDao.java
...in/src/main/java/com/platform/dao/TbCfStationItemDao.java
+4
-0
TbCfStationItemService.java
...ain/java/com/platform/service/TbCfStationItemService.java
+9
-0
TbCfStationItemServiceImpl.java
...com/platform/service/impl/TbCfStationItemServiceImpl.java
+59
-0
TbCfStationItemDao.xml
...rc/main/resources/com/platform/dao/TbCfStationItemDao.xml
+9
-1
tbcfstationitem.js
platform-admin/src/main/webapp/js/sys/tbcfstationitem.js
+60
-11
没有找到文件。
platform-admin/src/main/java/com/platform/controller/TbCfStationItemController.java
浏览文件 @
d3ce48a9
...
...
@@ -225,4 +225,73 @@ public class TbCfStationItemController extends ApiBaseAction {
List
<
SysUserEntity
>
userList
=
tbCfStationItemService
.
queryCreator
();
return
R
.
ok
().
put
(
"list"
,
userList
);
}
/**
* 商品置顶:
* 1)设置itemTop 为 1
* 2)设置sort 为 置顶总数+1
*
* @return R
*/
@RequestMapping
(
"/itemTop"
)
@ResponseBody
public
R
itemTop
(
@RequestParam
(
"itemId"
)
String
itemId
)
{
int
res
=
tbCfStationItemService
.
itemTop
(
itemId
);
if
(
res
>
0
)
{
return
R
.
ok
();
}
else
if
(
res
==
-
1
)
{
return
R
.
error
(
"该商品已下架,不能置顶"
);
}
return
R
.
error
(
"置顶失败"
);
}
/**
* 取消置顶
*/
@RequestMapping
(
"/cancelTop"
)
@ResponseBody
public
R
cancelTop
(
@RequestParam
(
"itemId"
)
String
itemId
)
{
int
res
=
tbCfStationItemService
.
cancelTop
(
itemId
);
if
(
res
>
0
)
{
return
R
.
ok
();
}
return
R
.
error
(
"取消置顶失败"
);
}
/**
* 商品向上
*
* @param itemId
* @return R
*/
@RequestMapping
(
"/itemUpward"
)
@ResponseBody
public
R
itemUpward
(
@RequestParam
(
"itemId"
)
String
itemId
)
{
int
res
=
tbCfStationItemService
.
itemUpward
(
itemId
);
if
(
res
>
0
)
{
return
R
.
ok
();
}
else
if
(
res
==
-
1
)
{
return
R
.
error
(
"商品已在顶部"
);
}
return
R
.
error
(
"交换失败"
);
}
/**
* 商品向下
*
* @param itemId
* @return R
*/
@RequestMapping
(
"/itemDownward"
)
@ResponseBody
public
R
itemDownward
(
@RequestParam
(
"itemId"
)
String
itemId
)
{
int
res
=
tbCfStationItemService
.
itemDownward
(
itemId
);
if
(
res
>
0
)
{
return
R
.
ok
();
}
else
if
(
res
==
-
1
)
{
return
R
.
error
(
"商品已在底部"
);
}
return
R
.
error
(
"交换失败"
);
}
}
platform-admin/src/main/java/com/platform/dao/TbCfStationItemDao.java
浏览文件 @
d3ce48a9
...
...
@@ -26,4 +26,8 @@ public interface TbCfStationItemDao extends BaseDao<TbCfStationItemEntity> {
List
<
TbCfStationItemEntity
>
queryByCodeList
(
String
code
);
List
<
TbCfStationItemEntity
>
getItemByIds
(
String
[]
ids
);
int
queryTopCount
();
TbCfStationItemEntity
queryItemBySort
(
Integer
sort
);
}
platform-admin/src/main/java/com/platform/service/TbCfStationItemService.java
浏览文件 @
d3ce48a9
...
...
@@ -97,5 +97,14 @@ public interface TbCfStationItemService {
void
importExcel
(
MultipartFile
multipartFile
);
R
importShopifyProducts
(
MultipartFile
multipartFile
);
List
<
SysUserEntity
>
queryCreator
();
int
itemTop
(
String
itemId
);
int
cancelTop
(
String
itemId
);
int
itemUpward
(
String
itemId
);
int
itemDownward
(
String
itemId
);
}
platform-admin/src/main/java/com/platform/service/impl/TbCfStationItemServiceImpl.java
浏览文件 @
d3ce48a9
...
...
@@ -476,5 +476,64 @@ public class TbCfStationItemServiceImpl implements TbCfStationItemService {
public
List
<
SysUserEntity
>
queryCreator
()
{
return
sysUserDao
.
queryList
(
null
);
}
@Override
public
int
itemTop
(
String
itemId
)
{
TbCfStationItemEntity
item
=
tbCfStationItemDao
.
queryObject
(
itemId
);
if
(
"2"
.
equals
(
item
.
getEnableFlag
().
toString
()))
{
return
-
1
;
}
item
.
setItemTop
(
1
);
int
count
=
tbCfStationItemDao
.
queryTopCount
();
item
.
setSort
(++
count
);
return
tbCfStationItemDao
.
update
(
item
);
}
@Override
public
int
cancelTop
(
String
itemId
)
{
TbCfStationItemEntity
item
=
tbCfStationItemDao
.
queryObject
(
itemId
);
item
.
setItemTop
(
0
);
item
.
setSort
(
0
);
return
tbCfStationItemDao
.
update
(
item
);
}
@Override
public
int
itemUpward
(
String
itemId
)
{
int
res
=
0
;
TbCfStationItemEntity
item
=
tbCfStationItemDao
.
queryObject
(
itemId
);
Integer
sort
=
item
.
getSort
();
if
(
"1"
.
equals
(
sort
.
toString
()))
{
return
-
1
;
}
TbCfStationItemEntity
upItem
=
tbCfStationItemDao
.
queryItemBySort
(
sort
-
1
);
upItem
.
setSort
(
sort
);
int
res1
=
tbCfStationItemDao
.
update
(
upItem
);
item
.
setSort
(
sort
-
1
);
int
res2
=
tbCfStationItemDao
.
update
(
item
);
if
(
res1
>
0
&&
res2
>
0
)
{
res
=
1
;
}
return
res
;
}
@Override
public
int
itemDownward
(
String
itemId
)
{
int
res
=
0
;
TbCfStationItemEntity
item
=
tbCfStationItemDao
.
queryObject
(
itemId
);
Integer
sort
=
item
.
getSort
();
int
count
=
tbCfStationItemDao
.
queryTopCount
();
if
(
String
.
valueOf
(
count
).
equals
(
sort
.
toString
()))
{
return
-
1
;
}
TbCfStationItemEntity
downItem
=
tbCfStationItemDao
.
queryItemBySort
(
sort
+
1
);
downItem
.
setSort
(
sort
);
int
res1
=
tbCfStationItemDao
.
update
(
downItem
);
item
.
setSort
(
sort
+
1
);
int
res2
=
tbCfStationItemDao
.
update
(
item
);
if
(
res1
>
0
&&
res2
>
0
)
{
res
=
1
;
}
return
res
;
}
}
platform-admin/src/main/resources/com/platform/dao/TbCfStationItemDao.xml
浏览文件 @
d3ce48a9
...
...
@@ -184,7 +184,7 @@
order by ${sidx} ${order}
</when>
<otherwise>
order by i.item_top desc,i.sort asc
order by i.item_top desc,i.sort asc
,i.create_time desc
</otherwise>
</choose>
<if
test=
"offset != null and limit != null"
>
...
...
@@ -205,6 +205,14 @@
i.item_id = #{itemId}
</select>
<select
id=
"queryTopCount"
resultType=
"int"
>
select count(1) from tb_cf_station_item where item_top=1
</select>
<select
id=
"queryItemBySort"
resultType=
"com.platform.entity.ItemDescSkus"
>
select * from tb_cf_station_item where sort =#{sort} limit 1
</select>
<select
id=
"queryTotal"
resultType=
"int"
>
select count(*) from tb_cf_station_item
WHERE 1=1 and enable_flag!=0
...
...
platform-admin/src/main/webapp/js/sys/tbcfstationitem.js
浏览文件 @
d3ce48a9
...
...
@@ -15,24 +15,21 @@ $(function () {
/*{label: '所属平台', name: 'platformCode', index: 'platform_code', width: 80},
{label: '平台名', name: 'platformName', index: 'platform_name', width: 80},*/
{
label
:
'供应商'
,
name
:
'supplier'
,
index
:
'supplier'
,
width
:
80
},
{
label
:
'置顶'
,
name
:
'itemTop'
,
index
:
'item_top'
,
width
:
80
,
hidden
:
true
},
{
label
:
'置顶'
,
name
:
'itemTop'
,
index
:
'item_top'
,
width
:
80
,
hidden
:
true
},
{
label
:
'商品一级分类'
,
name
:
'goodtype'
,
index
:
'goodtype'
,
width
:
80
},
{
label
:
'商品二级分类'
,
name
:
'title'
,
index
:
'title'
,
width
:
80
},
{
label
:
'商品三级分类'
,
name
:
'dname'
,
index
:
'itemDescritionId'
,
width
:
80
},
{
label
:
'状态'
,
name
:
'enableFlag'
,
index
:
'enable_flag'
,
width
:
60
,
formatter
:
itemStatusFormat
},
{
label
:
'创建日期'
,
name
:
'createTime'
,
index
:
'create_time'
,
width
:
80
},
/* {label: '创建人', name: 'uname', index: 'uname', width: 80},*/
/* {label: '创建人', name: 'uname', index: 'uname', width: 80},*/
{
label
:
'操作'
,
index
:
'operate'
,
width
:
120
,
formatter
:
function
(
value
,
grid
,
rows
)
{
if
(
rows
.
itemTop
===
1
)
{
return
'<span class="label label-danger pointer" onclick="vm.placedTop(
\'
'
+
rows
.
id
+
'
\'
)">置顶</span> '
+
'<span class="label label-warning pointer" onclick="vm.off(
\'
'
+
rows
.
id
+
'
\'
)" ">取消</span> '
+
'<span class="label label-success pointer" onclick="vm.activate(
\'
'
+
rows
.
id
+
'
\'
)" ">up</span>'
+
'<span class="label label-warning pointer" onclick="vm.off(
\'
'
+
rows
.
id
+
'
\'
)" ">down</span> '
;
return
'<span class="label label-primary pointer" onclick="vm.itemUpward(
\'
'
+
rows
.
itemId
+
'
\'
)" ">up</span> '
+
'<span class="label label-success pointer" onclick="vm.itemDownward(
\'
'
+
rows
.
itemId
+
'
\'
)" ">down</span>  '
+
'<span class="label label-danger pointer" onclick="vm.cancelTop(
\'
'
+
rows
.
itemId
+
'
\'
)" ">取消置顶</span> '
;
}
return
'<span class="label label-info pointer" onclick="vm.placedTop(
\'
'
+
rows
.
id
+
'
\'
)">置顶</span> '
+
'<span class="label label-warning pointer" onclick="vm.off(
\'
'
+
rows
.
id
+
'
\'
)" ">up</span> '
+
'<span class="label label-success pointer" onclick="vm.activate(
\'
'
+
rows
.
id
+
'
\'
)" ">down</span>'
;
return
'<span class="label label-info pointer" onclick="vm.itemTop(
\'
'
+
rows
.
itemId
+
'
\'
)">置顶</span> '
}
}
]
...
...
@@ -118,6 +115,58 @@ let vm = new Vue({
handleProductAttr_Batch
:
[],
},
methods
:
{
//商品置顶
itemTop
(
id
)
{
Ajax
.
request
({
url
:
"../tbcfstationitem/itemTop?itemId="
+
id
,
type
:
"GET"
,
contentType
:
"application/json"
,
successCallback
:
function
(
resultData
)
{
vm
.
reload
();
// console.log(resultData);
!
notShowMessage
?
iview
.
Message
.
success
(
resultData
.
success
)
:
null
;
}
});
},
//商品取消置顶
cancelTop
(
id
)
{
Ajax
.
request
({
url
:
"../tbcfstationitem/cancelTop?itemId="
+
id
,
type
:
"GET"
,
contentType
:
"application/json"
,
successCallback
:
function
(
resultData
)
{
vm
.
reload
();
// console.log(resultData);
!
notShowMessage
?
iview
.
Message
.
success
(
resultData
.
success
)
:
null
;
}
});
},
//商品向上
itemUpward
(
id
)
{
Ajax
.
request
({
url
:
"../tbcfstationitem/itemUpward?itemId="
+
id
,
type
:
"GET"
,
contentType
:
"application/json"
,
successCallback
:
function
(
resultData
)
{
vm
.
reload
();
// console.log(resultData);
!
notShowMessage
?
iview
.
Message
.
success
(
resultData
.
success
)
:
null
;
}
});
},
//商品向下
itemDownward
(
id
)
{
Ajax
.
request
({
url
:
"../tbcfstationitem/itemDownward?itemId="
+
id
,
type
:
"GET"
,
contentType
:
"application/json"
,
successCallback
:
function
(
resultData
)
{
vm
.
reload
();
// console.log(resultData);
!
notShowMessage
?
iview
.
Message
.
success
(
resultData
.
success
)
:
null
;
}
});
},
//保存批量操作价格的数据
saveBatchDataPrice
(
e
)
{
if
(
this
.
batchAmount
&&
this
.
batchCount
)
{
...
...
@@ -368,9 +417,9 @@ let vm = new Vue({
changeGoodstype2
(
e
)
{
let
url
;
if
(
e
!=
null
)
{
url
=
"../tbcfstationitem/queryByItemTypeTwo?typeTwoId="
+
e
;
url
=
"../tbcfstationitem/queryByItemTypeTwo?typeTwoId="
+
e
;
}
else
{
url
=
"../tbcfstationitem/queryByItemTypeTwo?typeTwoId="
+
this
.
tbCfStationItem
.
itemCategorytwo
;
url
=
"../tbcfstationitem/queryByItemTypeTwo?typeTwoId="
+
this
.
tbCfStationItem
.
itemCategorytwo
;
}
let
that
=
this
;
Ajax
.
request
({
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论