|
|
@@ -3,19 +3,13 @@ package com.goafanti.banners.controller;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
-
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
-import javax.validation.Valid;
|
|
|
-
|
|
|
-import org.junit.runner.Request;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.util.Assert;
|
|
|
-import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
-
|
|
|
import com.goafanti.banners.enums.BannersType;
|
|
|
import com.goafanti.banners.service.BannersService;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
@@ -93,38 +87,83 @@ public class AdminBannersApiController extends BaseApiController {
|
|
|
}
|
|
|
return res().data(types);
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 新增轮播图
|
|
|
+ * @param b
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@RequestMapping(value="/save" ,method=RequestMethod.POST)
|
|
|
public Result save(Banners b){
|
|
|
Result result=new Result();
|
|
|
result.setData(bannersService.insertBanner(b));
|
|
|
return result;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 删除轮播图
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@RequestMapping(value="/delete" ,method=RequestMethod.POST)
|
|
|
public Result delete(String id){
|
|
|
Result result=new Result();
|
|
|
result.setData(bannersService.deleteBanner(id));
|
|
|
return result;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 轮播图详情
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value="/details" ,method=RequestMethod.GET)
|
|
|
+ public Result details(String id){
|
|
|
+ Result result=new Result();
|
|
|
+ result.setData(bannersService.selectByPrimaryKey(id));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 修改轮播图
|
|
|
+ * @param b
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@RequestMapping(value="/update" ,method=RequestMethod.POST)
|
|
|
public Result details(Banners b){
|
|
|
Result result=new Result();
|
|
|
result.setData(bannersService.updateBanner(b));
|
|
|
return result;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 获取分页轮播图
|
|
|
+ * @param apiUrl
|
|
|
+ * @param client
|
|
|
+ * @param pageSize
|
|
|
+ * @param pageNo
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+
|
|
|
@RequestMapping(value="/list" ,method=RequestMethod.GET)
|
|
|
public Result list(String apiUrl,Integer client,Integer pageSize,Integer pageNo,HttpServletRequest request){
|
|
|
Result result=new Result();
|
|
|
result.setData(bannersService.findBannersList( apiUrl,client, pageSize, pageNo));
|
|
|
return result;
|
|
|
}
|
|
|
- @RequestMapping(value="/appList" ,method=RequestMethod.GET)
|
|
|
+ /**
|
|
|
+ * 获取集合轮播图
|
|
|
+ * @param apiUrl
|
|
|
+ * @param client
|
|
|
+ * @param pageSize
|
|
|
+ * @param pageNo
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value="/adminList" ,method=RequestMethod.GET)
|
|
|
public Result appList(String apiUrl,Integer client,Integer pageSize,Integer pageNo,HttpServletRequest request){
|
|
|
Result result=new Result();
|
|
|
- result.setData(bannersService.findAppBannersList( apiUrl,client, pageSize, pageNo));
|
|
|
+ result.setData(bannersService.findAdminBannersList( apiUrl,client, pageSize, pageNo));
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 图片上传
|
|
|
@@ -134,7 +173,7 @@ public class AdminBannersApiController extends BaseApiController {
|
|
|
Result res = new Result();
|
|
|
AttachmentType attachmentType = AttachmentType.getField(sign);
|
|
|
if (attachmentType == AttachmentType.BANNERS_PIC) {
|
|
|
- res.setData(handleFiles(res, "/banners", false, req, sign, "banners"));
|
|
|
+ res.setData(handleFiles(res, "/", false, req, sign, "banners"));
|
|
|
} else {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "图片标示"));
|
|
|
}
|