提交 1612206b authored 作者: 林海冰's avatar 林海冰

新增广告模块

上级 53c2baf5
...@@ -2,18 +2,16 @@ ...@@ -2,18 +2,16 @@
package com.mall.controller.api; package com.mall.controller.api;
import java.util.HashMap; import com.mall.service.mengbeng.banner.BannerManager;
import java.util.List; import com.mall.util.PageData;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.mall.service.mengbeng.banner.BannerManager; import javax.annotation.Resource;
import com.mall.util.PageData; import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* ClassName:BannerApiController <br/> * ClassName:BannerApiController <br/>
...@@ -55,12 +53,9 @@ public class BannerApiController { ...@@ -55,12 +53,9 @@ public class BannerApiController {
map.put("date", "pageSize为空"); map.put("date", "pageSize为空");
return map; return map;
} }
PageData pd = new PageData(); PageData pd = new PageData();
pd.put("pageSize", pageSize); pd.put("pageSize", pageSize);
pd.put("pageIndex", pageIndex); pd.put("pageIndex", pageIndex);
//查询分页数据 //查询分页数据
List<PageData> list =bannerService.pagingForuminfo(pd); List<PageData> list =bannerService.pagingForuminfo(pd);
// //查询满足查询的总条数 // //查询满足查询的总条数
......
...@@ -3,10 +3,7 @@ package com.mall.controller.tongmeng.advertisement; ...@@ -3,10 +3,7 @@ package com.mall.controller.tongmeng.advertisement;
import com.mall.controller.base.BaseController; import com.mall.controller.base.BaseController;
import com.mall.entity.Page; import com.mall.entity.Page;
import com.mall.service.mengbeng.advertisement.AdvertisementManager; import com.mall.service.mengbeng.advertisement.AdvertisementManager;
import com.mall.util.AppUtil; import com.mall.util.*;
import com.mall.util.Jurisdiction;
import com.mall.util.ObjectExcelView;
import com.mall.util.PageData;
import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.WebDataBinder;
...@@ -200,6 +197,107 @@ public class AdvertisementController extends BaseController { ...@@ -200,6 +197,107 @@ public class AdvertisementController extends BaseController {
return mv; return mv;
} }
@ResponseBody
@RequestMapping("/updateOrderCode")
public Map updateOrderCode(){
Map<String,String > map =new HashMap<>();
PageData pd = new PageData();
pd = this.getPageData();
String opetion = pd.getString("opetion");
String newId = pd.getString("newId");
String newCode = pd.getString("newCode");
try {
if (opetion.equals("1")) {
PageData orderPd = advertisementService.getMaxOrderCode();
int orderCode = Integer.valueOf(orderPd.get("advertisement_order").toString()) + 1;
PageData bannerPd = new PageData();
bannerPd.put("advertisement_id", newId);
bannerPd = advertisementService.findById(bannerPd);
bannerPd.put("advertisement_order", orderCode);
advertisementService.edit(bannerPd);
map.put("mag", "ok");
} else if (opetion.equals("2")) {
PageData orderPd = new PageData();
orderPd.put("advertisement_order", newCode);
//上一条信息
orderPd= advertisementService.getOneTopOrderCode(orderPd);
if(orderPd==null){
map.put("mag", "ok");
return map;
}
String topCode = orderPd.get("advertisement_order").toString();
orderPd.put("advertisement_order", newCode);
//操作的信息
PageData bannerPd = new PageData();
bannerPd.put("advertisement_id", newId);
bannerPd = advertisementService.findById(bannerPd);
bannerPd.put("advertisement_order", topCode);
advertisementService.edit(orderPd);
advertisementService.edit(bannerPd);
map.put("mag", "ok");
} else if (opetion.equals("3")) {
PageData orderPd = new PageData();
orderPd.put("advertisement_order", newCode);
//上一条信息
orderPd= advertisementService.getOneFooterOrderCode(orderPd);
if(orderPd==null){
map.put("mag", "ok");
return map;
}
String topCode = orderPd.get("advertisement_order").toString();
orderPd.put("advertisement_order", newCode);
//操作的信息
PageData bannerPd = new PageData();
bannerPd.put("advertisement_id", newId);
bannerPd = advertisementService.findById(bannerPd);
bannerPd.put("advertisement_order", topCode);
advertisementService.edit(orderPd);
advertisementService.edit(bannerPd);
map.put("mag", "ok");
} else {
PageData orderPd = advertisementService.getMinOrderCode();
int orderCode = Integer.valueOf(orderPd.get("advertisement_order").toString()) - 1;
PageData bannerPd = new PageData();
bannerPd.put("advertisement_id", newId);
bannerPd = advertisementService.findById(bannerPd);
bannerPd.put("advertisement_order", orderCode);
advertisementService.edit(bannerPd);
map.put("mag", "ok");
}
} catch (Exception e) {
e.printStackTrace();
map.put("mag", "no");
}
return map;
}
/**
* 改变用户状态
*/
@ResponseBody
@RequestMapping("/updateAdstate")
public ResultOutDto updateAdstate(String advertisement_id,Integer status){
try {
PageData pd = new PageData();
pd.put("advertisement_id",advertisement_id);
pd = advertisementService.findById(pd);
if(status!=0){
pd.put("advertisement_is_vaild", "0");
}else{
pd.put("advertisement_is_vaild", "1");
}
advertisementService.edit(pd);
} catch (Exception e) {
e.printStackTrace();
}//改变用户状态
return ResultOutDto.ok();
}
@InitBinder @InitBinder
public void initBinder(WebDataBinder binder){ public void initBinder(WebDataBinder binder){
DateFormat format = new SimpleDateFormat("yyyy-MM-dd"); DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
......
package com.mall.service.mengbeng.advertisement; package com.mall.service.mengbeng.advertisement;
import java.util.List;
import com.mall.entity.Page; import com.mall.entity.Page;
import com.mall.util.PageData; import com.mall.util.PageData;
import java.util.List;
/** /**
* 说明: 广告模块接口 * 说明: 广告模块接口
* 创建时间:2019-01-18 * 创建时间:2019-01-18
...@@ -52,6 +53,34 @@ public interface AdvertisementManager{ ...@@ -52,6 +53,34 @@ public interface AdvertisementManager{
* @throws Exception * @throws Exception
*/ */
public void deleteAll(String[] ArrayDATA_IDS)throws Exception; public void deleteAll(String[] ArrayDATA_IDS)throws Exception;
/**
* banner 获取排序吗
* @param
* @throws Exception
*/
public List<PageData> getAllOrderCode(PageData pd)throws Exception;
/**
* 获取最大的ORDER_CODE
* @return
*/
public PageData getMaxOrderCode()throws Exception;
/**
* 获取最小的ORDER_CODE
* @return
*/
public PageData getMinOrderCode()throws Exception;
/**
* 获取操作的上一条code
* @param orderPd
* @return
*/
public PageData getOneTopOrderCode(PageData orderPd)throws Exception;
/**
* 获取操作的下一条code
* @param orderPd
* @return
*/
public PageData getOneFooterOrderCode(PageData orderPd)throws Exception;
} }
...@@ -79,5 +79,36 @@ public class AdvertisementService implements AdvertisementManager { ...@@ -79,5 +79,36 @@ public class AdvertisementService implements AdvertisementManager {
dao.delete("AdvertisementMapper.deleteAll", ArrayDATA_IDS); dao.delete("AdvertisementMapper.deleteAll", ArrayDATA_IDS);
} }
@Override
public List<PageData> getAllOrderCode(PageData pd) throws Exception {
return (List<PageData>)dao.findForList("AdvertisementMapper.getAllOrderCode", pd);
}
@Override
public PageData getMaxOrderCode() throws Exception {
return (PageData) dao.findForObject("AdvertisementMapper.getMaxOrderCode",null);
}
/**
* 获取最小的ORDER_CODE
* @return
*/
@Override
public PageData getMinOrderCode() throws Exception {
return (PageData) dao.findForObject("AdvertisementMapper.getMinOrderCode",null);
}
@Override
public PageData getOneTopOrderCode(PageData orderPd) throws Exception {
return (PageData) dao.findForObject("AdvertisementMapper.getOneTopOrderCode",orderPd);
}
@Override
public PageData getOneFooterOrderCode(PageData orderPd) throws Exception {
return (PageData) dao.findForObject("AdvertisementMapper.getOneFooterOrderCode",orderPd);
}
} }
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
--> -->
) )
</if> </if>
order by advertisement_order desc
</select> </select>
<!-- 列表(全部) --> <!-- 列表(全部) -->
......
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>车全影后台管理</title> <title>桐盟商城APP后台管理</title>
<meta name="description" content="" /> <meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<!-- bootstrap & fontawesome --> <!-- bootstrap & fontawesome -->
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<form action="advertisement/${msg }.do" name="Form" id="Form" method="post"> <form action="${msg }.do" name="Form" id="Form" method="post">
<input type="hidden" name="advertisement_id" id="advertisement_id" value="${pd.advertisement_id}"/> <input type="hidden" name="advertisement_id" id="advertisement_id" value="${pd.advertisement_id}"/>
<div id="zhongxin" style="padding-top: 13px;"> <div id="zhongxin" style="padding-top: 13px;">
<table id="table_report" class="table table-striped table-bordered table-hover"> <table id="table_report" class="table table-striped table-bordered table-hover">
......
车全影 桐盟商城app
\ No newline at end of file \ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论