mall-admin代码改造
This commit is contained in:
parent
b5800856fb
commit
5262a232aa
@ -1,6 +1,6 @@
|
||||
package com.macro.mall.component;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
@ -8,6 +8,7 @@ import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.FieldError;
|
||||
|
||||
/**
|
||||
* HibernateValidator错误结果处理切面
|
||||
@ -28,7 +29,12 @@ public class BindingResultAspect {
|
||||
if (arg instanceof BindingResult) {
|
||||
BindingResult result = (BindingResult) arg;
|
||||
if (result.hasErrors()) {
|
||||
return new CommonResult().validateFailed(result);
|
||||
FieldError fieldError = result.getFieldError();
|
||||
if(fieldError!=null){
|
||||
return CommonResult.validateFailed(fieldError.getDefaultMessage());
|
||||
}else{
|
||||
return CommonResult.validateFailed();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.macro.mall.component;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.util.JsonUtil;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
@ -21,7 +21,7 @@ public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint {
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/json");
|
||||
response.getWriter().println(JsonUtil.objectToJson(new CommonResult().unauthorized(authException.getMessage())));
|
||||
response.getWriter().println(JsonUtil.objectToJson(CommonResult.unauthorized(authException.getMessage())));
|
||||
response.getWriter().flush();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.macro.mall.component;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.util.JsonUtil;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.web.access.AccessDeniedHandler;
|
||||
@ -23,7 +23,7 @@ public class RestfulAccessDeniedHandler implements AccessDeniedHandler{
|
||||
AccessDeniedException e) throws IOException, ServletException {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/json");
|
||||
response.getWriter().println(JsonUtil.objectToJson(new CommonResult().forbidden(e.getMessage())));
|
||||
response.getWriter().println(JsonUtil.objectToJson(CommonResult.forbidden(e.getMessage())));
|
||||
response.getWriter().flush();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.model.CmsPrefrenceArea;
|
||||
import com.macro.mall.service.CmsPrefrenceAreaService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -27,8 +27,8 @@ public class CmsPrefrenceAreaController {
|
||||
@ApiOperation("获取所有商品优选")
|
||||
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object listAll() {
|
||||
public CommonResult<List<CmsPrefrenceArea>> listAll() {
|
||||
List<CmsPrefrenceArea> prefrenceAreaList = prefrenceAreaService.listAll();
|
||||
return new CommonResult().success(prefrenceAreaList);
|
||||
return CommonResult.success(prefrenceAreaList);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.model.CmsSubject;
|
||||
import com.macro.mall.service.CmsSubjectService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -28,18 +29,18 @@ public class CmsSubjectController {
|
||||
@ApiOperation("获取全部商品专题")
|
||||
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object listAll() {
|
||||
public CommonResult<List<CmsSubject>> listAll() {
|
||||
List<CmsSubject> subjectList = subjectService.listAll();
|
||||
return new CommonResult().success(subjectList);
|
||||
return CommonResult.success(subjectList);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据专题名称分页获取专题")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getList(@RequestParam(value = "keyword", required = false) String keyword,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
|
||||
public CommonResult<CommonPage<CmsSubject>> getList(@RequestParam(value = "keyword", required = false) String keyword,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
|
||||
List<CmsSubject> subjectList = subjectService.list(keyword, pageNum, pageSize);
|
||||
return new CommonResult().pageSuccess(subjectList);
|
||||
return CommonResult.success(CommonPage.restPage(subjectList));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.model.OmsCompanyAddress;
|
||||
import com.macro.mall.service.OmsCompanyAddressService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -25,10 +25,10 @@ public class OmsCompanyAddressController {
|
||||
private OmsCompanyAddressService companyAddressService;
|
||||
|
||||
@ApiOperation("获取所有收货地址")
|
||||
@RequestMapping(value = "/list",method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list() {
|
||||
public CommonResult<List<OmsCompanyAddress>> list() {
|
||||
List<OmsCompanyAddress> companyAddressList = companyAddressService.list();
|
||||
return new CommonResult().success(companyAddressList);
|
||||
return CommonResult.success(companyAddressList);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.dto.*;
|
||||
import com.macro.mall.model.OmsOrder;
|
||||
import com.macro.mall.service.OmsOrderService;
|
||||
@ -25,86 +27,86 @@ public class OmsOrderController {
|
||||
@ApiOperation("查询订单")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list(OmsOrderQueryParam queryParam,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
public CommonResult<CommonPage<OmsOrder>> list(OmsOrderQueryParam queryParam,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<OmsOrder> orderList = orderService.list(queryParam, pageSize, pageNum);
|
||||
return new CommonResult().pageSuccess(orderList);
|
||||
return CommonResult.success(CommonPage.restPage(orderList));
|
||||
}
|
||||
|
||||
@ApiOperation("批量发货")
|
||||
@RequestMapping(value = "/update/delivery", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delivery(@RequestBody List<OmsOrderDeliveryParam> deliveryParamList) {
|
||||
public CommonResult delivery(@RequestBody List<OmsOrderDeliveryParam> deliveryParamList) {
|
||||
int count = orderService.delivery(deliveryParamList);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("批量关闭订单")
|
||||
@RequestMapping(value = "/update/close", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object close(@RequestParam("ids") List<Long> ids,@RequestParam String note) {
|
||||
int count = orderService.close(ids,note);
|
||||
public CommonResult close(@RequestParam("ids") List<Long> ids, @RequestParam String note) {
|
||||
int count = orderService.close(ids, note);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除订单")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@RequestParam("ids") List<Long> ids) {
|
||||
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
|
||||
int count = orderService.delete(ids);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取订单详情:订单信息、商品信息、操作记录")
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object detail(@PathVariable Long id) {
|
||||
public CommonResult<OmsOrderDetail> detail(@PathVariable Long id) {
|
||||
OmsOrderDetail orderDetailResult = orderService.detail(id);
|
||||
return new CommonResult().success(orderDetailResult);
|
||||
return CommonResult.success(orderDetailResult);
|
||||
}
|
||||
|
||||
@ApiOperation("修改收货人信息")
|
||||
@RequestMapping(value = "/update/receiverInfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateReceiverInfo(@RequestBody OmsReceiverInfoParam receiverInfoParam) {
|
||||
public CommonResult updateReceiverInfo(@RequestBody OmsReceiverInfoParam receiverInfoParam) {
|
||||
int count = orderService.updateReceiverInfo(receiverInfoParam);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改订单费用信息")
|
||||
@RequestMapping(value = "/update/moneyInfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateReceiverInfo(@RequestBody OmsMoneyInfoParam moneyInfoParam) {
|
||||
public CommonResult updateReceiverInfo(@RequestBody OmsMoneyInfoParam moneyInfoParam) {
|
||||
int count = orderService.updateMoneyInfo(moneyInfoParam);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("备注订单")
|
||||
@RequestMapping(value = "/update/note", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateNote(@RequestParam("id") Long id,
|
||||
@RequestParam("note") String note,
|
||||
@RequestParam("status") Integer status) {
|
||||
int count = orderService.updateNote(id,note,status);
|
||||
public CommonResult updateNote(@RequestParam("id") Long id,
|
||||
@RequestParam("note") String note,
|
||||
@RequestParam("status") Integer status) {
|
||||
int count = orderService.updateNote(id, note, status);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.dto.OmsOrderReturnApplyResult;
|
||||
import com.macro.mall.dto.OmsReturnApplyQueryParam;
|
||||
import com.macro.mall.dto.OmsUpdateStatusParam;
|
||||
@ -28,41 +29,41 @@ public class OmsOrderReturnApplyController {
|
||||
@ApiOperation("分页查询退货申请")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list(OmsReturnApplyQueryParam queryParam,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
public CommonResult<CommonPage<OmsOrderReturnApply>> list(OmsReturnApplyQueryParam queryParam,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<OmsOrderReturnApply> returnApplyList = returnApplyService.list(queryParam, pageSize, pageNum);
|
||||
return new CommonResult().pageSuccess(returnApplyList);
|
||||
return CommonResult.success(CommonPage.restPage(returnApplyList));
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除申请")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@RequestParam("ids") List<Long> ids) {
|
||||
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
|
||||
int count = returnApplyService.delete(ids);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取退货申请详情")
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getItem(@PathVariable Long id) {
|
||||
public CommonResult getItem(@PathVariable Long id) {
|
||||
OmsOrderReturnApplyResult result = returnApplyService.getItem(id);
|
||||
return new CommonResult().success(result);
|
||||
return CommonResult.success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("修改申请状态")
|
||||
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateStatus(@PathVariable Long id, @RequestBody OmsUpdateStatusParam statusParam) {
|
||||
public CommonResult updateStatus(@PathVariable Long id, @RequestBody OmsUpdateStatusParam statusParam) {
|
||||
int count = returnApplyService.updateStatus(id, statusParam);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.model.OmsOrderReturnReason;
|
||||
import com.macro.mall.service.OmsOrderReturnReasonService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -25,62 +26,62 @@ public class OmsOrderReturnReasonController {
|
||||
@ApiOperation("添加退货原因")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@RequestBody OmsOrderReturnReason returnReason) {
|
||||
public CommonResult create(@RequestBody OmsOrderReturnReason returnReason) {
|
||||
int count = orderReturnReasonService.create(returnReason);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改退货原因")
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long id, @RequestBody OmsOrderReturnReason returnReason) {
|
||||
int count = orderReturnReasonService.update(id,returnReason);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult update(@PathVariable Long id, @RequestBody OmsOrderReturnReason returnReason) {
|
||||
int count = orderReturnReasonService.update(id, returnReason);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除退货原因")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@RequestParam("ids") List<Long> ids) {
|
||||
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
|
||||
int count = orderReturnReasonService.delete(ids);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询全部退货原因")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list(@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<OmsOrderReturnReason> reasonList = orderReturnReasonService.list(pageSize,pageNum);
|
||||
return new CommonResult().pageSuccess(reasonList);
|
||||
public CommonResult<CommonPage<OmsOrderReturnReason>> list(@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<OmsOrderReturnReason> reasonList = orderReturnReasonService.list(pageSize, pageNum);
|
||||
return CommonResult.success(CommonPage.restPage(reasonList));
|
||||
}
|
||||
|
||||
@ApiOperation("获取单个退货原因详情信息")
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getItem(@PathVariable Long id) {
|
||||
public CommonResult<OmsOrderReturnReason> getItem(@PathVariable Long id) {
|
||||
OmsOrderReturnReason reason = orderReturnReasonService.getItem(id);
|
||||
return new CommonResult().success(reason);
|
||||
return CommonResult.success(reason);
|
||||
}
|
||||
|
||||
@ApiOperation("修改退货原因启用状态")
|
||||
@RequestMapping(value = "/update/status", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateStatus(@RequestParam(value = "status") Integer status,
|
||||
@RequestParam("ids") List<Long> ids) {
|
||||
int count = orderReturnReasonService.updateStatus(ids,status);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult updateStatus(@RequestParam(value = "status") Integer status,
|
||||
@RequestParam("ids") List<Long> ids) {
|
||||
int count = orderReturnReasonService.updateStatus(ids, status);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.model.OmsOrderSetting;
|
||||
import com.macro.mall.service.OmsOrderSettingService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -23,19 +23,19 @@ public class OmsOrderSettingController {
|
||||
@ApiOperation("获取指定订单设置")
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getItem(@PathVariable Long id) {
|
||||
public CommonResult<OmsOrderSetting> getItem(@PathVariable Long id) {
|
||||
OmsOrderSetting orderSetting = orderSettingService.getItem(id);
|
||||
return new CommonResult().success(orderSetting);
|
||||
return CommonResult.success(orderSetting);
|
||||
}
|
||||
|
||||
@ApiOperation("修改指定订单设置")
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long id, @RequestBody OmsOrderSetting orderSetting) {
|
||||
public CommonResult update(@PathVariable Long id, @RequestBody OmsOrderSetting orderSetting) {
|
||||
int count = orderSettingService.update(id,orderSetting);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.dto.OssCallbackResult;
|
||||
import com.macro.mall.dto.OssPolicyResult;
|
||||
import com.macro.mall.service.impl.OssServiceImpl;
|
||||
@ -18,26 +18,26 @@ import javax.servlet.http.HttpServletRequest;
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "OssController",description = "Oss管理")
|
||||
@Api(tags = "OssController", description = "Oss管理")
|
||||
@RequestMapping("/aliyun/oss")
|
||||
public class OssController {
|
||||
@Autowired
|
||||
private OssServiceImpl ossService;
|
||||
@Autowired
|
||||
private OssServiceImpl ossService;
|
||||
|
||||
@ApiOperation(value = "oss上传签名生成")
|
||||
@RequestMapping(value = "/policy",method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object policy() {
|
||||
OssPolicyResult result = ossService.policy();
|
||||
return new CommonResult().success(result);
|
||||
}
|
||||
@ApiOperation(value = "oss上传签名生成")
|
||||
@RequestMapping(value = "/policy", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<OssPolicyResult> policy() {
|
||||
OssPolicyResult result = ossService.policy();
|
||||
return CommonResult.success(result);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "oss上传成功回调")
|
||||
@RequestMapping(value = "callback",method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object callback(HttpServletRequest request) {
|
||||
OssCallbackResult ossCallbackResult = ossService.callback(request);
|
||||
return new CommonResult().success(ossCallbackResult);
|
||||
}
|
||||
@ApiOperation(value = "oss上传成功回调")
|
||||
@RequestMapping(value = "callback", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult<OssCallbackResult> callback(HttpServletRequest request) {
|
||||
OssCallbackResult ossCallbackResult = ossService.callback(request);
|
||||
return CommonResult.success(ossCallbackResult);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.dto.PmsBrandParam;
|
||||
import com.macro.mall.model.PmsBrand;
|
||||
import com.macro.mall.service.PmsBrandService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -19,7 +21,7 @@ import java.util.List;
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "PmsBrandController",description = "商品品牌管理")
|
||||
@Api(tags = "PmsBrandController", description = "商品品牌管理")
|
||||
@RequestMapping("/brand")
|
||||
public class PmsBrandController {
|
||||
@Autowired
|
||||
@ -29,21 +31,21 @@ public class PmsBrandController {
|
||||
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:brand:read')")
|
||||
public Object getList() {
|
||||
return new CommonResult().success(brandService.listAllBrand());
|
||||
public CommonResult<List<PmsBrand>> getList() {
|
||||
return CommonResult.success(brandService.listAllBrand());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加品牌")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:brand:create')")
|
||||
public Object create(@Validated @RequestBody PmsBrandParam pmsBrand, BindingResult result) {
|
||||
public CommonResult create(@Validated @RequestBody PmsBrandParam pmsBrand, BindingResult result) {
|
||||
CommonResult commonResult;
|
||||
int count = brandService.createBrand(pmsBrand);
|
||||
if (count == 1) {
|
||||
commonResult = new CommonResult().success(count);
|
||||
commonResult = CommonResult.success(count);
|
||||
} else {
|
||||
commonResult = new CommonResult().failed();
|
||||
commonResult = CommonResult.failed();
|
||||
}
|
||||
return commonResult;
|
||||
}
|
||||
@ -52,15 +54,15 @@ public class PmsBrandController {
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:brand:update')")
|
||||
public Object update(@PathVariable("id") Long id,
|
||||
@Validated @RequestBody PmsBrandParam pmsBrandParam,
|
||||
BindingResult result) {
|
||||
public CommonResult update(@PathVariable("id") Long id,
|
||||
@Validated @RequestBody PmsBrandParam pmsBrandParam,
|
||||
BindingResult result) {
|
||||
CommonResult commonResult;
|
||||
int count = brandService.updateBrand(id, pmsBrandParam);
|
||||
if (count == 1) {
|
||||
commonResult = new CommonResult().success(count);
|
||||
commonResult = CommonResult.success(count);
|
||||
} else {
|
||||
commonResult = new CommonResult().failed();
|
||||
commonResult = CommonResult.failed();
|
||||
}
|
||||
return commonResult;
|
||||
}
|
||||
@ -69,12 +71,12 @@ public class PmsBrandController {
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:brand:delete')")
|
||||
public Object delete(@PathVariable("id") Long id) {
|
||||
public CommonResult delete(@PathVariable("id") Long id) {
|
||||
int count = brandService.deleteBrand(id);
|
||||
if (count == 1) {
|
||||
return new CommonResult().success(null);
|
||||
return CommonResult.success(null);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,30 +84,31 @@ public class PmsBrandController {
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:brand:read')")
|
||||
public Object getList(@RequestParam(value = "keyword", required = false) String keyword,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
|
||||
return new CommonResult().pageSuccess(brandService.listBrand(keyword, pageNum, pageSize));
|
||||
public CommonResult<CommonPage<PmsBrand>> getList(@RequestParam(value = "keyword", required = false) String keyword,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
|
||||
List<PmsBrand> brandList = brandService.listBrand(keyword, pageNum, pageSize);
|
||||
return CommonResult.success(CommonPage.restPage(brandList));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据编号查询品牌信息")
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:brand:read')")
|
||||
public Object getItem(@PathVariable("id") Long id) {
|
||||
return new CommonResult().success(brandService.getBrand(id));
|
||||
public CommonResult<PmsBrand> getItem(@PathVariable("id") Long id) {
|
||||
return CommonResult.success(brandService.getBrand(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除品牌")
|
||||
@RequestMapping(value = "/delete/batch", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:brand:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
public CommonResult deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
int count = brandService.deleteBrand(ids);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,13 +116,13 @@ public class PmsBrandController {
|
||||
@RequestMapping(value = "/update/showStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:brand:update')")
|
||||
public Object updateShowStatus(@RequestParam("ids") List<Long> ids,
|
||||
public CommonResult updateShowStatus(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("showStatus") Integer showStatus) {
|
||||
int count = brandService.updateShowStatus(ids, showStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,13 +130,13 @@ public class PmsBrandController {
|
||||
@RequestMapping(value = "/update/factoryStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:brand:update')")
|
||||
public Object updateFactoryStatus(@RequestParam("ids") List<Long> ids,
|
||||
public CommonResult updateFactoryStatus(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("factoryStatus") Integer factoryStatus) {
|
||||
int count = brandService.updateFactoryStatus(ids, factoryStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.dto.PmsProductAttributeCategoryItem;
|
||||
import com.macro.mall.model.PmsProductAttributeCategory;
|
||||
import com.macro.mall.service.PmsProductAttributeCategoryService;
|
||||
@ -26,60 +27,60 @@ public class PmsProductAttributeCategoryController {
|
||||
@ApiOperation("添加商品属性分类")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@RequestParam String name) {
|
||||
public CommonResult create(@RequestParam String name) {
|
||||
int count = productAttributeCategoryService.create(name);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("修改商品属性分类")
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long id, @RequestParam String name) {
|
||||
public CommonResult update(@PathVariable Long id, @RequestParam String name) {
|
||||
int count = productAttributeCategoryService.update(id, name);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("删除单个商品属性分类")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object delete(@PathVariable Long id) {
|
||||
public CommonResult delete(@PathVariable Long id) {
|
||||
int count = productAttributeCategoryService.delete(id);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("获取单个商品属性分类信息")
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getItem(@PathVariable Long id) {
|
||||
public CommonResult<PmsProductAttributeCategory> getItem(@PathVariable Long id) {
|
||||
PmsProductAttributeCategory productAttributeCategory = productAttributeCategoryService.getItem(id);
|
||||
return new CommonResult().success(productAttributeCategory);
|
||||
return CommonResult.success(productAttributeCategory);
|
||||
}
|
||||
|
||||
@ApiOperation("分页获取所有商品属性分类")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getList(@RequestParam(defaultValue = "5") Integer pageSize, @RequestParam(defaultValue = "1") Integer pageNum) {
|
||||
public CommonResult<CommonPage<PmsProductAttributeCategory>> getList(@RequestParam(defaultValue = "5") Integer pageSize, @RequestParam(defaultValue = "1") Integer pageNum) {
|
||||
List<PmsProductAttributeCategory> productAttributeCategoryList = productAttributeCategoryService.getList(pageSize, pageNum);
|
||||
return new CommonResult().pageSuccess(productAttributeCategoryList);
|
||||
return CommonResult.success(CommonPage.restPage(productAttributeCategoryList));
|
||||
}
|
||||
|
||||
@ApiOperation("获取所有商品属性分类及其下属性")
|
||||
@RequestMapping(value = "/list/withAttr", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getListWithAttr() {
|
||||
public CommonResult<List<PmsProductAttributeCategoryItem>> getListWithAttr() {
|
||||
List<PmsProductAttributeCategoryItem> productAttributeCategoryResultList = productAttributeCategoryService.getListWithAttr();
|
||||
return new CommonResult().success(productAttributeCategoryResultList);
|
||||
return CommonResult.success(productAttributeCategoryResultList);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.dto.PmsProductAttributeParam;
|
||||
import com.macro.mall.dto.ProductAttrInfo;
|
||||
import com.macro.mall.model.PmsProductAttribute;
|
||||
@ -9,8 +10,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.validation.BindingResult;
|
||||
@ -33,63 +32,63 @@ public class PmsProductAttributeController {
|
||||
@ApiImplicitParams({@ApiImplicitParam(name = "type", value = "0表示属性,1表示参数", required = true, paramType = "query", dataType = "integer")})
|
||||
@RequestMapping(value = "/list/{cid}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getList(@PathVariable Long cid,
|
||||
@RequestParam(value = "type") Integer type,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
public CommonResult<CommonPage<PmsProductAttribute>> getList(@PathVariable Long cid,
|
||||
@RequestParam(value = "type") Integer type,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<PmsProductAttribute> productAttributeList = productAttributeService.getList(cid, type, pageSize, pageNum);
|
||||
return new CommonResult().pageSuccess(productAttributeList);
|
||||
return CommonResult.success(CommonPage.restPage(productAttributeList));
|
||||
}
|
||||
|
||||
@ApiOperation("添加商品属性信息")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@RequestBody PmsProductAttributeParam productAttributeParam, BindingResult bindingResult) {
|
||||
public CommonResult create(@RequestBody PmsProductAttributeParam productAttributeParam, BindingResult bindingResult) {
|
||||
int count = productAttributeService.create(productAttributeParam);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("修改商品属性信息")
|
||||
@RequestMapping(value = "/update/{id}",method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long id,@RequestBody PmsProductAttributeParam productAttributeParam,BindingResult bindingResult){
|
||||
int count = productAttributeService.update(id,productAttributeParam);
|
||||
public CommonResult update(@PathVariable Long id, @RequestBody PmsProductAttributeParam productAttributeParam, BindingResult bindingResult) {
|
||||
int count = productAttributeService.update(id, productAttributeParam);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("查询单个商品属性")
|
||||
@RequestMapping(value = "/{id}",method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getItem(@PathVariable Long id){
|
||||
public CommonResult<PmsProductAttribute> getItem(@PathVariable Long id) {
|
||||
PmsProductAttribute productAttribute = productAttributeService.getItem(id);
|
||||
return new CommonResult().success(productAttribute);
|
||||
return CommonResult.success(productAttribute);
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除商品属性")
|
||||
@RequestMapping(value = "/delete",method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@RequestParam("ids") List<Long> ids){
|
||||
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
|
||||
int count = productAttributeService.delete(ids);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("根据商品分类的id获取商品属性及属性分类")
|
||||
@RequestMapping(value = "/attrInfo/{productCategoryId}",method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/attrInfo/{productCategoryId}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getAttrInfo(@PathVariable Long productCategoryId){
|
||||
public CommonResult<List<ProductAttrInfo>> getAttrInfo(@PathVariable Long productCategoryId) {
|
||||
List<ProductAttrInfo> productAttrInfoList = productAttributeService.getProductAttrInfo(productCategoryId);
|
||||
return new CommonResult().success(productAttrInfoList);
|
||||
return CommonResult.success(productAttrInfoList);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.dto.PmsProductCategoryParam;
|
||||
import com.macro.mall.dto.PmsProductCategoryWithChildrenItem;
|
||||
import com.macro.mall.model.PmsProductCategory;
|
||||
@ -31,13 +32,13 @@ public class PmsProductCategoryController {
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:productCategory:create')")
|
||||
public Object create(@Validated @RequestBody PmsProductCategoryParam productCategoryParam,
|
||||
public CommonResult create(@Validated @RequestBody PmsProductCategoryParam productCategoryParam,
|
||||
BindingResult result) {
|
||||
int count = productCategoryService.create(productCategoryParam);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,15 +46,15 @@ public class PmsProductCategoryController {
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:productCategory:update')")
|
||||
public Object update(@PathVariable Long id,
|
||||
public CommonResult update(@PathVariable Long id,
|
||||
@Validated
|
||||
@RequestBody PmsProductCategoryParam productCategoryParam,
|
||||
BindingResult result) {
|
||||
int count = productCategoryService.update(id, productCategoryParam);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,32 +62,32 @@ public class PmsProductCategoryController {
|
||||
@RequestMapping(value = "/list/{parentId}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:productCategory:read')")
|
||||
public Object getList(@PathVariable Long parentId,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
public CommonResult<CommonPage<PmsProductCategory>> getList(@PathVariable Long parentId,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<PmsProductCategory> productCategoryList = productCategoryService.getList(parentId, pageSize, pageNum);
|
||||
return new CommonResult().pageSuccess(productCategoryList);
|
||||
return CommonResult.success(CommonPage.restPage(productCategoryList));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id获取商品分类")
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:productCategory:read')")
|
||||
public Object getItem(@PathVariable Long id) {
|
||||
public CommonResult<PmsProductCategory> getItem(@PathVariable Long id) {
|
||||
PmsProductCategory productCategory = productCategoryService.getItem(id);
|
||||
return new CommonResult().success(productCategory);
|
||||
return CommonResult.success(productCategory);
|
||||
}
|
||||
|
||||
@ApiOperation("删除商品分类")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:productCategory:delete')")
|
||||
public Object delete(@PathVariable Long id) {
|
||||
public CommonResult delete(@PathVariable Long id) {
|
||||
int count = productCategoryService.delete(id);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,12 +95,12 @@ public class PmsProductCategoryController {
|
||||
@RequestMapping(value = "/update/navStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:productCategory:update')")
|
||||
public Object updateNavStatus(@RequestParam("ids") List<Long> ids, @RequestParam("navStatus") Integer navStatus) {
|
||||
public CommonResult updateNavStatus(@RequestParam("ids") List<Long> ids, @RequestParam("navStatus") Integer navStatus) {
|
||||
int count = productCategoryService.updateNavStatus(ids, navStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,12 +108,12 @@ public class PmsProductCategoryController {
|
||||
@RequestMapping(value = "/update/showStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:productCategory:update')")
|
||||
public Object updateShowStatus(@RequestParam("ids") List<Long> ids, @RequestParam("showStatus") Integer showStatus) {
|
||||
public CommonResult updateShowStatus(@RequestParam("ids") List<Long> ids, @RequestParam("showStatus") Integer showStatus) {
|
||||
int count = productCategoryService.updateShowStatus(ids, showStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,8 +121,8 @@ public class PmsProductCategoryController {
|
||||
@RequestMapping(value = "/list/withChildren", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:productCategory:read')")
|
||||
public Object listWithChildren() {
|
||||
public CommonResult<List<PmsProductCategoryWithChildrenItem>> listWithChildren() {
|
||||
List<PmsProductCategoryWithChildrenItem> list = productCategoryService.listWithChildren();
|
||||
return new CommonResult().success(list);
|
||||
return CommonResult.success(list);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.dto.PmsProductParam;
|
||||
import com.macro.mall.dto.PmsProductQueryParam;
|
||||
import com.macro.mall.dto.PmsProductResult;
|
||||
@ -31,12 +32,12 @@ public class PmsProductController {
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:product:create')")
|
||||
public Object create(@RequestBody PmsProductParam productParam, BindingResult bindingResult) {
|
||||
public CommonResult create(@RequestBody PmsProductParam productParam, BindingResult bindingResult) {
|
||||
int count = productService.create(productParam);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,21 +45,21 @@ public class PmsProductController {
|
||||
@RequestMapping(value = "/updateInfo/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:product:read')")
|
||||
public Object getUpdateInfo(@PathVariable Long id) {
|
||||
public CommonResult<PmsProductResult> getUpdateInfo(@PathVariable Long id) {
|
||||
PmsProductResult productResult = productService.getUpdateInfo(id);
|
||||
return new CommonResult().success(productResult);
|
||||
return CommonResult.success(productResult);
|
||||
}
|
||||
|
||||
@ApiOperation("更新商品")
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:product:update')")
|
||||
public Object update(@PathVariable Long id, @RequestBody PmsProductParam productParam, BindingResult bindingResult) {
|
||||
public CommonResult update(@PathVariable Long id, @RequestBody PmsProductParam productParam, BindingResult bindingResult) {
|
||||
int count = productService.update(id, productParam);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,89 +67,89 @@ public class PmsProductController {
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:product:read')")
|
||||
public Object getList(PmsProductQueryParam productQueryParam,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
public CommonResult<CommonPage<PmsProduct>> getList(PmsProductQueryParam productQueryParam,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<PmsProduct> productList = productService.list(productQueryParam, pageSize, pageNum);
|
||||
return new CommonResult().pageSuccess(productList);
|
||||
return CommonResult.success(CommonPage.restPage(productList));
|
||||
}
|
||||
|
||||
@ApiOperation("根据商品名称或货号模糊查询")
|
||||
@RequestMapping(value = "/simpleList", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getList(String keyword) {
|
||||
public CommonResult<List<PmsProduct>> getList(String keyword) {
|
||||
List<PmsProduct> productList = productService.list(keyword);
|
||||
return new CommonResult().success(productList);
|
||||
return CommonResult.success(productList);
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改审核状态")
|
||||
@RequestMapping(value = "/update/verifyStatus",method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/update/verifyStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:product:update')")
|
||||
public Object updateVerifyStatus(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("verifyStatus") Integer verifyStatus,
|
||||
@RequestParam("detail") String detail) {
|
||||
public CommonResult updateVerifyStatus(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("verifyStatus") Integer verifyStatus,
|
||||
@RequestParam("detail") String detail) {
|
||||
int count = productService.updateVerifyStatus(ids, verifyStatus, detail);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("批量上下架")
|
||||
@RequestMapping(value = "/update/publishStatus",method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/update/publishStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:product:update')")
|
||||
public Object updatePublishStatus(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("publishStatus") Integer publishStatus) {
|
||||
public CommonResult updatePublishStatus(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("publishStatus") Integer publishStatus) {
|
||||
int count = productService.updatePublishStatus(ids, publishStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("批量推荐商品")
|
||||
@RequestMapping(value = "/update/recommendStatus",method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:product:update')")
|
||||
public Object updateRecommendStatus(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("recommendStatus") Integer recommendStatus) {
|
||||
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("recommendStatus") Integer recommendStatus) {
|
||||
int count = productService.updateRecommendStatus(ids, recommendStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("批量设为新品")
|
||||
@RequestMapping(value = "/update/newStatus",method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/update/newStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:product:update')")
|
||||
public Object updateNewStatus(@RequestParam("ids") List<Long> ids,
|
||||
public CommonResult updateNewStatus(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("newStatus") Integer newStatus) {
|
||||
int count = productService.updateNewStatus(ids, newStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改删除状态")
|
||||
@RequestMapping(value = "/update/deleteStatus",method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/update/deleteStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('pms:product:delete')")
|
||||
public Object updateDeleteStatus(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("deleteStatus") Integer deleteStatus) {
|
||||
public CommonResult updateDeleteStatus(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("deleteStatus") Integer deleteStatus) {
|
||||
int count = productService.updateDeleteStatus(ids, deleteStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.model.PmsSkuStock;
|
||||
import com.macro.mall.service.PmsSkuStockService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -25,19 +25,19 @@ public class PmsSkuStockController {
|
||||
@ApiOperation("根据商品编号及编号模糊搜索sku库存")
|
||||
@RequestMapping(value = "/{pid}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getList(@PathVariable Long pid, @RequestParam(value = "keyword",required = false) String keyword) {
|
||||
public CommonResult<List<PmsSkuStock>> getList(@PathVariable Long pid, @RequestParam(value = "keyword",required = false) String keyword) {
|
||||
List<PmsSkuStock> skuStockList = skuStockService.getList(pid, keyword);
|
||||
return new CommonResult().success(skuStockList);
|
||||
return CommonResult.success(skuStockList);
|
||||
}
|
||||
@ApiOperation("批量更新库存信息")
|
||||
@RequestMapping(value ="/update/{pid}",method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long pid,@RequestBody List<PmsSkuStock> skuStockList){
|
||||
public CommonResult update(@PathVariable Long pid,@RequestBody List<PmsSkuStock> skuStockList){
|
||||
int count = skuStockService.update(pid,skuStockList);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}else{
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.dto.SmsCouponParam;
|
||||
import com.macro.mall.model.SmsCoupon;
|
||||
import com.macro.mall.service.SmsCouponService;
|
||||
@ -25,53 +26,53 @@ public class SmsCouponController {
|
||||
@ApiOperation("添加优惠券")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object add(@RequestBody SmsCouponParam couponParam) {
|
||||
public CommonResult add(@RequestBody SmsCouponParam couponParam) {
|
||||
int count = couponService.create(couponParam);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("删除优惠券")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@PathVariable Long id) {
|
||||
public CommonResult delete(@PathVariable Long id) {
|
||||
int count = couponService.delete(id);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改优惠券")
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long id,@RequestBody SmsCouponParam couponParam) {
|
||||
public CommonResult update(@PathVariable Long id,@RequestBody SmsCouponParam couponParam) {
|
||||
int count = couponService.update(id,couponParam);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("根据优惠券名称和类型分页获取优惠券列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list(
|
||||
public CommonResult<CommonPage<SmsCoupon>> list(
|
||||
@RequestParam(value = "name",required = false) String name,
|
||||
@RequestParam(value = "type",required = false) Integer type,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsCoupon> couponList = couponService.list(name,type,pageSize,pageNum);
|
||||
return new CommonResult().pageSuccess(couponList);
|
||||
return CommonResult.success(CommonPage.restPage(couponList));
|
||||
}
|
||||
|
||||
@ApiOperation("获取单个优惠券的详细信息")
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getItem(@PathVariable Long id) {
|
||||
public CommonResult<SmsCouponParam> getItem(@PathVariable Long id) {
|
||||
SmsCouponParam couponParam = couponService.getItem(id);
|
||||
return new CommonResult().success(couponParam);
|
||||
return CommonResult.success(couponParam);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.model.SmsCouponHistory;
|
||||
import com.macro.mall.service.SmsCouponHistoryService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -19,20 +20,21 @@ import java.util.List;
|
||||
* Created by macro on 2018/11/6.
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "SmsCouponHistoryController",description = "优惠券领取记录管理")
|
||||
@Api(tags = "SmsCouponHistoryController", description = "优惠券领取记录管理")
|
||||
@RequestMapping("/couponHistory")
|
||||
public class SmsCouponHistoryController {
|
||||
@Autowired
|
||||
private SmsCouponHistoryService historyService;
|
||||
|
||||
@ApiOperation("根据优惠券id,使用状态,订单编号分页获取领取记录")
|
||||
@RequestMapping(value = "/list",method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list(@RequestParam(value = "couponId",required = false) Long couponId,
|
||||
@RequestParam(value = "useStatus",required = false) Integer useStatus,
|
||||
@RequestParam(value = "orderSn",required = false) String orderSn,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum){
|
||||
List<SmsCouponHistory> historyList = historyService.list(couponId,useStatus,orderSn,pageSize,pageNum);
|
||||
return new CommonResult().pageSuccess(historyList);
|
||||
public CommonResult<CommonPage<SmsCouponHistory>> list(@RequestParam(value = "couponId", required = false) Long couponId,
|
||||
@RequestParam(value = "useStatus", required = false) Integer useStatus,
|
||||
@RequestParam(value = "orderSn", required = false) String orderSn,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsCouponHistory> historyList = historyService.list(couponId, useStatus, orderSn, pageSize, pageNum);
|
||||
return CommonResult.success(CommonPage.restPage(historyList));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.model.SmsFlashPromotion;
|
||||
import com.macro.mall.service.SmsFlashPromotionService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -16,70 +17,71 @@ import java.util.List;
|
||||
* Created by macro on 2018/11/16.
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "SmsFlashPromotionController",description = "限时购活动管理")
|
||||
@Api(tags = "SmsFlashPromotionController", description = "限时购活动管理")
|
||||
@RequestMapping("/flash")
|
||||
public class SmsFlashPromotionController {
|
||||
@Autowired
|
||||
private SmsFlashPromotionService flashPromotionService;
|
||||
|
||||
@ApiOperation("添加活动")
|
||||
@RequestMapping(value = "/create",method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@RequestBody SmsFlashPromotion flashPromotion){
|
||||
public CommonResult create(@RequestBody SmsFlashPromotion flashPromotion) {
|
||||
int count = flashPromotionService.create(flashPromotion);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("编辑活动信息")
|
||||
@RequestMapping(value = "/update/{id}",method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long id, @RequestBody SmsFlashPromotion flashPromotion){
|
||||
int count = flashPromotionService.update(id,flashPromotion);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public Object update(@PathVariable Long id, @RequestBody SmsFlashPromotion flashPromotion) {
|
||||
int count = flashPromotionService.update(id, flashPromotion);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("删除活动信息")
|
||||
@RequestMapping(value = "/delete/{id}",method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@PathVariable Long id){
|
||||
public Object delete(@PathVariable Long id) {
|
||||
int count = flashPromotionService.delete(id);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改上下线状态")
|
||||
@RequestMapping(value = "/update/status/{id}",method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long id,Integer status){
|
||||
int count = flashPromotionService.updateStatus(id,status);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public Object update(@PathVariable Long id, Integer status) {
|
||||
int count = flashPromotionService.updateStatus(id, status);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取活动详情")
|
||||
@RequestMapping(value = "/{id}",method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getItem(@PathVariable Long id){
|
||||
public Object getItem(@PathVariable Long id) {
|
||||
SmsFlashPromotion flashPromotion = flashPromotionService.getItem(id);
|
||||
return new CommonResult().success(flashPromotion);
|
||||
return CommonResult.success(flashPromotion);
|
||||
}
|
||||
|
||||
@ApiOperation("根据活动名称分页查询")
|
||||
@RequestMapping(value = "/list",method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getItem(@RequestParam(value = "keyword",required = false)String keyword,
|
||||
@RequestParam(value = "pageSize",defaultValue = "5")Integer pageSize,
|
||||
@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum){
|
||||
List<SmsFlashPromotion> flashPromotionList = flashPromotionService.list(keyword,pageSize,pageNum);
|
||||
return new CommonResult().pageSuccess(flashPromotionList);
|
||||
public Object getItem(@RequestParam(value = "keyword", required = false) String keyword,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsFlashPromotion> flashPromotionList = flashPromotionService.list(keyword, pageSize, pageNum);
|
||||
return CommonResult.success(CommonPage.restPage(flashPromotionList));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.dto.SmsFlashPromotionProduct;
|
||||
import com.macro.mall.model.SmsFlashPromotionProductRelation;
|
||||
import com.macro.mall.service.SmsFlashPromotionProductRelationService;
|
||||
@ -22,55 +23,56 @@ import java.util.List;
|
||||
public class SmsFlashPromotionProductRelationController {
|
||||
@Autowired
|
||||
private SmsFlashPromotionProductRelationService relationService;
|
||||
|
||||
@ApiOperation("批量选择商品添加关联")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@RequestBody List<SmsFlashPromotionProductRelation> relationList) {
|
||||
public CommonResult create(@RequestBody List<SmsFlashPromotionProductRelation> relationList) {
|
||||
int count = relationService.create(relationList);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改关联相关信息")
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long id, @RequestBody SmsFlashPromotionProductRelation relation) {
|
||||
int count = relationService.update(id,relation);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult update(@PathVariable Long id, @RequestBody SmsFlashPromotionProductRelation relation) {
|
||||
int count = relationService.update(id, relation);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("删除关联")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@PathVariable Long id) {
|
||||
public CommonResult delete(@PathVariable Long id) {
|
||||
int count = relationService.delete(id);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取管理商品促销信息")
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getItem(@PathVariable Long id) {
|
||||
public CommonResult<SmsFlashPromotionProductRelation> getItem(@PathVariable Long id) {
|
||||
SmsFlashPromotionProductRelation relation = relationService.getItem(id);
|
||||
return new CommonResult().success(relation);
|
||||
return CommonResult.success(relation);
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询不同场次关联及商品信息")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list(@RequestParam(value = "flashPromotionId")Long flashPromotionId,
|
||||
@RequestParam(value = "flashPromotionSessionId")Long flashPromotionSessionId,
|
||||
@RequestParam(value = "pageSize",defaultValue = "5")Integer pageSize,
|
||||
@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum) {
|
||||
List<SmsFlashPromotionProduct> flashPromotionProductList = relationService.list(flashPromotionId,flashPromotionSessionId,pageSize,pageNum);
|
||||
return new CommonResult().pageSuccess(flashPromotionProductList);
|
||||
public CommonResult<CommonPage<SmsFlashPromotionProduct>> list(@RequestParam(value = "flashPromotionId") Long flashPromotionId,
|
||||
@RequestParam(value = "flashPromotionSessionId") Long flashPromotionSessionId,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsFlashPromotionProduct> flashPromotionProductList = relationService.list(flashPromotionId, flashPromotionSessionId, pageSize, pageNum);
|
||||
return CommonResult.success(CommonPage.restPage(flashPromotionProductList));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.dto.SmsFlashPromotionSessionDetail;
|
||||
import com.macro.mall.model.SmsFlashPromotionSession;
|
||||
import com.macro.mall.service.SmsFlashPromotionSessionService;
|
||||
@ -22,71 +22,72 @@ import java.util.List;
|
||||
public class SmsFlashPromotionSessionController {
|
||||
@Autowired
|
||||
private SmsFlashPromotionSessionService flashPromotionSessionService;
|
||||
|
||||
@ApiOperation("添加场次")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@RequestBody SmsFlashPromotionSession promotionSession) {
|
||||
public CommonResult create(@RequestBody SmsFlashPromotionSession promotionSession) {
|
||||
int count = flashPromotionSessionService.create(promotionSession);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改场次")
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long id, @RequestBody SmsFlashPromotionSession promotionSession) {
|
||||
int count = flashPromotionSessionService.update(id,promotionSession);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult update(@PathVariable Long id, @RequestBody SmsFlashPromotionSession promotionSession) {
|
||||
int count = flashPromotionSessionService.update(id, promotionSession);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改启用状态")
|
||||
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateStatus(@PathVariable Long id, Integer status) {
|
||||
int count = flashPromotionSessionService.updateStatus(id,status);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult updateStatus(@PathVariable Long id, Integer status) {
|
||||
int count = flashPromotionSessionService.updateStatus(id, status);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("删除场次")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@PathVariable Long id) {
|
||||
public CommonResult delete(@PathVariable Long id) {
|
||||
int count = flashPromotionSessionService.delete(id);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取场次详情")
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getItem(@PathVariable Long id) {
|
||||
public CommonResult<SmsFlashPromotionSession> getItem(@PathVariable Long id) {
|
||||
SmsFlashPromotionSession promotionSession = flashPromotionSessionService.getItem(id);
|
||||
return new CommonResult().success(promotionSession);
|
||||
return CommonResult.success(promotionSession);
|
||||
}
|
||||
|
||||
@ApiOperation("获取全部场次")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list() {
|
||||
public CommonResult<List<SmsFlashPromotionSession>> list() {
|
||||
List<SmsFlashPromotionSession> promotionSessionList = flashPromotionSessionService.list();
|
||||
return new CommonResult().success(promotionSessionList);
|
||||
return CommonResult.success(promotionSessionList);
|
||||
}
|
||||
|
||||
@ApiOperation("获取全部可选场次及其数量")
|
||||
@RequestMapping(value = "/selectList", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object selectList(Long flashPromotionId) {
|
||||
public CommonResult<List<SmsFlashPromotionSessionDetail>> selectList(Long flashPromotionId) {
|
||||
List<SmsFlashPromotionSessionDetail> promotionSessionList = flashPromotionSessionService.selectList(flashPromotionId);
|
||||
return new CommonResult().success(promotionSessionList);
|
||||
return CommonResult.success(promotionSessionList);
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.model.SmsHomeAdvertise;
|
||||
import com.macro.mall.service.SmsHomeAdvertiseService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -25,60 +26,60 @@ public class SmsHomeAdvertiseController {
|
||||
@ApiOperation("添加广告")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@RequestBody SmsHomeAdvertise advertise) {
|
||||
public CommonResult create(@RequestBody SmsHomeAdvertise advertise) {
|
||||
int count = advertiseService.create(advertise);
|
||||
if (count > 0)
|
||||
return new CommonResult().success(count);
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.success(count);
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("删除广告")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@RequestParam("ids") List<Long> ids) {
|
||||
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
|
||||
int count = advertiseService.delete(ids);
|
||||
if (count > 0)
|
||||
return new CommonResult().success(count);
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.success(count);
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改上下线状态")
|
||||
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateStatus(@PathVariable Long id, Integer status) {
|
||||
public CommonResult updateStatus(@PathVariable Long id, Integer status) {
|
||||
int count = advertiseService.updateStatus(id, status);
|
||||
if (count > 0)
|
||||
return new CommonResult().success(count);
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.success(count);
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取广告详情")
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getItem(@PathVariable Long id) {
|
||||
public CommonResult<SmsHomeAdvertise> getItem(@PathVariable Long id) {
|
||||
SmsHomeAdvertise advertise = advertiseService.getItem(id);
|
||||
return new CommonResult().success(advertise);
|
||||
return CommonResult.success(advertise);
|
||||
}
|
||||
|
||||
@ApiOperation("修改广告")
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long id, @RequestBody SmsHomeAdvertise advertise) {
|
||||
public CommonResult update(@PathVariable Long id, @RequestBody SmsHomeAdvertise advertise) {
|
||||
int count = advertiseService.update(id, advertise);
|
||||
if (count > 0)
|
||||
return new CommonResult().success(count);
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.success(count);
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询广告")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list(@RequestParam(value = "name", required = false) String name,
|
||||
@RequestParam(value = "type", required = false) Integer type,
|
||||
@RequestParam(value = "endTime", required = false) String endTime,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
public CommonResult<CommonPage<SmsHomeAdvertise>> list(@RequestParam(value = "name", required = false) String name,
|
||||
@RequestParam(value = "type", required = false) Integer type,
|
||||
@RequestParam(value = "endTime", required = false) String endTime,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsHomeAdvertise> advertiseList = advertiseService.list(name, type, endTime, pageSize, pageNum);
|
||||
return new CommonResult().pageSuccess(advertiseList);
|
||||
return CommonResult.success(CommonPage.restPage(advertiseList));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.model.SmsHomeBrand;
|
||||
import com.macro.mall.service.SmsHomeBrandService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -21,58 +22,59 @@ import java.util.List;
|
||||
public class SmsHomeBrandController {
|
||||
@Autowired
|
||||
private SmsHomeBrandService homeBrandService;
|
||||
|
||||
@ApiOperation("添加首页推荐品牌")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@RequestBody List<SmsHomeBrand> homeBrandList) {
|
||||
public CommonResult create(@RequestBody List<SmsHomeBrand> homeBrandList) {
|
||||
int count = homeBrandService.create(homeBrandList);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改品牌排序")
|
||||
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateSort(@PathVariable Long id, Integer sort) {
|
||||
int count = homeBrandService.updateSort(id,sort);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
|
||||
int count = homeBrandService.updateSort(id, sort);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除推荐品牌")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@RequestParam("ids") List<Long> ids) {
|
||||
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
|
||||
int count = homeBrandService.delete(ids);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改推荐状态")
|
||||
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
|
||||
int count = homeBrandService.updateRecommendStatus(ids,recommendStatus);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
|
||||
int count = homeBrandService.updateRecommendStatus(ids, recommendStatus);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询推荐品牌")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list(@RequestParam(value = "brandName", required = false) String brandName,
|
||||
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsHomeBrand> homeBrandList = homeBrandService.list(brandName,recommendStatus,pageSize,pageNum);
|
||||
return new CommonResult().pageSuccess(homeBrandList);
|
||||
public CommonResult<CommonPage<SmsHomeBrand>> list(@RequestParam(value = "brandName", required = false) String brandName,
|
||||
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsHomeBrand> homeBrandList = homeBrandService.list(brandName, recommendStatus, pageSize, pageNum);
|
||||
return CommonResult.success(CommonPage.restPage(homeBrandList));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.model.SmsHomeNewProduct;
|
||||
import com.macro.mall.service.SmsHomeNewProductService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -21,58 +22,59 @@ import java.util.List;
|
||||
public class SmsHomeNewProductController {
|
||||
@Autowired
|
||||
private SmsHomeNewProductService homeNewProductService;
|
||||
|
||||
@ApiOperation("添加首页推荐品牌")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@RequestBody List<SmsHomeNewProduct> homeBrandList) {
|
||||
public CommonResult create(@RequestBody List<SmsHomeNewProduct> homeBrandList) {
|
||||
int count = homeNewProductService.create(homeBrandList);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改推荐排序")
|
||||
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateSort(@PathVariable Long id, Integer sort) {
|
||||
int count = homeNewProductService.updateSort(id,sort);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
|
||||
int count = homeNewProductService.updateSort(id, sort);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除推荐")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@RequestParam("ids") List<Long> ids) {
|
||||
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
|
||||
int count = homeNewProductService.delete(ids);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改推荐状态")
|
||||
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
|
||||
int count = homeNewProductService.updateRecommendStatus(ids,recommendStatus);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
|
||||
int count = homeNewProductService.updateRecommendStatus(ids, recommendStatus);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询推荐")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list(@RequestParam(value = "productName", required = false) String productName,
|
||||
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsHomeNewProduct> homeBrandList = homeNewProductService.list(productName,recommendStatus,pageSize,pageNum);
|
||||
return new CommonResult().pageSuccess(homeBrandList);
|
||||
public CommonResult<CommonPage<SmsHomeNewProduct>> list(@RequestParam(value = "productName", required = false) String productName,
|
||||
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsHomeNewProduct> homeBrandList = homeNewProductService.list(productName, recommendStatus, pageSize, pageNum);
|
||||
return CommonResult.success(CommonPage.restPage(homeBrandList));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.model.SmsHomeRecommendProduct;
|
||||
import com.macro.mall.service.SmsHomeRecommendProductService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -21,58 +22,59 @@ import java.util.List;
|
||||
public class SmsHomeRecommendProductController {
|
||||
@Autowired
|
||||
private SmsHomeRecommendProductService recommendProductService;
|
||||
|
||||
@ApiOperation("添加首页推荐")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@RequestBody List<SmsHomeRecommendProduct> homeBrandList) {
|
||||
public CommonResult create(@RequestBody List<SmsHomeRecommendProduct> homeBrandList) {
|
||||
int count = recommendProductService.create(homeBrandList);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改推荐排序")
|
||||
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateSort(@PathVariable Long id, Integer sort) {
|
||||
int count = recommendProductService.updateSort(id,sort);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
|
||||
int count = recommendProductService.updateSort(id, sort);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除推荐")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@RequestParam("ids") List<Long> ids) {
|
||||
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
|
||||
int count = recommendProductService.delete(ids);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改推荐状态")
|
||||
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
|
||||
int count = recommendProductService.updateRecommendStatus(ids,recommendStatus);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
|
||||
int count = recommendProductService.updateRecommendStatus(ids, recommendStatus);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询推荐")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list(@RequestParam(value = "productName", required = false) String productName,
|
||||
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsHomeRecommendProduct> homeBrandList = recommendProductService.list(productName,recommendStatus,pageSize,pageNum);
|
||||
return new CommonResult().pageSuccess(homeBrandList);
|
||||
public CommonResult<CommonPage<SmsHomeRecommendProduct>> list(@RequestParam(value = "productName", required = false) String productName,
|
||||
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsHomeRecommendProduct> homeBrandList = recommendProductService.list(productName, recommendStatus, pageSize, pageNum);
|
||||
return CommonResult.success(CommonPage.restPage(homeBrandList));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.model.SmsHomeRecommendSubject;
|
||||
import com.macro.mall.service.SmsHomeRecommendSubjectService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -21,58 +22,59 @@ import java.util.List;
|
||||
public class SmsHomeRecommendSubjectController {
|
||||
@Autowired
|
||||
private SmsHomeRecommendSubjectService recommendSubjectService;
|
||||
|
||||
@ApiOperation("添加首页推荐专题")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@RequestBody List<SmsHomeRecommendSubject> homeBrandList) {
|
||||
public CommonResult create(@RequestBody List<SmsHomeRecommendSubject> homeBrandList) {
|
||||
int count = recommendSubjectService.create(homeBrandList);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改推荐排序")
|
||||
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateSort(@PathVariable Long id, Integer sort) {
|
||||
int count = recommendSubjectService.updateSort(id,sort);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
|
||||
int count = recommendSubjectService.updateSort(id, sort);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除推荐")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@RequestParam("ids") List<Long> ids) {
|
||||
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
|
||||
int count = recommendSubjectService.delete(ids);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改推荐状态")
|
||||
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
|
||||
int count = recommendSubjectService.updateRecommendStatus(ids,recommendStatus);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
|
||||
int count = recommendSubjectService.updateRecommendStatus(ids, recommendStatus);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询推荐")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list(@RequestParam(value = "subjectName", required = false) String subjectName,
|
||||
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsHomeRecommendSubject> homeBrandList = recommendSubjectService.list(subjectName,recommendStatus,pageSize,pageNum);
|
||||
return new CommonResult().pageSuccess(homeBrandList);
|
||||
public CommonResult<CommonPage<SmsHomeRecommendSubject>> list(@RequestParam(value = "subjectName", required = false) String subjectName,
|
||||
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsHomeRecommendSubject> homeBrandList = recommendSubjectService.list(subjectName, recommendStatus, pageSize, pageNum);
|
||||
return CommonResult.success(CommonPage.restPage(homeBrandList));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonPage;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.dto.UmsAdminLoginParam;
|
||||
import com.macro.mall.dto.UmsAdminParam;
|
||||
import com.macro.mall.model.UmsAdmin;
|
||||
@ -39,140 +40,140 @@ public class UmsAdminController {
|
||||
@ApiOperation(value = "用户注册")
|
||||
@RequestMapping(value = "/register", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object register(@RequestBody UmsAdminParam umsAdminParam, BindingResult result) {
|
||||
public CommonResult<UmsAdmin> register(@RequestBody UmsAdminParam umsAdminParam, BindingResult result) {
|
||||
UmsAdmin umsAdmin = adminService.register(umsAdminParam);
|
||||
if (umsAdmin == null) {
|
||||
new CommonResult().failed();
|
||||
CommonResult.failed();
|
||||
}
|
||||
return new CommonResult().success(umsAdmin);
|
||||
return CommonResult.success(umsAdmin);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "登录以后返回token")
|
||||
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object login(@RequestBody UmsAdminLoginParam umsAdminLoginParam, BindingResult result) {
|
||||
public CommonResult login(@RequestBody UmsAdminLoginParam umsAdminLoginParam, BindingResult result) {
|
||||
String token = adminService.login(umsAdminLoginParam.getUsername(), umsAdminLoginParam.getPassword());
|
||||
if (token == null) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
return CommonResult.validateFailed("用户名或密码错误");
|
||||
}
|
||||
Map<String, String> tokenMap = new HashMap<>();
|
||||
tokenMap.put("token", token);
|
||||
tokenMap.put("tokenHead", tokenHead);
|
||||
return new CommonResult().success(tokenMap);
|
||||
return CommonResult.success(tokenMap);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "刷新token")
|
||||
@RequestMapping(value = "/token/refresh", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object refreshToken(HttpServletRequest request) {
|
||||
public CommonResult refreshToken(HttpServletRequest request) {
|
||||
String token = request.getHeader(tokenHeader);
|
||||
String refreshToken = adminService.refreshToken(token);
|
||||
if (refreshToken == null) {
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
Map<String, String> tokenMap = new HashMap<>();
|
||||
tokenMap.put("token", refreshToken);
|
||||
tokenMap.put("tokenHead", tokenHead);
|
||||
return new CommonResult().success(tokenMap);
|
||||
return CommonResult.success(tokenMap);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取当前登录用户信息")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getAdminInfo(Principal principal) {
|
||||
String username = principal.getName();
|
||||
public CommonResult getAdminInfo(Principal principal) {
|
||||
String username = principal.getName();
|
||||
UmsAdmin umsAdmin = adminService.getAdminByUsername(username);
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("username", umsAdmin.getUsername());
|
||||
data.put("roles", new String[]{"TEST"});
|
||||
data.put("icon", umsAdmin.getIcon());
|
||||
return new CommonResult().success(data);
|
||||
return CommonResult.success(data);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "登出功能")
|
||||
@RequestMapping(value = "/logout", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object logout() {
|
||||
return new CommonResult().success(null);
|
||||
public CommonResult logout() {
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
|
||||
@ApiOperation("根据用户名或姓名分页获取用户列表")
|
||||
@RequestMapping(value = "/list",method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list(@RequestParam(value = "name",required = false) String name,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum){
|
||||
List<UmsAdmin> adminList = adminService.list(name,pageSize,pageNum);
|
||||
return new CommonResult().pageSuccess(adminList);
|
||||
public CommonResult<CommonPage<UmsAdmin>> list(@RequestParam(value = "name", required = false) String name,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<UmsAdmin> adminList = adminService.list(name, pageSize, pageNum);
|
||||
return CommonResult.success(CommonPage.restPage(adminList));
|
||||
}
|
||||
|
||||
@ApiOperation("获取指定用户信息")
|
||||
@RequestMapping(value = "/{id}",method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getItem(@PathVariable Long id){
|
||||
public CommonResult<UmsAdmin> getItem(@PathVariable Long id) {
|
||||
UmsAdmin admin = adminService.getItem(id);
|
||||
return new CommonResult().success(admin);
|
||||
return CommonResult.success(admin);
|
||||
}
|
||||
|
||||
@ApiOperation("修改指定用户信息")
|
||||
@RequestMapping(value = "/update/{id}",method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long id,@RequestBody UmsAdmin admin){
|
||||
int count = adminService.update(id,admin);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult update(@PathVariable Long id, @RequestBody UmsAdmin admin) {
|
||||
int count = adminService.update(id, admin);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("删除指定用户信息")
|
||||
@RequestMapping(value = "/delete/{id}",method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@PathVariable Long id){
|
||||
public CommonResult delete(@PathVariable Long id) {
|
||||
int count = adminService.delete(id);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("给用户分配角色")
|
||||
@RequestMapping(value = "/role/update",method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/role/update", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateRole(@RequestParam("adminId") Long adminId,
|
||||
@RequestParam("roleIds") List<Long> roleIds){
|
||||
int count = adminService.updateRole(adminId,roleIds);
|
||||
if(count>=0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult updateRole(@RequestParam("adminId") Long adminId,
|
||||
@RequestParam("roleIds") List<Long> roleIds) {
|
||||
int count = adminService.updateRole(adminId, roleIds);
|
||||
if (count >= 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取指定用户的角色")
|
||||
@RequestMapping(value = "/role/{adminId}",method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/role/{adminId}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getRoleList(@PathVariable Long adminId){
|
||||
public CommonResult<List<UmsRole>> getRoleList(@PathVariable Long adminId) {
|
||||
List<UmsRole> roleList = adminService.getRoleList(adminId);
|
||||
return new CommonResult().success(roleList);
|
||||
return CommonResult.success(roleList);
|
||||
}
|
||||
|
||||
@ApiOperation("给用户分配+-权限")
|
||||
@RequestMapping(value = "/permission/update",method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/permission/update", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updatePermission(@RequestParam Long adminId,
|
||||
@RequestParam("permissionIds") List<Long> permissionIds){
|
||||
int count = adminService.updatePermission(adminId,permissionIds);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult updatePermission(@RequestParam Long adminId,
|
||||
@RequestParam("permissionIds") List<Long> permissionIds) {
|
||||
int count = adminService.updatePermission(adminId, permissionIds);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户所有权限(包括+-权限)")
|
||||
@RequestMapping(value = "/permission/{adminId}",method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/permission/{adminId}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getPermissionList(@PathVariable Long adminId){
|
||||
public CommonResult<List<UmsPermission>> getPermissionList(@PathVariable Long adminId) {
|
||||
List<UmsPermission> permissionList = adminService.getPermissionList(adminId);
|
||||
return new CommonResult().success(permissionList);
|
||||
return CommonResult.success(permissionList);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.model.UmsMemberLevel;
|
||||
import com.macro.mall.service.UmsMemberLevelService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -19,16 +19,17 @@ import java.util.List;
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "UmsMemberLevelController",description = "会员等级管理")
|
||||
@Api(tags = "UmsMemberLevelController", description = "会员等级管理")
|
||||
@RequestMapping("/memberLevel")
|
||||
public class UmsMemberLevelController {
|
||||
@Autowired
|
||||
private UmsMemberLevelService memberLevelService;
|
||||
@RequestMapping(value = "/list",method = RequestMethod.GET)
|
||||
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ApiOperation("查询所有会员等级")
|
||||
@ResponseBody
|
||||
public Object list(@RequestParam("defaultStatus") Integer defaultStatus){
|
||||
public CommonResult<List<UmsMemberLevel>> list(@RequestParam("defaultStatus") Integer defaultStatus) {
|
||||
List<UmsMemberLevel> memberLevelList = memberLevelService.list(defaultStatus);
|
||||
return new CommonResult().success(memberLevelList);
|
||||
return CommonResult.success(memberLevelList);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.dto.UmsPermissionNode;
|
||||
import com.macro.mall.model.UmsPermission;
|
||||
import com.macro.mall.service.UmsPermissionService;
|
||||
@ -25,49 +25,49 @@ public class UmsPermissionController {
|
||||
@ApiOperation("添加权限")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@RequestBody UmsPermission permission) {
|
||||
public CommonResult create(@RequestBody UmsPermission permission) {
|
||||
int count = permissionService.create(permission);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改权限")
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long id, @RequestBody UmsPermission permission) {
|
||||
public CommonResult update(@PathVariable Long id, @RequestBody UmsPermission permission) {
|
||||
int count = permissionService.update(id,permission);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("根据id批量删除权限")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@RequestParam("ids") List<Long> ids) {
|
||||
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
|
||||
int count = permissionService.delete(ids);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("以层级结构返回所有权限")
|
||||
@RequestMapping(value = "/treeList", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object treeList() {
|
||||
public CommonResult<List<UmsPermissionNode>> treeList() {
|
||||
List<UmsPermissionNode> permissionNodeList = permissionService.treeList();
|
||||
return new CommonResult().success(permissionNodeList);
|
||||
return CommonResult.success(permissionNodeList);
|
||||
}
|
||||
|
||||
@ApiOperation("获取所有权限列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list() {
|
||||
public CommonResult<List<UmsPermission>> list() {
|
||||
List<UmsPermission> permissionList = permissionService.list();
|
||||
return new CommonResult().success(permissionList);
|
||||
return CommonResult.success(permissionList);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.model.UmsPermission;
|
||||
import com.macro.mall.model.UmsRole;
|
||||
import com.macro.mall.service.UmsRoleService;
|
||||
@ -26,62 +26,62 @@ public class UmsRoleController {
|
||||
@ApiOperation("添加角色")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@RequestBody UmsRole role) {
|
||||
public CommonResult create(@RequestBody UmsRole role) {
|
||||
int count = roleService.create(role);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改角色")
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long id, @RequestBody UmsRole role) {
|
||||
int count = roleService.update(id,role);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult update(@PathVariable Long id, @RequestBody UmsRole role) {
|
||||
int count = roleService.update(id, role);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除角色")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@RequestParam("ids") List<Long> ids) {
|
||||
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
|
||||
int count = roleService.delete(ids);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取相应角色权限")
|
||||
@RequestMapping(value = "/permission/{roleId}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getPermissionList(@PathVariable Long roleId) {
|
||||
List<UmsPermission> permissionList =roleService.getPermissionList(roleId);
|
||||
return new CommonResult().success(permissionList);
|
||||
public CommonResult<List<UmsPermission>> getPermissionList(@PathVariable Long roleId) {
|
||||
List<UmsPermission> permissionList = roleService.getPermissionList(roleId);
|
||||
return CommonResult.success(permissionList);
|
||||
}
|
||||
|
||||
@ApiOperation("修改角色权限")
|
||||
@RequestMapping(value = "/permission/update", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updatePermission(@RequestParam Long roleId,
|
||||
@RequestParam("permissionIds") List<Long> permissionIds) {
|
||||
int count = roleService.updatePermission(roleId,permissionIds);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
public CommonResult updatePermission(@RequestParam Long roleId,
|
||||
@RequestParam("permissionIds") List<Long> permissionIds) {
|
||||
int count = roleService.updatePermission(roleId, permissionIds);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取所有角色")
|
||||
@RequestMapping(value = "/list",method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list(){
|
||||
public Object list() {
|
||||
List<UmsRole> roleList = roleService.list();
|
||||
return new CommonResult().success(roleList);
|
||||
return CommonResult.success(roleList);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,140 +0,0 @@
|
||||
package com.macro.mall.dto;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.macro.mall.util.JsonUtil;
|
||||
import org.springframework.validation.BindingResult;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 通用返回对象
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public class CommonResult {
|
||||
//操作成功
|
||||
public static final int SUCCESS = 200;
|
||||
//操作失败
|
||||
public static final int FAILED = 500;
|
||||
//参数校验失败
|
||||
public static final int VALIDATE_FAILED = 404;
|
||||
//未认证
|
||||
public static final int UNAUTHORIZED = 401;
|
||||
//未授权
|
||||
public static final int FORBIDDEN = 403;
|
||||
private int code;
|
||||
private String message;
|
||||
private Object data;
|
||||
|
||||
/**
|
||||
* 普通成功返回
|
||||
*
|
||||
* @param data 获取的数据
|
||||
*/
|
||||
public CommonResult success(Object data) {
|
||||
this.code = SUCCESS;
|
||||
this.message = "操作成功";
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回分页成功数据
|
||||
*/
|
||||
public CommonResult pageSuccess(List data) {
|
||||
PageInfo pageInfo = new PageInfo(data);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("pageSize", pageInfo.getPageSize());
|
||||
result.put("totalPage", pageInfo.getPages());
|
||||
result.put("total", pageInfo.getTotal());
|
||||
result.put("pageNum", pageInfo.getPageNum());
|
||||
result.put("list", pageInfo.getList());
|
||||
this.code = SUCCESS;
|
||||
this.message = "操作成功";
|
||||
this.data = result;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通失败提示信息
|
||||
*/
|
||||
public CommonResult failed() {
|
||||
this.code = FAILED;
|
||||
this.message = "操作失败";
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数验证失败使用
|
||||
*
|
||||
* @param message 错误信息
|
||||
*/
|
||||
public CommonResult validateFailed(String message) {
|
||||
this.code = VALIDATE_FAILED;
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 未登录时使用
|
||||
*
|
||||
* @param message 错误信息
|
||||
*/
|
||||
public CommonResult unauthorized(String message) {
|
||||
this.code = UNAUTHORIZED;
|
||||
this.message = "暂未登录或token已经过期";
|
||||
this.data = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 未授权时使用
|
||||
*
|
||||
* @param message 错误信息
|
||||
*/
|
||||
public CommonResult forbidden(String message) {
|
||||
this.code = FORBIDDEN;
|
||||
this.message = "没有相关权限";
|
||||
this.data = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数验证失败使用
|
||||
* @param result 错误信息
|
||||
*/
|
||||
public CommonResult validateFailed(BindingResult result) {
|
||||
validateFailed(result.getFieldError().getDefaultMessage());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return JsonUtil.objectToJson(this);
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-commons</artifactId>
|
||||
<version>2.1.5.RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -11,7 +11,8 @@ import java.util.List;
|
||||
public class CommonPage<T> {
|
||||
private Integer pageNum;
|
||||
private Integer pageSize;
|
||||
private Long totalPage;
|
||||
private Integer totalPage;
|
||||
private Long total;
|
||||
private List<T> list;
|
||||
|
||||
/**
|
||||
@ -20,9 +21,10 @@ public class CommonPage<T> {
|
||||
public static <T> CommonPage<T> restPage(List<T> list) {
|
||||
CommonPage<T> result = new CommonPage<T>();
|
||||
PageInfo<T> pageInfo = new PageInfo<T>(list);
|
||||
result.setTotalPage(pageInfo.getTotal() / pageInfo.getPageSize());
|
||||
result.setTotalPage(pageInfo.getPages());
|
||||
result.setPageNum(pageInfo.getPageNum());
|
||||
result.setPageSize(pageInfo.getPageSize());
|
||||
result.setTotal(pageInfo.getTotal());
|
||||
result.setList(pageInfo.getList());
|
||||
return result;
|
||||
}
|
||||
@ -32,9 +34,10 @@ public class CommonPage<T> {
|
||||
*/
|
||||
public static <T> CommonPage<T> restPage(Page<T> pageInfo) {
|
||||
CommonPage<T> result = new CommonPage<T>();
|
||||
result.setTotalPage((long) pageInfo.getTotalPages());
|
||||
result.setTotalPage(pageInfo.getTotalPages());
|
||||
result.setPageNum(pageInfo.getNumber());
|
||||
result.setPageSize(pageInfo.getSize());
|
||||
result.setTotal(pageInfo.getTotalElements());
|
||||
result.setList(pageInfo.getContent());
|
||||
return result;
|
||||
}
|
||||
@ -55,11 +58,11 @@ public class CommonPage<T> {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public Long getTotalPage() {
|
||||
public Integer getTotalPage() {
|
||||
return totalPage;
|
||||
}
|
||||
|
||||
public void setTotalPage(Long totalPage) {
|
||||
public void setTotalPage(Integer totalPage) {
|
||||
this.totalPage = totalPage;
|
||||
}
|
||||
|
||||
@ -70,4 +73,12 @@ public class CommonPage<T> {
|
||||
public void setList(List<T> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public Long getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Long total) {
|
||||
this.total = total;
|
||||
}
|
||||
}
|
||||
|
@ -8,88 +8,84 @@ public class CommonResult<T> {
|
||||
private String message;
|
||||
private T data;
|
||||
|
||||
protected CommonResult() {
|
||||
}
|
||||
|
||||
protected CommonResult(long code, String message, T data) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通成功返回
|
||||
* 成功返回结果
|
||||
*
|
||||
* @param data 获取的数据
|
||||
*/
|
||||
public static <T> CommonResult<T> success(T data) {
|
||||
CommonResult<T> result = new CommonResult<T>();
|
||||
result.setCode(ResultCode.SUCCESS.getCode());
|
||||
result.setMessage(ResultCode.SUCCESS.getMsg());
|
||||
result.setData(data);
|
||||
return result;
|
||||
return new CommonResult<T>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通成功返回
|
||||
* 成功返回结果
|
||||
*
|
||||
* @param data 获取的数据
|
||||
* @param message 提示信息
|
||||
*/
|
||||
public static <T> CommonResult<T> success(T data,String message) {
|
||||
CommonResult<T> result = new CommonResult<T>();
|
||||
result.setCode(ResultCode.SUCCESS.getCode());
|
||||
result.setMessage(message);
|
||||
result.setData(data);
|
||||
return result;
|
||||
public static <T> CommonResult<T> success(T data, String message) {
|
||||
return new CommonResult<T>(ResultCode.SUCCESS.getCode(), message, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过错误码对象构造返回结果
|
||||
* 失败返回结果
|
||||
* @param errorCode 错误码
|
||||
*/
|
||||
public static <T> CommonResult<T> failed(IErrorCode errorCode) {
|
||||
CommonResult<T> result = new CommonResult<T>();
|
||||
result.setCode(errorCode.getCode());
|
||||
result.setMessage(errorCode.getMsg());
|
||||
return result;
|
||||
return new CommonResult<T>(errorCode.getCode(), errorCode.getMessage(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通失败提示信息
|
||||
* 失败返回结果
|
||||
* @param message 提示信息
|
||||
*/
|
||||
public static <T> CommonResult<T> failed(String message) {
|
||||
CommonResult<T> result = new CommonResult<T>();
|
||||
result.setCode(ResultCode.FAILED.getCode());
|
||||
result.setMessage(message);
|
||||
return result;
|
||||
return new CommonResult<T>(ResultCode.FAILED.getCode(), message, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通操作失败
|
||||
* 失败返回结果
|
||||
*/
|
||||
public static <T> CommonResult<T> failed() {
|
||||
return failed(ResultCode.FAILED);
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数验证失败使用
|
||||
* 参数验证失败返回结果
|
||||
*/
|
||||
public static <T> CommonResult<T> validateFailed() {
|
||||
return failed(ResultCode.VALIDATE_FAILED);
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数验证失败使用
|
||||
* 参数验证失败返回结果
|
||||
* @param message 提示信息
|
||||
*/
|
||||
public static <T> CommonResult<T> validateFailed(String message) {
|
||||
CommonResult<T> result = new CommonResult<T>();
|
||||
result.setCode(ResultCode.FAILED.getCode());
|
||||
result.setMessage(message);
|
||||
return result;
|
||||
return new CommonResult<T>(ResultCode.VALIDATE_FAILED.getCode(), message, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户没有登录
|
||||
* 未登录返回结果
|
||||
*/
|
||||
public static <T> CommonResult<T> unauthorized() {
|
||||
return failed(ResultCode.UNAUTHORIZED);
|
||||
public static <T> CommonResult<T> unauthorized(T data) {
|
||||
return new CommonResult<T>(ResultCode.UNAUTHORIZED.getCode(), ResultCode.UNAUTHORIZED.getMessage(), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户没有相应权限
|
||||
* 未授权返回结果
|
||||
*/
|
||||
public static <T> CommonResult<T> forbidden() {
|
||||
return failed(ResultCode.UNAUTHORIZED);
|
||||
public static <T> CommonResult<T> forbidden(T data) {
|
||||
return new CommonResult<T>(ResultCode.FORBIDDEN.getCode(), ResultCode.FORBIDDEN.getMessage(), data);
|
||||
}
|
||||
|
||||
public long getCode() {
|
||||
|
@ -7,5 +7,5 @@ package com.macro.mall.common.api;
|
||||
public interface IErrorCode {
|
||||
long getCode();
|
||||
|
||||
String getMsg();
|
||||
String getMessage();
|
||||
}
|
||||
|
@ -11,18 +11,18 @@ public enum ResultCode implements IErrorCode {
|
||||
UNAUTHORIZED(401, "暂未登录或token已经过期"),
|
||||
FORBIDDEN(403, "没有相关权限");
|
||||
private long code;
|
||||
private String msg;
|
||||
private String message;
|
||||
|
||||
private ResultCode(long code, String msg) {
|
||||
private ResultCode(long code, String message) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public long getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user