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

修复后台订单bug

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