Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
C
chinafrica
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
chinafrica
Commits
4d48a354
提交
4d48a354
authored
10月 08, 2020
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
广告投放页优化
上级
af1db774
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
192 行增加
和
24 行删除
+192
-24
AdvertisementItemController.java
.../com/platform/controller/AdvertisementItemController.java
+19
-5
AdvertisementItemDao.java
.../src/main/java/com/platform/dao/AdvertisementItemDao.java
+9
-1
AdvertisementItemEntity.java
...ain/java/com/platform/entity/AdvertisementItemEntity.java
+33
-1
TbCfStationItemEntityExtends.java
...ava/com/platform/entity/TbCfStationItemEntityExtends.java
+20
-0
AdvertisementItemService.java
...n/java/com/platform/service/AdvertisementItemService.java
+4
-1
AdvertisementItemServiceImpl.java
...m/platform/service/impl/AdvertisementItemServiceImpl.java
+35
-2
AdvertisementItemDao.xml
.../main/resources/com/platform/dao/AdvertisementItemDao.xml
+45
-6
TbCfStationItemDao.xml
...rc/main/resources/com/platform/dao/TbCfStationItemDao.xml
+4
-1
advertisement.js
platform-admin/src/main/webapp/js/sys/advertisement.js
+23
-7
没有找到文件。
platform-admin/src/main/java/com/platform/controller/AdvertisementItemController.java
浏览文件 @
4d48a354
...
...
@@ -76,9 +76,9 @@ public class AdvertisementItemController {
public
R
saveBatch
(
@RequestParam
(
"aId"
)
String
aId
,
@RequestParam
(
"itemIds"
)
String
itemIds
)
{
String
itemIdArr
[]
=
itemIds
.
split
(
","
);
for
(
int
i
=
0
;
i
<
itemIdArr
.
length
;
i
++)
{
Map
map
=
new
HashMap
();
map
.
put
(
"adId"
,
aId
);
map
.
put
(
"itemId"
,
itemIdArr
[
i
]);
Map
map
=
new
HashMap
();
map
.
put
(
"adId"
,
aId
);
map
.
put
(
"itemId"
,
itemIdArr
[
i
]);
int
count
=
advertisementItemService
.
getAdItemCount
(
map
);
if
(
count
>
0
)
continue
;
...
...
@@ -129,11 +129,25 @@ public class AdvertisementItemController {
@RequestMapping
(
"/deleteByItem"
)
@ResponseBody
public
R
deleteByItem
(
@RequestParam
(
"itemId"
)
String
itemId
)
{
int
res
=
advertisementItemService
.
deleteByItem
(
itemId
);
public
R
deleteByItem
(
@RequestParam
(
"itemId"
)
String
itemId
,
@RequestParam
(
"adId"
)
String
adId
)
{
int
res
=
advertisementItemService
.
deleteByItem
(
itemId
,
adId
);
if
(
res
>
0
)
{
return
R
.
ok
();
}
return
R
.
error
(
"操作失败"
);
}
@RequestMapping
(
"/setItemTop"
)
@ResponseBody
public
R
setItemTop
(
@RequestParam
(
"itemId"
)
String
itemId
,
@RequestParam
(
"adId"
)
String
adId
)
{
int
res
=
advertisementItemService
.
setItemTop
(
itemId
,
adId
);
if
(
res
>
0
)
{
return
R
.
ok
();
}
else
if
(
res
==
-
1
)
{
return
R
.
error
(
"最多置顶60个商品"
);
}
return
R
.
error
(
"操作失败"
);
}
}
platform-admin/src/main/java/com/platform/dao/AdvertisementItemDao.java
浏览文件 @
4d48a354
...
...
@@ -15,5 +15,13 @@ public interface AdvertisementItemDao extends BaseDao<AdvertisementItemEntity> {
int
getAdItemCount
(
Map
<
String
,
Object
>
map
);
int
deleteByItem
(
String
itemId
);
int
deleteByItem
(
@Param
(
"itemId"
)
String
itemId
,
@Param
(
"adId"
)
String
adId
);
int
getMaxSort
();
int
setItemTop
(
@Param
(
"top"
)
Integer
top
,
@Param
(
"itemId"
)
String
itemId
,
@Param
(
"adId"
)
String
adId
);
AdvertisementItemEntity
getAdItemById
(
@Param
(
"itemId"
)
String
itemId
,
@Param
(
"adId"
)
String
adId
);
int
updateAdItem
(
AdvertisementItemEntity
advertisementItemEntity
);
}
platform-admin/src/main/java/com/platform/entity/AdvertisementItemEntity.java
浏览文件 @
4d48a354
...
...
@@ -8,7 +8,7 @@ import java.util.Date;
* 表名 advertisement_item
*
* @author lipengjun
* @date 2020-
09-25 14:48:21
* @date 2020-
10-07 15:50:04
*/
public
class
AdvertisementItemEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -21,6 +21,14 @@ public class AdvertisementItemEntity implements Serializable {
* 商品ID
*/
private
String
itemId
;
/**
* 置顶
*/
private
Integer
isTop
;
/**
* 排序
*/
private
Integer
sort
;
/**
* 设置:广告投放ID
...
...
@@ -48,6 +56,30 @@ public class AdvertisementItemEntity implements Serializable {
public
String
getItemId
()
{
return
itemId
;
}
/**
* 设置:置顶
*/
public
void
setIsTop
(
Integer
isTop
)
{
this
.
isTop
=
isTop
;
}
/**
* 获取:置顶
*/
public
Integer
getIsTop
()
{
return
isTop
;
}
/**
* 设置:排序
*/
public
void
setSort
(
Integer
sort
)
{
this
.
sort
=
sort
;
}
/**
* 获取:排序
*/
public
Integer
getSort
()
{
return
sort
;
}
}
platform-admin/src/main/java/com/platform/entity/TbCfStationItemEntityExtends.java
浏览文件 @
4d48a354
...
...
@@ -12,6 +12,8 @@ public class TbCfStationItemEntityExtends extends TbCfStationItemEntity implemen
private
String
itemDesc
;
private
BigDecimal
discountPrice
;
private
String
uname
;
private
Integer
isTop
;
private
Integer
sort
;
public
String
getUname
()
{
return
uname
;
...
...
@@ -62,4 +64,22 @@ public class TbCfStationItemEntityExtends extends TbCfStationItemEntity implemen
public
void
setGoodtype
(
String
goodtype
)
{
this
.
goodtype
=
goodtype
;
}
public
Integer
getIsTop
()
{
return
isTop
;
}
public
void
setIsTop
(
Integer
isTop
)
{
this
.
isTop
=
isTop
;
}
@Override
public
Integer
getSort
()
{
return
sort
;
}
@Override
public
void
setSort
(
Integer
sort
)
{
this
.
sort
=
sort
;
}
}
platform-admin/src/main/java/com/platform/service/AdvertisementItemService.java
浏览文件 @
4d48a354
package
com
.
platform
.
service
;
import
com.platform.entity.AdvertisementItemEntity
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -71,5 +72,7 @@ public interface AdvertisementItemService {
int
getAdItemCount
(
Map
<
String
,
Object
>
map
);
int
deleteByItem
(
String
itemId
);
int
deleteByItem
(
String
itemId
,
String
adId
);
int
setItemTop
(
String
itemId
,
String
adId
);
}
platform-admin/src/main/java/com/platform/service/impl/AdvertisementItemServiceImpl.java
浏览文件 @
4d48a354
...
...
@@ -4,9 +4,11 @@ import com.platform.dao.AdvertisementItemDao;
import
com.platform.entity.AdvertisementItemEntity
;
import
com.platform.service.AdvertisementItemService
;
import
com.platform.utils.IdUtil
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -62,7 +64,38 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService {
}
@Override
public
int
deleteByItem
(
String
itemId
)
{
return
advertisementItemDao
.
deleteByItem
(
itemId
);
public
int
deleteByItem
(
String
itemId
,
String
adId
)
{
return
advertisementItemDao
.
deleteByItem
(
itemId
,
adId
);
}
@Override
public
int
setItemTop
(
String
itemId
,
String
adId
)
{
if
(
StringUtils
.
isBlank
(
itemId
)
||
StringUtils
.
isBlank
(
adId
))
{
return
0
;
}
AdvertisementItemEntity
byId
=
advertisementItemDao
.
getAdItemById
(
itemId
,
adId
);
if
(
byId
==
null
)
{
return
0
;
}
String
top
=
byId
.
getIsTop
().
toString
();
//置顶
if
(
"0"
.
equals
(
top
))
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"adId"
,
adId
);
paramMap
.
put
(
"itemId"
,
itemId
);
int
count
=
advertisementItemDao
.
getAdItemCount
(
paramMap
);
//最多置顶60个
if
(
count
>=
60
)
{
return
-
1
;
}
int
maxSort
=
advertisementItemDao
.
getMaxSort
();
byId
.
setSort
(++
maxSort
);
byId
.
setIsTop
(
1
);
}
else
{
//取消置顶
byId
.
setSort
(
0
);
byId
.
setIsTop
(
0
);
}
return
advertisementItemDao
.
updateAdItem
(
byId
);
}
}
platform-admin/src/main/resources/com/platform/dao/AdvertisementItemDao.xml
浏览文件 @
4d48a354
...
...
@@ -6,16 +6,31 @@
<resultMap
type=
"com.platform.entity.AdvertisementItemEntity"
id=
"advertisementItemMap"
>
<result
property=
"adId"
column=
"ad_id"
/>
<result
property=
"itemId"
column=
"item_id"
/>
<result
property=
"isTop"
column=
"is_top"
/>
<result
property=
"sort"
column=
"sort"
/>
</resultMap>
<select
id=
"queryObject"
resultType=
"com.platform.entity.AdvertisementItemEntity"
>
select
`ad_id`,
`item_id`
`item_id`,
`is_top`,
`sort`
from advertisement_item
where ad_id = #{id}
</select>
<select
id=
"getAdItemById"
resultType=
"com.platform.entity.AdvertisementItemEntity"
>
select
`ad_id`,
`item_id`,
`is_top`,
`sort`
from advertisement_item
where ad_id = #{adId}
and item_id=#{itemId}
</select>
<select
id=
"getAdItemCount"
resultType=
"int"
>
select count(1) from advertisement_item where ad_id = #{adId}
<if
test=
"itemId != null and itemId.trim() != ''"
>
...
...
@@ -23,15 +38,24 @@
</if>
</select>
<update
id=
"setItemTop"
>
update advertisement_item set is_top=#{top} where item_id=#{itemId} and ad_id=#{adId}
</update>
<select
id=
"getMaxSort"
resultType=
"int"
>
select max(sort) from advertisement_item
</select>
<delete
id=
"deleteByItem"
>
delete from advertisement_item where item_id=#{itemId}
delete from advertisement_item where item_id=#{itemId}
and ad_id=#{adId}
</delete>
<select
id=
"queryList"
resultType=
"com.platform.entity.AdvertisementItemEntity"
>
select
`ad_id`,
`item_id`
`item_id`,
`is_top`,
`sort`
from advertisement_item
WHERE 1=1
<if
test=
"name != null and name.trim() != ''"
>
...
...
@@ -61,20 +85,35 @@
<insert
id=
"save"
parameterType=
"com.platform.entity.AdvertisementItemEntity"
>
insert into advertisement_item(
`ad_id`,
`item_id`)
`item_id`,
`is_top`,
`sort`)
values(
#{adId},
#{itemId})
#{itemId},
#{isTop},
#{sort})
</insert>
<update
id=
"update"
parameterType=
"com.platform.entity.AdvertisementItemEntity"
>
update advertisement_item
<set>
<if
test=
"itemId != null"
>
`item_id` = #{itemId}
</if>
<if
test=
"itemId != null"
>
`item_id` = #{itemId},
</if>
<if
test=
"isTop != null"
>
`is_top` = #{isTop},
</if>
<if
test=
"sort != null"
>
`sort` = #{sort}
</if>
</set>
where ad_id = #{adId}
</update>
<update
id=
"updateAdItem"
parameterType=
"com.platform.entity.AdvertisementItemEntity"
>
update advertisement_item
<set>
<if
test=
"isTop != null"
>
`is_top` = #{isTop},
</if>
<if
test=
"sort != null"
>
`sort` = #{sort}
</if>
</set>
where ad_id = #{adId} and item_id = #{itemId}
</update>
<delete
id=
"delete"
>
delete from advertisement_item where ad_id = #{value}
</delete>
...
...
platform-admin/src/main/resources/com/platform/dao/TbCfStationItemDao.xml
浏览文件 @
4d48a354
...
...
@@ -93,13 +93,16 @@
i.`creator`,
d.descripition_name dname,
t.goodstwotype_title title,
o.goodstype_title goodtype
o.goodstype_title goodtype,
a.is_top,
a.sort
from advertisement_item a
left join tb_cf_station_item i on i.item_id=a.item_id
left JOIN tb_cf_goodstype o ON o.goodstype_id = i.item_category
left JOIN tb_cf_goodstwotype t ON i.item_categorytwo=t.goodstwotype_id
left JOIN tb_cf_descripiton d ON i.item_descrition_id=d.descripition_id
where a.ad_id=#{adId} and i.enable_flag!=0
order by a.is_top desc,a.sort desc,i.create_time desc
<if
test=
"offset != null and limit != null"
>
limit #{offset}, #{limit}
</if>
...
...
platform-admin/src/main/webapp/js/sys/advertisement.js
浏览文件 @
4d48a354
...
...
@@ -130,18 +130,16 @@ let vm = new Vue({
}
},
methods
:
{
delItem
(
id
)
{
delItem
(
itemId
)
{
let
id
=
getSelectedRow
(
"#jqGrid"
);
confirm
(
'确定要删除选中的记录?'
,
function
()
{
Ajax
.
request
({
url
:
"../advertisementitem/deleteByItem?itemId="
+
id
,
url
:
"../advertisementitem/deleteByItem?itemId="
+
i
temId
+
'&adId='
+
i
d
,
type
:
"POST"
,
contentType
:
"application/json"
,
successCallback
:
function
()
{
alert
(
'操作成功'
,
function
(
index
)
{
let
page
=
$
(
"#adItemjqGrid"
).
jqGrid
(
'getGridParam'
,
'page'
);
$
(
"#adItemjqGrid"
).
jqGrid
(
'setGridParam'
,
{
page
:
page
}).
trigger
(
"reloadGrid"
);
vm
.
btn_Search
(
id
);
});
}
});
...
...
@@ -273,7 +271,12 @@ let vm = new Vue({
{
label
:
'操作'
,
index
:
'operate'
,
width
:
120
,
formatter
:
function
(
value
,
grid
,
rows
)
{
return
'<span class="label label-info pointer" onclick="vm.delItem(
\'
'
+
rows
.
itemId
+
'
\'
)">移除</span> '
if
(
rows
.
isTop
==
1
)
{
return
'<span class="label label-danger pointer" onclick="vm.itemTop(
\'
'
+
rows
.
itemId
+
'
\'
)">取消置顶</span> '
+
'<span class="label label-info pointer" onclick="vm.delItem(
\'
'
+
rows
.
itemId
+
'
\'
)">移除</span> '
}
return
'<span class="label label-info pointer" onclick="vm.itemTop(
\'
'
+
rows
.
itemId
+
'
\'
)">置顶</span> '
+
'<span class="label label-info pointer" onclick="vm.delItem(
\'
'
+
rows
.
itemId
+
'
\'
)">移除</span> '
}
}
],
...
...
@@ -283,6 +286,19 @@ let vm = new Vue({
vm
.
btn_Search
(
id
);
vm
.
getInfo
(
id
);
},
itemTop
(
itemId
)
{
let
id
=
getSelectedRow
(
"#jqGrid"
);
let
url
=
'../advertisementitem/setItemTop?itemId='
+
itemId
+
'&adId='
+
id
;
Ajax
.
request
({
url
:
url
,
type
:
"GET"
,
contentType
:
"application/json"
,
successCallback
:
function
(
resultData
)
{
vm
.
btn_Search
(
id
);
!
notShowMessage
?
iview
.
Message
.
success
(
resultData
.
success
)
:
null
;
}
});
},
saveOrUpdate
:
function
(
event
)
{
if
(
vm
.
advertisement
.
adName
==
null
||
vm
.
advertisement
.
adName
==
''
)
{
alert
(
"广告名称不能为空"
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论