添加获取购物车中商品可用优惠券接口

This commit is contained in:
zhh
2018-08-29 17:08:16 +08:00
parent 201b405a08
commit 61a67c9aa9
16 changed files with 604 additions and 79 deletions

View File

@@ -66,4 +66,12 @@ public class SmsCouponController {
List<SmsCoupon> couponList = couponService.list(name,type,pageSize,pageNum);
return new CommonResult().pageSuccess(couponList);
}
@ApiOperation("获取单个优惠券的详细信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public Object getItem(@PathVariable Long id) {
SmsCouponParam couponParam = couponService.getItem(id);
return new CommonResult().success(couponParam);
}
}

View File

@@ -0,0 +1,12 @@
package com.macro.mall.dao;
import com.macro.mall.dto.SmsCouponParam;
import org.apache.ibatis.annotations.Param;
/**
* 优惠券管理自定义查询Dao
* Created by macro on 2018/8/29.
*/
public interface SmsCouponDao {
SmsCouponParam getItem(@Param("id") Long id);
}

View File

@@ -33,4 +33,10 @@ public interface SmsCouponService {
* 分页获取优惠券列表
*/
List<SmsCoupon> list(String name, Integer type, Integer pageSize, Integer pageNum);
/**
* 获取优惠券详情
* @param id 优惠券表id
*/
SmsCouponParam getItem(Long id);
}

View File

@@ -1,6 +1,7 @@
package com.macro.mall.service.impl;
import com.github.pagehelper.PageHelper;
import com.macro.mall.dao.SmsCouponDao;
import com.macro.mall.dao.SmsCouponProductCategoryRelationDao;
import com.macro.mall.dao.SmsCouponProductRelationDao;
import com.macro.mall.dto.SmsCouponParam;
@@ -31,6 +32,8 @@ public class SmsCouponServiceImpl implements SmsCouponService {
private SmsCouponProductRelationDao productRelationDao;
@Autowired
private SmsCouponProductCategoryRelationDao productCategoryRelationDao;
@Autowired
private SmsCouponDao couponDao;
@Override
public int add(SmsCouponParam couponParam) {
//插入优惠券表
@@ -112,4 +115,9 @@ public class SmsCouponServiceImpl implements SmsCouponService {
PageHelper.startPage(pageNum,pageSize);
return couponMapper.selectByExample(example);
}
@Override
public SmsCouponParam getItem(Long id) {
return couponDao.getItem(id);
}
}