新人代金券

This commit is contained in:
曹磊 2024-07-02 22:22:57 +08:00
parent a475847780
commit 882c7841a1
6 changed files with 29 additions and 1 deletions

View File

@ -49,6 +49,13 @@ public class AppCouponUserController extends AbstractController {
couponUserService.updateExpiration();
}
@Login
@GetMapping("/selectNewUserCoupon")
@ApiOperation("获取新人优惠券")
public Result selectNewUserCoupon(@LoginUser UserEntity userEntity,Integer page,Integer limit){
return couponUserService.selectNewUserCoupon(page,limit);
}
@Login
@GetMapping("/insertNewUserCoupon")
@ApiOperation("领取新人优惠券")

View File

@ -15,4 +15,6 @@ public interface CouponDao extends BaseMapper<Coupon> {
List<Coupon> selectCouponList();
IPage<Coupon> selectNewerCouponPage(Page<Coupon> pages);
}

View File

@ -1,6 +1,7 @@
package com.sqx.modules.coupon.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -46,5 +47,8 @@ public class Coupon implements Serializable {
@ApiModelProperty("分类ID0为通用非0为具体分类ID")
private Long classifyId;
@TableField(exist = false)
private String classifyName;
public Coupon() {}
}

View File

@ -19,6 +19,8 @@ public interface CouponUserService extends IService<CouponUser> {
Result selectCouponByUserId(Integer page, Integer limit, String id, Long userId, Integer status, String phone,String couponName);
Result selectNewUserCoupon(Integer page,Integer limit);
Result insertNewUserCoupon(UserEntity userEntity);
CouponUser selectCountByUserId(Long userId);

View File

@ -99,6 +99,13 @@ public class CouponUserServiceImpl extends ServiceImpl<CouponUserDao, CouponUser
return Result.success().put("data", pageUtils);
}
@Override
public Result selectNewUserCoupon(Integer page,Integer limit){
Page<Coupon> pages=new Page<>(page,limit);
PageUtils pageUtils = new PageUtils(CouponDao.selectNewerCouponPage(pages));
return Result.success().put("data", pageUtils);
}
@Override
public Result insertNewUserCoupon(UserEntity userEntity){
if(userEntity.getIsCoupon()!=null && userEntity.getIsCoupon()==1){

View File

@ -14,6 +14,12 @@
order by coupon_id desc
</select>
<select id="selectNewerCouponPage" resultType="com.sqx.modules.coupon.entity.Coupon">
select t.*,d.value as classifyName
from coupon t
left join sys_dict d on t.classify_id = d.id
where t.cou_type = 1
order by coupon_id desc
</select>
</mapper>