提交 04fbb2fa authored 作者: 吴德鹏's avatar 吴德鹏

修复后台订单bug

上级 f73489f0
......@@ -126,11 +126,26 @@ public class AdvertisementController {
@ResponseBody
public R getAdvertisementItem(@RequestParam Map<String, Object> params) {
Query query = new Query(params);
List<TbCfStationItemEntity> itemList = tbCfStationItemService.getAdvertisementItem(params.get("adId").toString());
int count = advertisementItemService.getAdItemCount(params.get("adId").toString(), null);
PageUtils pageUtil = new PageUtils(itemList, count, query.getLimit(), query.getPage());
List<TbCfStationItemEntity> itemList = tbCfStationItemService.getAdvertisementItem(query);
int total = advertisementItemService.getAdItemCount(query);
PageUtils pageUtil = new PageUtils(itemList, total, query.getLimit(), query.getPage());
return R.ok().put("page", pageUtil);
}
/**
* @RequestMapping("/list")
* @RequiresPermissions("advertisement:list")
* @ResponseBody
* public R list(@RequestParam Map<String, Object> params) {
* //查询列表数据
* Query query = new Query(params);
*
* List<AdvertisementEntity> advertisementList = advertisementService.queryList(query);
* int total = advertisementService.queryTotal(query);
*
* PageUtils pageUtil = new PageUtils(advertisementList, total, query.getLimit(), query.getPage());
*
* return R.ok().put("page", pageUtil);
* }
*/
}
......@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -75,7 +76,10 @@ 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++) {
int count = advertisementItemService.getAdItemCount(aId, itemIdArr[i]);
Map map=new HashMap();
map.put("adId",aId);
map.put("itemId",itemIdArr[i]);
int count = advertisementItemService.getAdItemCount(map);
if (count > 0)
continue;
AdvertisementItemEntity advertisementItem = new AdvertisementItemEntity();
......
......@@ -3,6 +3,8 @@ package com.platform.dao;
import com.platform.entity.AdvertisementItemEntity;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* Dao
*
......@@ -11,7 +13,7 @@ import org.apache.ibatis.annotations.Param;
*/
public interface AdvertisementItemDao extends BaseDao<AdvertisementItemEntity> {
int getAdItemCount(@Param("adId") String adId, @Param("itemId") String itemId);
int getAdItemCount(Map<String, Object> map);
int deleteByItem(String itemId);
}
......@@ -6,6 +6,7 @@ import com.platform.entity.TbCfStationItemEntityExtends;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 站点商品Dao
......@@ -41,6 +42,6 @@ public interface TbCfStationItemDao extends BaseDao<TbCfStationItemEntity> {
TbCfStationItemEntity downSortItem(Integer sort);
List<TbCfStationItemEntity> getAdvertisementItem(String adId);
List<TbCfStationItemEntity> getAdvertisementItem(Map<String, Object> map);
}
......@@ -69,7 +69,7 @@ public interface AdvertisementItemService {
*/
int deleteBatch(String[] adIds);
int getAdItemCount(String adId,String itemId);
int getAdItemCount(Map<String, Object> map);
int deleteByItem(String itemId);
}
......@@ -110,5 +110,5 @@ public interface TbCfStationItemService {
int exchangeItemSort(String itemId,Integer sort);
List<TbCfStationItemEntity> getAdvertisementItem(String adId);
List<TbCfStationItemEntity> getAdvertisementItem(Map<String, Object> map);
}
......@@ -57,8 +57,8 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService {
}
@Override
public int getAdItemCount(String adId,String itemId) {
return advertisementItemDao.getAdItemCount(adId, itemId);
public int getAdItemCount(Map<String, Object> map) {
return advertisementItemDao.getAdItemCount(map);
}
@Override
......
......@@ -565,9 +565,9 @@ public class TbCfStationItemServiceImpl implements TbCfStationItemService {
}
@Override
public List<TbCfStationItemEntity> getAdvertisementItem(String adId) {
public List<TbCfStationItemEntity> getAdvertisementItem(Map<String, Object> map) {
return tbCfStationItemDao.getAdvertisementItem(adId);
return tbCfStationItemDao.getAdvertisementItem(map);
}
......
......@@ -47,14 +47,14 @@
from advertisement
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
AND ad_name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by id desc
order by create_time desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
......@@ -66,7 +66,7 @@
select count(*) from advertisement
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
AND ad_name LIKE concat('%',#{name},'%')
</if>
</select>
......@@ -98,14 +98,14 @@
<update id="update" parameterType="com.platform.entity.AdvertisementEntity">
update advertisement
<set>
<if test="adName != null">`ad_name` = #{adName}, </if>
<if test="adLink != null">`ad_link` = #{adLink}, </if>
<if test="picture != null">`picture` = #{picture}, </if>
<if test="status != null">`status` = #{status}, </if>
<if test="startTime != null">`start_time` = #{startTime}, </if>
<if test="endTime != null">`end_time` = #{endTime}, </if>
<if test="createTime != null">`create_time` = #{createTime}, </if>
<if test="updateTime != null">`update_time` = #{updateTime}, </if>
<if test="adName != null">`ad_name` = #{adName},</if>
<if test="adLink != null">`ad_link` = #{adLink},</if>
<if test="picture != null">`picture` = #{picture},</if>
<if test="status != null">`status` = #{status},</if>
<if test="startTime != null">`start_time` = #{startTime},</if>
<if test="endTime != null">`end_time` = #{endTime},</if>
<if test="createTime != null">`create_time` = #{createTime},</if>
<if test="updateTime != null">`update_time` = #{updateTime},</if>
<if test="remark != null">`remark` = #{remark}</if>
</set>
where id = #{id}
......
......@@ -100,6 +100,9 @@
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
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryByItems" resultType="com.platform.entity.TbCfStationItemEntityExtends">
......
......@@ -219,7 +219,7 @@ let vm = new Vue({
$("#adItemjqGrid").Grid({
url: '../advertisement/getAdvertisementItem?adId=' + vm.tempId,
colModel: [
{label: 'itemId', name: 'itemId', index: 'item_id', key: true, hidden: true},
{label: 'itemId', name: 'itemId', key: true, index: 'item_id', hidden: true},
{label: '商品图片', name: 'itemImg', index: 'item_img', width: 100, formatter: imageFormat},
{label: '商品编号', name: 'itemCode', index: 'item_code', width: 160},
{label: '商品名称', name: 'itemName', index: 'item_name', width: 160},
......@@ -245,13 +245,15 @@ let vm = new Vue({
},
update: function (event) {
$("#searchjqGrid").jqGrid("clearGridData");
$("#adItemjqGrid").jqGrid("clearGridData");
let id = getSelectedRow("#jqGrid");
if (id == null) {
return;
}
vm.showList = false;
vm.title = "修改";
vm.getItems(id);
vm.btn_Search(id);
vm.getInfo(id);
},
saveOrUpdate: function (event) {
......@@ -263,14 +265,14 @@ let vm = new Vue({
alert("广告链接不能为空")
return;
}
if (vm.advertisement.picture == null || vm.advertisement.picture == '') {
alert("广告图片不能为空")
return;
}
if (vm.advertisement.status == null || vm.advertisement.status == '') {
alert("广告状态不能为空")
return;
}
if (vm.advertisement.picture == null || vm.advertisement.picture == '') {
alert("广告图片不能为空")
return;
}
if (vm.advertisement.startTime == null || vm.advertisement.startTime == '') {
alert("广告开始时间不能为空")
return;
......@@ -284,7 +286,7 @@ let vm = new Vue({
return;
}
let url = vm.advertisement.id == null ? "../advertisement/save" : "../advertisement/update";
let ids = getSelectedRows("#searchjqGrid");
let ids = $("#searchjqGrid").getGridParam("selarrrow");
vm.advertisement.itemIds = ids;
if (vm.advertisement.id == null || vm.advertisement.id == '' || vm.advertisement.id == 'undefined') {
vm.advertisement.id = vm.tempId;
......@@ -330,20 +332,18 @@ let vm = new Vue({
vm.advertisement = r.advertisement;
}
});
this.getItems(id);
this.btn_Search(id);
},
btn_Search(id) {
$("#adItemjqGrid").jqGrid('setGridParam', {
url: '../advertisement/getAdvertisementItem?adId=' + id, page: 1
url: '../advertisement/getAdvertisementItem?adId=' + id
}).trigger('reloadGrid');
},
getItems(id) {
$("#adItemjqGrid").Grid({
url: '../advertisement/getAdvertisementItem?adId=' + id,
colModel: [
{label: 'itemId', name: 'itemId', index: 'item_id', key: true, hidden: true},
{label: 'itemId', name: 'itemId', key: true, index: 'item_id', hidden: true},
{label: '商品图片', name: 'itemImg', index: 'item_img', width: 100, formatter: imageFormat},
{label: '商品编号', name: 'itemCode', index: 'item_code', width: 160},
{label: '商品名称', name: 'itemName', index: 'item_name', width: 160},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论