Commit e5c2843d authored by mengbali153's avatar mengbali153

优惠卷夹

parent f45ec26a
package cn.wise.sc.consume.business.controller;
import cn.wise.sc.consume.business.entity.SysCouponDetail;
import cn.wise.sc.consume.business.entity.SysUserCoupon;
import cn.wise.sc.consume.business.mapper.SysUserMapper;
import cn.wise.sc.consume.business.service.ISysCouponDetailService;
import cn.wise.sc.consume.business.wrapper.WrapMapper;
import cn.wise.sc.consume.business.wrapper.Wrapper;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
* 前端控制器
......@@ -16,6 +31,27 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/business/sys-user")
public class SysUserController {
private static final Logger log = LoggerFactory.getLogger("SysUserController");
@Resource
private SysUserMapper sysUserMapper;
@Autowired
private ISysCouponDetailService couponDetailService;
@ApiOperation(value = "个人优惠卷列表")
@GetMapping("SysUserCoupon/{detailId}")
public Wrapper getCouponDetailById(@PathVariable("detailId") Long detailId){
try {
List<SysUserCoupon> byDetailId = sysUserMapper.getByDetailId(detailId);
if(byDetailId == null){
return WrapMapper.wrap(400,"信息错误");
}
return WrapMapper.wrap(200,"成功",byDetailId);
}catch (Exception e){
log.debug("用户优惠券详情{}",e);
}
return WrapMapper.error("失败");
}
}
......@@ -32,6 +32,11 @@ public class SysUserCoupon implements Serializable {
*/
private String userId;
/**
* 手机号
*/
private String phone;
/**
* 优惠券明细表id
*/
......@@ -57,7 +62,20 @@ public class SysUserCoupon implements Serializable {
*/
private String remark;
/**
* 优惠卷码
*/
private String couponCodes;
/**
* 优惠卷名称
*/
private String couponName;
/**
* 优惠卷图片
*/
private String couponLogo;
}
package cn.wise.sc.consume.business.mapper;
import cn.wise.sc.consume.business.entity.SysCouponDetail;
import cn.wise.sc.consume.business.entity.SysUser;
import cn.wise.sc.consume.business.entity.SysUserCoupon;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* <p>
* Mapper 接口
......@@ -18,4 +23,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
@Select("select login_lable.* from sys_user login_lable where login_lable.username = #{username}")
SysUser getUser(String username);
List<SysUserCoupon> getByDetailId(@Param("detailId") Long detailId);
}
......@@ -2,4 +2,13 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wise.sc.consume.business.mapper.SysUserMapper">
<select id="getByDetailId" resultType="cn.wise.sc.consume.business.entity.SysUserCoupon">
select suc.*,sc.coupon_name as coupon_name,scd.coupon_code as coupon_codes,su.phone as phone,
sc.coupon_logo as coupon_logo,scd.is_receive as isUse
from sys_user_coupon suc
left join sys_coupon_detail scd on suc.coupon_detail_id = scd.id
left join sys_coupon sc on sc.id = scd.coupon_id
left join sys_user su on su.id =suc.user_id
where suc.user_id = #{detailId}
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment