个人优惠券优化
This commit is contained in:
parent
3ab6c71811
commit
1784d49dbf
|
|
@ -1,15 +0,0 @@
|
||||||
package com.qiguliuxing.dts.dao.app;
|
|
||||||
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
@SpringBootApplication(scanBasePackages = { "com.qiguliuxing.dts.db" })
|
|
||||||
@MapperScan("com.qiguliuxing.dts.db.dao")
|
|
||||||
public class Application {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(Application.class, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -193,4 +193,17 @@ public class DtsCouponService {
|
||||||
.andEndTimeLessThan(LocalDate.now()).andDeletedEqualTo(false);
|
.andEndTimeLessThan(LocalDate.now()).andDeletedEqualTo(false);
|
||||||
return couponMapper.selectByExample(example);
|
return couponMapper.selectByExample(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户的优惠券
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int queryUserCouponCnt(Integer userId) {
|
||||||
|
DtsCouponUserExample example = new DtsCouponUserExample();
|
||||||
|
DtsCouponUserExample.Criteria criteria = example.createCriteria();
|
||||||
|
criteria.andUserIdEqualTo(userId);
|
||||||
|
criteria.andDeletedEqualTo(false);
|
||||||
|
return (int) couponUserMapper.countByExample(example);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -110,7 +111,8 @@ public class WxCouponController {
|
||||||
|
|
||||||
List<DtsCouponUser> couponUserList = couponUserService.queryList(userId, null, status, page, size, sort, order);
|
List<DtsCouponUser> couponUserList = couponUserService.queryList(userId, null, status, page, size, sort, order);
|
||||||
List<CouponVo> couponVoList = change(couponUserList);
|
List<CouponVo> couponVoList = change(couponUserList);
|
||||||
int total = couponService.queryTotal();
|
long total = PageInfo.of(couponUserList).getTotal();
|
||||||
|
//int total = couponService.queryTotal();
|
||||||
Map<String, Object> data = new HashMap<String, Object>();
|
Map<String, Object> data = new HashMap<String, Object>();
|
||||||
data.put("data", couponVoList);
|
data.put("data", couponVoList);
|
||||||
data.put("count", total);
|
data.put("count", total);
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ public class WxUserController {
|
||||||
data.put("remainAmount", remainAmount);
|
data.put("remainAmount", remainAmount);
|
||||||
|
|
||||||
// 查询用户的优惠券
|
// 查询用户的优惠券
|
||||||
int total = couponService.queryTotal();
|
int total = couponService.queryUserCouponCnt(userId);
|
||||||
data.put("couponCount", total);
|
data.put("couponCount", total);
|
||||||
|
|
||||||
logger.info("【请求结束】用户个人页面数据,响应结果:{}", JSONObject.toJSONString(data));
|
logger.info("【请求结束】用户个人页面数据,响应结果:{}", JSONObject.toJSONString(data));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue