From e65015222390751ba4c5fa96d66f33e5ba06f151 Mon Sep 17 00:00:00 2001 From: hu177768073 <177768073@qq.com> Date: Wed, 23 Oct 2024 11:23:13 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E7=BB=9F=E8=AE=A1=E3=80=81=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=AD=89=E7=BA=A7=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hfkj/config/AuthConfig.java | 1 + .../controller/BsUserCountController.java | 272 +++++++ .../com/hfkj/schedule/UserGradeSchedule.java | 32 + .../java/com/hfkj/common/utils/DateUtil.java | 194 ++--- .../java/com/hfkj/dao/BsOrderMapperExt.java | 13 +- .../com/hfkj/dao/BsUserGradeCountMapper.java | 108 +++ .../hfkj/dao/BsUserGradeCountMapperExt.java | 29 + .../hfkj/dao/BsUserGradeCountSqlProvider.java | 276 +++++++ .../java/com/hfkj/dao/BsUserMapperExt.java | 2 +- .../com/hfkj/entity/BsUserGradeCount.java | 174 +++++ .../hfkj/entity/BsUserGradeCountExample.java | 703 ++++++++++++++++++ .../hfkj/service/user/BsUserCountService.java | 55 ++ .../user/impl/BsUserCountServiceImpl.java | 66 ++ .../service/user/impl/BsUserServiceImpl.java | 4 +- 14 files changed, 1829 insertions(+), 100 deletions(-) create mode 100644 bweb/src/main/java/com/hfkj/controller/BsUserCountController.java create mode 100644 service/src/main/java/com/hfkj/dao/BsUserGradeCountMapper.java create mode 100644 service/src/main/java/com/hfkj/dao/BsUserGradeCountMapperExt.java create mode 100644 service/src/main/java/com/hfkj/dao/BsUserGradeCountSqlProvider.java create mode 100644 service/src/main/java/com/hfkj/entity/BsUserGradeCount.java create mode 100644 service/src/main/java/com/hfkj/entity/BsUserGradeCountExample.java create mode 100644 service/src/main/java/com/hfkj/service/user/BsUserCountService.java create mode 100644 service/src/main/java/com/hfkj/service/user/impl/BsUserCountServiceImpl.java diff --git a/bweb/src/main/java/com/hfkj/config/AuthConfig.java b/bweb/src/main/java/com/hfkj/config/AuthConfig.java index 0f20dd3..d32876b 100644 --- a/bweb/src/main/java/com/hfkj/config/AuthConfig.java +++ b/bweb/src/main/java/com/hfkj/config/AuthConfig.java @@ -90,6 +90,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/secUser/*") .excludePathPatterns("/cornucopia/*") .excludePathPatterns("/partner/*") + .excludePathPatterns("/userCount/*") ; } diff --git a/bweb/src/main/java/com/hfkj/controller/BsUserCountController.java b/bweb/src/main/java/com/hfkj/controller/BsUserCountController.java new file mode 100644 index 0000000..95d4019 --- /dev/null +++ b/bweb/src/main/java/com/hfkj/controller/BsUserCountController.java @@ -0,0 +1,272 @@ +package com.hfkj.controller; + +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.utils.DateUtil; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.entity.BsUser; +import com.hfkj.entity.BsUserParentRel; +import com.hfkj.model.ResponseData; +import com.hfkj.service.user.BsUserCountService; +import com.hfkj.service.user.BsUserGradeService; +import com.hfkj.service.user.BsUserParentRelService; +import com.hfkj.service.user.BsUserService; +import com.hfkj.sysenum.user.UserGradeEnum; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @className: CmsController + * @author: HuRui + * @date: 2024/9/24 + **/ +@Controller +@RequestMapping(value = "/userCount") +@Api(value = "用户统计") +public class BsUserCountController { + private static Logger log = LoggerFactory.getLogger(BsUserCountController.class); + @Resource + private BsUserCountService userCountService; + + @RequestMapping(value="/countUserNumber",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "统计用户数量") + public ResponseData countUserNumber() { + try { + // 今日时间 + Map todayTime = DateUtil.getTodayTimeObj(); + // 昨日时间 + Map yesterdayTime = DateUtil.getYesterdayTimeObj(); + // 本月时间 + Map thisMonthTime = DateUtil.getThisMonthTimeObj(); + // 上月时间 + Map lastMonthTime = DateUtil.getLastMonthTimeObj(); + + Map map = new HashMap<>(); + + // 平台注册用户数 + Map platformRegister = new HashMap<>(); + Calendar timeS = new GregorianCalendar(); + timeS.set(Calendar.YEAR, 2024); + timeS.set(Calendar.MONTH, 1); + timeS.set(Calendar.DAY_OF_MONTH, 0); + timeS.set(Calendar.HOUR_OF_DAY, 23); + timeS.set(Calendar.MINUTE, 59); + timeS.set(Calendar.SECOND, 59); + // 今日 + platformRegister.put("today", userCountService.countPlatformRegister(timeS.getTime(), todayTime.get("timeE"))); + // 昨日 + platformRegister.put("yesterday", userCountService.countPlatformRegister(timeS.getTime(), yesterdayTime.get("timeE"))); + // 本月 + platformRegister.put("thisMonth", userCountService.countPlatformRegister(timeS.getTime(), thisMonthTime.get("timeE"))); + // 上月 + platformRegister.put("lastMonth", userCountService.countPlatformRegister(timeS.getTime(), lastMonthTime.get("timeE"))); + map.put("platformRegister", platformRegister); + + + // 新增用户数 + Map addNumber = new HashMap<>(); + // 今日 + addNumber.put("today", userCountService.countAdd(todayTime.get("timeS"), todayTime.get("timeE"))); + // 昨日 + addNumber.put("yesterday", userCountService.countAdd(yesterdayTime.get("timeS"), yesterdayTime.get("timeE"))); + // 本月 + addNumber.put("thisMonth", userCountService.countAdd(thisMonthTime.get("timeS"), thisMonthTime.get("timeE"))); + // 上月 + addNumber.put("lastMonth", userCountService.countAdd(lastMonthTime.get("timeS"), lastMonthTime.get("timeE"))); + map.put("addNumber", addNumber); + + + // 登录用户数 + Map loginNumber = new HashMap<>(); + // 今日 + loginNumber.put("today", userCountService.countLogin(todayTime.get("timeS"), todayTime.get("timeE"))); + // 昨日 + loginNumber.put("yesterday", userCountService.countLogin(yesterdayTime.get("timeS"), yesterdayTime.get("timeE"))); + // 本月 + loginNumber.put("thisMonth", userCountService.countLogin(thisMonthTime.get("timeS"), thisMonthTime.get("timeE"))); + // 上月 + loginNumber.put("lastMonth", userCountService.countLogin(lastMonthTime.get("timeS"), lastMonthTime.get("timeE"))); + map.put("loginNumber", loginNumber); + + + // 下单用户数 + Map placeOrder = new HashMap<>(); + // 今日 + placeOrder.put("today", userCountService.countPlaceOrder(todayTime.get("timeS"), todayTime.get("timeE"))); + // 昨日 + placeOrder.put("yesterday", userCountService.countPlaceOrder(yesterdayTime.get("timeS"), yesterdayTime.get("timeE"))); + // 本月 + placeOrder.put("thisMonth", userCountService.countPlaceOrder(thisMonthTime.get("timeS"), thisMonthTime.get("timeE"))); + // 上月 + placeOrder.put("lastMonth", userCountService.countPlaceOrder(lastMonthTime.get("timeS"), lastMonthTime.get("timeE"))); + map.put("placeOrder", placeOrder); + + return ResponseMsgUtil.success(map); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/queryUserNumber",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询用户数量") + public ResponseData queryUserNumber(@RequestParam(value = "timeS" , required = true) Long timeS, + @RequestParam(value = "timeE" , required = true) Long timeE) { + try { + + Map map = new HashMap<>(); + + Calendar defaultTimeS = new GregorianCalendar(); + defaultTimeS.set(Calendar.YEAR, 2024); + defaultTimeS.set(Calendar.MONTH, 1); + defaultTimeS.set(Calendar.DAY_OF_MONTH, 0); + defaultTimeS.set(Calendar.HOUR_OF_DAY, 23); + defaultTimeS.set(Calendar.MINUTE, 59); + defaultTimeS.set(Calendar.SECOND, 59); + + // 平台注册用户数 + map.put("platformRegister", userCountService.countPlatformRegister(defaultTimeS.getTime(), new Date(timeE))); + + // 新增用户数 + map.put("addNumber", userCountService.countAdd(new Date(timeS), new Date(timeE))); + + // 登录用户数 + map.put("loginNumber", userCountService.countLogin(new Date(timeS), new Date(timeE))); + + // 下单用户数 + map.put("placeOrder", userCountService.countPlaceOrder(new Date(timeS), new Date(timeE))); + + return ResponseMsgUtil.success(map); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + + + @RequestMapping(value="/countUserGrade",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "统计用户等级") + public ResponseData countUserGrade() { + try { + // 固定初始化开始时间 + Calendar timeS = new GregorianCalendar(); + timeS.set(Calendar.YEAR, 2024); + timeS.set(Calendar.MONTH, 1); + timeS.set(Calendar.DAY_OF_MONTH, 0); + timeS.set(Calendar.HOUR_OF_DAY, 23); + timeS.set(Calendar.MINUTE, 59); + timeS.set(Calendar.SECOND, 59); + + // 今日 + Map todayTime = DateUtil.getTodayTimeObj(); + List> todayData = userCountService.countUserGrade(timeS.getTime(), todayTime.get("timeE")); + + // 昨日时间 + Map yesterdayTime = DateUtil.getYesterdayTimeObj(); + List> yesterdayData = userCountService.countUserGrade(timeS.getTime(), yesterdayTime.get("timeE")); + + // 本月时间 + Map thisMonthTime = DateUtil.getThisMonthTimeObj(); + List> thisMonthData = userCountService.countUserGrade(timeS.getTime(), thisMonthTime.get("timeE")); + + // 上月时间 + Map lastMonthTime = DateUtil.getLastMonthTimeObj(); + List> lastMonthData = userCountService.countUserGrade(timeS.getTime(), lastMonthTime.get("timeE")); + + List list = new ArrayList<>(); + + // 等级 + Map grade1 = new LinkedHashMap<>(); + grade1.put("gradeCode", UserGradeEnum.grade1.getCode()); + grade1.put("gradeName", UserGradeEnum.grade1.getName()); + // 今日 + List> todayGrade1 = todayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade1.getCode())).collect(Collectors.toList()); + grade1.put("today", todayGrade1.isEmpty()?0:todayGrade1.get(0).get("count")); + // 昨日 + List> yesterdayGrade1 = yesterdayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade1.getCode())).collect(Collectors.toList()); + grade1.put("yesterday", yesterdayGrade1.isEmpty()?0:yesterdayGrade1.get(0).get("count")); + // 本月 + List> thisMonthGrade1 = thisMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade1.getCode())).collect(Collectors.toList()); + grade1.put("thisMonth", thisMonthGrade1.isEmpty()?0:thisMonthGrade1.get(0).get("count")); + // 上月 + List> lastMonthGrade1 = lastMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade1.getCode())).collect(Collectors.toList()); + grade1.put("lastMonth", lastMonthGrade1.isEmpty()?0:lastMonthGrade1.get(0).get("count")); + list.add(grade1); + + + Map grade2 = new LinkedHashMap<>(); + grade2.put("gradeCode", UserGradeEnum.grade2.getCode()); + grade2.put("gradeName", UserGradeEnum.grade2.getName()); + // 今日 + List> todayGrade2 = todayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade2.getCode())).collect(Collectors.toList()); + grade2.put("today", todayGrade2.isEmpty()?0:todayGrade2.get(0).get("count")); + // 昨日 + List> yesterdayGrade2 = yesterdayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade2.getCode())).collect(Collectors.toList()); + grade2.put("yesterday", yesterdayGrade2.isEmpty()?0:yesterdayGrade2.get(0).get("count")); + // 本月 + List> thisMonthGrade2 = thisMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade2.getCode())).collect(Collectors.toList()); + grade2.put("thisMonth", thisMonthGrade2.isEmpty()?0:thisMonthGrade2.get(0).get("count")); + // 上月 + List> lastMonthGrade2 = lastMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade2.getCode())).collect(Collectors.toList()); + grade2.put("lastMonth", lastMonthGrade2.isEmpty()?0:lastMonthGrade2.get(0).get("count")); + list.add(grade2); + + + Map grade3 = new LinkedHashMap<>(); + grade3.put("gradeCode", UserGradeEnum.grade3.getCode()); + grade3.put("gradeName", UserGradeEnum.grade3.getName()); + // 今日 + List> todayGrade3 = todayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade3.getCode())).collect(Collectors.toList()); + grade3.put("today", todayGrade3.isEmpty()?0:todayGrade3.get(0).get("count")); + // 昨日 + List> yesterdayGrade3 = yesterdayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade3.getCode())).collect(Collectors.toList()); + grade3.put("yesterday", yesterdayGrade3.isEmpty()?0:yesterdayGrade3.get(0).get("count")); + // 本月 + List> thisMonthGrade3 = thisMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade3.getCode())).collect(Collectors.toList()); + grade3.put("thisMonth", thisMonthGrade3.isEmpty()?0:thisMonthGrade3.get(0).get("count")); + // 上月 + List> lastMonthGrade3 = lastMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade3.getCode())).collect(Collectors.toList()); + grade3.put("lastMonth", lastMonthGrade3.isEmpty()?0:lastMonthGrade3.get(0).get("count")); + list.add(grade3); + + + Map grade4 = new LinkedHashMap<>(); + grade4.put("gradeCode", UserGradeEnum.grade4.getCode()); + grade4.put("gradeName", UserGradeEnum.grade4.getName()); + // 今日 + List> todayGrade4 = todayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade4.getCode())).collect(Collectors.toList()); + grade4.put("today", todayGrade4.isEmpty()?0:todayGrade4.get(0).get("count")); + // 昨日 + List> yesterdayGrade4 = yesterdayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade4.getCode())).collect(Collectors.toList()); + grade4.put("yesterday", yesterdayGrade4.isEmpty()?0:yesterdayGrade4.get(0).get("count")); + // 本月 + List> thisMonthGrade4 = thisMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade4.getCode())).collect(Collectors.toList()); + grade4.put("thisMonth", thisMonthGrade4.isEmpty()?0:thisMonthGrade4.get(0).get("count")); + // 上月 + List> lastMonthGrade4 = lastMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade4.getCode())).collect(Collectors.toList()); + grade4.put("lastMonth", lastMonthGrade4.isEmpty()?0:lastMonthGrade4.get(0).get("count")); + list.add(grade4); + + return ResponseMsgUtil.success(list); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/schedule/src/main/java/com/hfkj/schedule/UserGradeSchedule.java b/schedule/src/main/java/com/hfkj/schedule/UserGradeSchedule.java index 37fb154..88c4b1d 100644 --- a/schedule/src/main/java/com/hfkj/schedule/UserGradeSchedule.java +++ b/schedule/src/main/java/com/hfkj/schedule/UserGradeSchedule.java @@ -2,18 +2,25 @@ package com.hfkj.schedule; import com.hfkj.common.security.SessionObject; import com.hfkj.common.security.UserCenter; +import com.hfkj.common.utils.DateUtil; import com.hfkj.common.utils.ListUtil; +import com.hfkj.dao.BsUserGradeCountMapper; import com.hfkj.entity.BsUser; +import com.hfkj.entity.BsUserGradeCount; import com.hfkj.model.UserSessionObject; +import com.hfkj.service.user.BsUserCountService; import com.hfkj.service.user.BsUserGradeService; import com.hfkj.service.user.BsUserService; import com.hfkj.service.user.impl.BsUserServiceImpl; +import com.hfkj.sysenum.user.UserGradeEnum; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import javax.annotation.Resource; +import java.util.Date; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ThreadPoolExecutor; @@ -31,6 +38,10 @@ public class UserGradeSchedule { @Resource private BsUserGradeService userGradeService; @Resource + private BsUserCountService userCountService; + @Resource + private BsUserGradeCountMapper userGradeCountMapper; + @Resource private UserCenter userCenter; @Scheduled(cron = "0 0 5 * * ?") // 每日凌晨05:00:00 执行一次 @@ -108,6 +119,27 @@ public class UserGradeSchedule { } + @Scheduled(cron = "0 30 5 * * ?") // 每日凌晨05:00:00 执行一次 + public void count() { + try { + // 昨日时间 + Map todayTime = DateUtil.getTodayTimeObj(); + + BsUserGradeCount userGradeCount = new BsUserGradeCount(); + userGradeCount.setStartTime(todayTime.get("timeS")); + userGradeCount.setEndTime(todayTime.get("timeE")); + userGradeCount.setCreateTime(new Date()); + + // userGradeCount.setGrade1(userCountService.countUserGrade(UserGradeEnum.grade1, todayTime.get("timeS"), todayTime.get("timeE"))); + // userGradeCount.setGrade2(userCountService.countUserGrade(UserGradeEnum.grade2, todayTime.get("timeS"), todayTime.get("timeE"))); + // userGradeCount.setGrade3(userCountService.countUserGrade(UserGradeEnum.grade3, todayTime.get("timeS"), todayTime.get("timeE"))); + // userGradeCount.setGrade4(userCountService.countUserGrade(UserGradeEnum.grade4, todayTime.get("timeS"), todayTime.get("timeE"))); + userGradeCountMapper.insert(userGradeCount); + + } catch (Exception e) { + System.out.println("统计失败!!!"); + } + } } diff --git a/service/src/main/java/com/hfkj/common/utils/DateUtil.java b/service/src/main/java/com/hfkj/common/utils/DateUtil.java index 89cd92d..63ea876 100644 --- a/service/src/main/java/com/hfkj/common/utils/DateUtil.java +++ b/service/src/main/java/com/hfkj/common/utils/DateUtil.java @@ -9,8 +9,7 @@ import java.text.ParseException; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.time.*; -import java.util.Calendar; -import java.util.Date; +import java.util.*; public class DateUtil { @@ -35,6 +34,102 @@ public class DateUtil { private static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + /** + * 获取今天时间对象 + * @return + */ + public static Map getTodayTimeObj() { + Map map = new HashMap<>(); + // 开始 + Calendar timeS = Calendar.getInstance(); + timeS.set(Calendar.HOUR_OF_DAY, 00); + timeS.set(Calendar.MINUTE, 00); + timeS.set(Calendar.SECOND, 00); + map.put("timeS", timeS.getTime()); + // 结束 + Calendar timeE = Calendar.getInstance(); + timeE.set(Calendar.HOUR_OF_DAY, 23); + timeE.set(Calendar.MINUTE, 59); + timeE.set(Calendar.SECOND, 59); + map.put("timeE", timeE.getTime()); + return map; + } + + /** + * 获取昨日时间对象 + * @return + */ + public static Map getYesterdayTimeObj() { + Map map = new HashMap<>(); + // 开始 + Calendar timeS = Calendar.getInstance(); + timeS.add(Calendar.DAY_OF_MONTH, -1); + timeS.set(Calendar.HOUR_OF_DAY, 00); + timeS.set(Calendar.MINUTE, 00); + timeS.set(Calendar.SECOND, 00); + map.put("timeS", timeS.getTime()); + // 结束 + Calendar timeE = Calendar.getInstance(); + timeE.add(Calendar.DAY_OF_MONTH, -1); + timeE.set(Calendar.HOUR_OF_DAY, 23); + timeE.set(Calendar.MINUTE, 59); + timeE.set(Calendar.SECOND, 59); + map.put("timeE", timeE.getTime()); + return map; + } + + /** + * 获取本月时间对象 + * @return + */ + public static Map getThisMonthTimeObj() { + Map map = new HashMap<>(); + // 开始 + Calendar timeS = Calendar.getInstance(); + timeS.set(Calendar.DATE, 1); + timeS.set(Calendar.HOUR_OF_DAY, 00); + timeS.set(Calendar.MINUTE, 00); + timeS.set(Calendar.SECOND, 00); + map.put("timeS", timeS.getTime()); + // 结束 + Calendar timeE = Calendar.getInstance(); + timeE.set(Calendar.DATE, 1); + timeE.add(Calendar.MONTH, 1); + timeE.add(Calendar.DATE, -1); + timeE.set(Calendar.HOUR_OF_DAY, 23); + timeE.set(Calendar.MINUTE, 59); + timeE.set(Calendar.SECOND, 59); + map.put("timeE", timeE.getTime()); + return map; + } + + /** + * 获取上月时间对象 + * @return + */ + public static Map getLastMonthTimeObj() { + Map map = new HashMap<>(); + // 开始 + Calendar timeS = Calendar.getInstance(); + timeS.set(Calendar.MONTH, timeS.get(Calendar.MONTH)-1); + timeS.set(Calendar.DATE, 1); + timeS.set(Calendar.HOUR_OF_DAY, 00); + timeS.set(Calendar.MINUTE, 00); + timeS.set(Calendar.SECOND, 00); + map.put("timeS", timeS.getTime()); + // 结束 + Calendar timeE = Calendar.getInstance(); + timeE.set(Calendar.DATE, 1); + timeE.add(Calendar.DATE, -1); + timeE.set(Calendar.HOUR_OF_DAY, 23); + timeE.set(Calendar.MINUTE, 59); + timeE.set(Calendar.SECOND, 59); + map.put("timeE", timeE.getTime()); + return map; + } + + + public static Integer getThisYear(){ Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.YEAR); @@ -100,24 +195,6 @@ public class DateUtil { return strtodate; } - /** - * @throws - * @Title: getDateBegin - * @Description: TODO(获取指定日期开始) - * @author: 杜江 - * @param: [date] - * @return: java.util.Date - */ - public static Date getDateBegin(Date date) { - LocalDate nowDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); - //设置零点 - LocalDateTime beginTime = LocalDateTime.of(nowDate, LocalTime.MIN); - //将时间进行格式化 - ZoneId zoneId = ZoneId.systemDefault(); - ZonedDateTime zdt = beginTime.atZone(zoneId); - return Date.from(zdt.toInstant()); - } - /** * date转换成UNIX时间戳,毫秒 * @@ -156,21 +233,6 @@ public class DateUtil { return cal.getTime(); } - /** - * @throws - * @Title: addSeconds - * @Description: TODO(指定日期 , 指定秒后的时间) - * @author: 杜江 - * @param: [date, seconds] - * @return: java.util.Date - */ - public static Date addSeconds(Date date, int seconds) { - Calendar calendar = Calendar.getInstance(); - calendar.setTime(date); - calendar.add(Calendar.SECOND, seconds); - return calendar.getTime(); - } - /** * 获取某月最后一天日期 * @return Date @@ -679,67 +741,7 @@ public class DateUtil { } - /** - * 字符串日期转换成中文格式日期 - * - * @param date 字符串日期 yyyy-MM-dd - * @return yyyy年MM月dd日 - * @throws Exception - */ - public static String dateToCnDate(Date date) { - try { - String dateString = date2String(date, Y_M_D); - String result = ""; - String[] cnDate = new String[]{"〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"}; - String ten = "十"; - String[] dateStr = dateString.split("-"); - for (int i = 0; i < dateStr.length; i++) { - for (int j = 0; j < dateStr[i].length(); j++) { - String charStr = dateStr[i]; - String str = String.valueOf(charStr.charAt(j)); - if (charStr.length() == 2) { - if (charStr.equals("10")) { - result += ten; - break; - } else { - if (j == 0) { - if (charStr.charAt(j) == '1') - result += ten; - else if (charStr.charAt(j) == '0') - result += ""; - else - result += cnDate[Integer.parseInt(str)] + ten; - } - if (j == 1) { - if (charStr.charAt(j) == '0') - result += ""; - else - result += cnDate[Integer.parseInt(str)]; - } - } - } else { - result += cnDate[Integer.parseInt(str)]; - } - } - if (i == 0) { - result += "年"; - continue; - } - if (i == 1) { - result += "月"; - continue; - } - if (i == 2) { - result += "日"; - continue; - } - } - return result; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } + /** diff --git a/service/src/main/java/com/hfkj/dao/BsOrderMapperExt.java b/service/src/main/java/com/hfkj/dao/BsOrderMapperExt.java index 08c462e..61b1f81 100644 --- a/service/src/main/java/com/hfkj/dao/BsOrderMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsOrderMapperExt.java @@ -1,7 +1,18 @@ package com.hfkj.dao; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + /** * mapper扩展类 */ public interface BsOrderMapperExt { -} \ No newline at end of file + + @Select("") + Long countPlaceOrder(@Param("timeS") String timeS, @Param("timeE")String timeE); +} diff --git a/service/src/main/java/com/hfkj/dao/BsUserGradeCountMapper.java b/service/src/main/java/com/hfkj/dao/BsUserGradeCountMapper.java new file mode 100644 index 0000000..0635d42 --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserGradeCountMapper.java @@ -0,0 +1,108 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsUserGradeCount; +import com.hfkj.entity.BsUserGradeCountExample; +import java.util.List; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.DeleteProvider; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.InsertProvider; +import org.apache.ibatis.annotations.Options; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Result; +import org.apache.ibatis.annotations.Results; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.SelectProvider; +import org.apache.ibatis.annotations.Update; +import org.apache.ibatis.annotations.UpdateProvider; +import org.apache.ibatis.type.JdbcType; +import org.springframework.stereotype.Repository; + +/** + * + * 代码由工具生成,请勿修改!!! + * 如果需要扩展请在其父类进行扩展 + * + **/ +@Repository +public interface BsUserGradeCountMapper extends BsUserGradeCountMapperExt { + @SelectProvider(type=BsUserGradeCountSqlProvider.class, method="countByExample") + long countByExample(BsUserGradeCountExample example); + + @DeleteProvider(type=BsUserGradeCountSqlProvider.class, method="deleteByExample") + int deleteByExample(BsUserGradeCountExample example); + + @Delete({ + "delete from bs_user_grade_count", + "where id = #{id,jdbcType=BIGINT}" + }) + int deleteByPrimaryKey(Long id); + + @Insert({ + "insert into bs_user_grade_count (start_time, end_time, ", + "grade1, grade2, grade3, ", + "grade4, create_time)", + "values (#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, ", + "#{grade1,jdbcType=BIGINT}, #{grade2,jdbcType=BIGINT}, #{grade3,jdbcType=BIGINT}, ", + "#{grade4,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP})" + }) + @Options(useGeneratedKeys=true,keyProperty="id") + int insert(BsUserGradeCount record); + + @InsertProvider(type=BsUserGradeCountSqlProvider.class, method="insertSelective") + @Options(useGeneratedKeys=true,keyProperty="id") + int insertSelective(BsUserGradeCount record); + + @SelectProvider(type=BsUserGradeCountSqlProvider.class, method="selectByExample") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="grade1", property="grade1", jdbcType=JdbcType.BIGINT), + @Result(column="grade2", property="grade2", jdbcType=JdbcType.BIGINT), + @Result(column="grade3", property="grade3", jdbcType=JdbcType.BIGINT), + @Result(column="grade4", property="grade4", jdbcType=JdbcType.BIGINT), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP) + }) + List selectByExample(BsUserGradeCountExample example); + + @Select({ + "select", + "id, start_time, end_time, grade1, grade2, grade3, grade4, create_time", + "from bs_user_grade_count", + "where id = #{id,jdbcType=BIGINT}" + }) + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="grade1", property="grade1", jdbcType=JdbcType.BIGINT), + @Result(column="grade2", property="grade2", jdbcType=JdbcType.BIGINT), + @Result(column="grade3", property="grade3", jdbcType=JdbcType.BIGINT), + @Result(column="grade4", property="grade4", jdbcType=JdbcType.BIGINT), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP) + }) + BsUserGradeCount selectByPrimaryKey(Long id); + + @UpdateProvider(type=BsUserGradeCountSqlProvider.class, method="updateByExampleSelective") + int updateByExampleSelective(@Param("record") BsUserGradeCount record, @Param("example") BsUserGradeCountExample example); + + @UpdateProvider(type=BsUserGradeCountSqlProvider.class, method="updateByExample") + int updateByExample(@Param("record") BsUserGradeCount record, @Param("example") BsUserGradeCountExample example); + + @UpdateProvider(type=BsUserGradeCountSqlProvider.class, method="updateByPrimaryKeySelective") + int updateByPrimaryKeySelective(BsUserGradeCount record); + + @Update({ + "update bs_user_grade_count", + "set start_time = #{startTime,jdbcType=TIMESTAMP},", + "end_time = #{endTime,jdbcType=TIMESTAMP},", + "grade1 = #{grade1,jdbcType=BIGINT},", + "grade2 = #{grade2,jdbcType=BIGINT},", + "grade3 = #{grade3,jdbcType=BIGINT},", + "grade4 = #{grade4,jdbcType=BIGINT},", + "create_time = #{createTime,jdbcType=TIMESTAMP}", + "where id = #{id,jdbcType=BIGINT}" + }) + int updateByPrimaryKey(BsUserGradeCount record); +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserGradeCountMapperExt.java b/service/src/main/java/com/hfkj/dao/BsUserGradeCountMapperExt.java new file mode 100644 index 0000000..667288f --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserGradeCountMapperExt.java @@ -0,0 +1,29 @@ +package com.hfkj.dao; + +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; +import java.util.Map; + +/** + * mapper扩展类 + */ +public interface BsUserGradeCountMapperExt { + + @Select("") + List> collect(@Param("timeS") String timeS, @Param("timeE") String timeE); +} diff --git a/service/src/main/java/com/hfkj/dao/BsUserGradeCountSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsUserGradeCountSqlProvider.java new file mode 100644 index 0000000..7f4919d --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserGradeCountSqlProvider.java @@ -0,0 +1,276 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsUserGradeCount; +import com.hfkj.entity.BsUserGradeCountExample.Criteria; +import com.hfkj.entity.BsUserGradeCountExample.Criterion; +import com.hfkj.entity.BsUserGradeCountExample; +import java.util.List; +import java.util.Map; +import org.apache.ibatis.jdbc.SQL; + +public class BsUserGradeCountSqlProvider { + + public String countByExample(BsUserGradeCountExample example) { + SQL sql = new SQL(); + sql.SELECT("count(*)").FROM("bs_user_grade_count"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String deleteByExample(BsUserGradeCountExample example) { + SQL sql = new SQL(); + sql.DELETE_FROM("bs_user_grade_count"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String insertSelective(BsUserGradeCount record) { + SQL sql = new SQL(); + sql.INSERT_INTO("bs_user_grade_count"); + + if (record.getStartTime() != null) { + sql.VALUES("start_time", "#{startTime,jdbcType=TIMESTAMP}"); + } + + if (record.getEndTime() != null) { + sql.VALUES("end_time", "#{endTime,jdbcType=TIMESTAMP}"); + } + + if (record.getGrade1() != null) { + sql.VALUES("grade1", "#{grade1,jdbcType=BIGINT}"); + } + + if (record.getGrade2() != null) { + sql.VALUES("grade2", "#{grade2,jdbcType=BIGINT}"); + } + + if (record.getGrade3() != null) { + sql.VALUES("grade3", "#{grade3,jdbcType=BIGINT}"); + } + + if (record.getGrade4() != null) { + sql.VALUES("grade4", "#{grade4,jdbcType=BIGINT}"); + } + + if (record.getCreateTime() != null) { + sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); + } + + return sql.toString(); + } + + public String selectByExample(BsUserGradeCountExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("start_time"); + sql.SELECT("end_time"); + sql.SELECT("grade1"); + sql.SELECT("grade2"); + sql.SELECT("grade3"); + sql.SELECT("grade4"); + sql.SELECT("create_time"); + sql.FROM("bs_user_grade_count"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + + return sql.toString(); + } + + public String updateByExampleSelective(Map parameter) { + BsUserGradeCount record = (BsUserGradeCount) parameter.get("record"); + BsUserGradeCountExample example = (BsUserGradeCountExample) parameter.get("example"); + + SQL sql = new SQL(); + sql.UPDATE("bs_user_grade_count"); + + if (record.getId() != null) { + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + } + + if (record.getStartTime() != null) { + sql.SET("start_time = #{record.startTime,jdbcType=TIMESTAMP}"); + } + + if (record.getEndTime() != null) { + sql.SET("end_time = #{record.endTime,jdbcType=TIMESTAMP}"); + } + + if (record.getGrade1() != null) { + sql.SET("grade1 = #{record.grade1,jdbcType=BIGINT}"); + } + + if (record.getGrade2() != null) { + sql.SET("grade2 = #{record.grade2,jdbcType=BIGINT}"); + } + + if (record.getGrade3() != null) { + sql.SET("grade3 = #{record.grade3,jdbcType=BIGINT}"); + } + + if (record.getGrade4() != null) { + sql.SET("grade4 = #{record.grade4,jdbcType=BIGINT}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + } + + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByExample(Map parameter) { + SQL sql = new SQL(); + sql.UPDATE("bs_user_grade_count"); + + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("start_time = #{record.startTime,jdbcType=TIMESTAMP}"); + sql.SET("end_time = #{record.endTime,jdbcType=TIMESTAMP}"); + sql.SET("grade1 = #{record.grade1,jdbcType=BIGINT}"); + sql.SET("grade2 = #{record.grade2,jdbcType=BIGINT}"); + sql.SET("grade3 = #{record.grade3,jdbcType=BIGINT}"); + sql.SET("grade4 = #{record.grade4,jdbcType=BIGINT}"); + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + + BsUserGradeCountExample example = (BsUserGradeCountExample) parameter.get("example"); + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByPrimaryKeySelective(BsUserGradeCount record) { + SQL sql = new SQL(); + sql.UPDATE("bs_user_grade_count"); + + if (record.getStartTime() != null) { + sql.SET("start_time = #{startTime,jdbcType=TIMESTAMP}"); + } + + if (record.getEndTime() != null) { + sql.SET("end_time = #{endTime,jdbcType=TIMESTAMP}"); + } + + if (record.getGrade1() != null) { + sql.SET("grade1 = #{grade1,jdbcType=BIGINT}"); + } + + if (record.getGrade2() != null) { + sql.SET("grade2 = #{grade2,jdbcType=BIGINT}"); + } + + if (record.getGrade3() != null) { + sql.SET("grade3 = #{grade3,jdbcType=BIGINT}"); + } + + if (record.getGrade4() != null) { + sql.SET("grade4 = #{grade4,jdbcType=BIGINT}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); + } + + sql.WHERE("id = #{id,jdbcType=BIGINT}"); + + return sql.toString(); + } + + protected void applyWhere(SQL sql, BsUserGradeCountExample example, boolean includeExamplePhrase) { + if (example == null) { + return; + } + + String parmPhrase1; + String parmPhrase1_th; + String parmPhrase2; + String parmPhrase2_th; + String parmPhrase3; + String parmPhrase3_th; + if (includeExamplePhrase) { + parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; + parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; + parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; + parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; + parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; + parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; + } else { + parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; + parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; + parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; + parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; + parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; + parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; + } + + StringBuilder sb = new StringBuilder(); + List oredCriteria = example.getOredCriteria(); + boolean firstCriteria = true; + for (int i = 0; i < oredCriteria.size(); i++) { + Criteria criteria = oredCriteria.get(i); + if (criteria.isValid()) { + if (firstCriteria) { + firstCriteria = false; + } else { + sb.append(" or "); + } + + sb.append('('); + List criterions = criteria.getAllCriteria(); + boolean firstCriterion = true; + for (int j = 0; j < criterions.size(); j++) { + Criterion criterion = criterions.get(j); + if (firstCriterion) { + firstCriterion = false; + } else { + sb.append(" and "); + } + + if (criterion.isNoValue()) { + sb.append(criterion.getCondition()); + } else if (criterion.isSingleValue()) { + if (criterion.getTypeHandler() == null) { + sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); + } else { + sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); + } + } else if (criterion.isBetweenValue()) { + if (criterion.getTypeHandler() == null) { + sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); + } else { + sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); + } + } else if (criterion.isListValue()) { + sb.append(criterion.getCondition()); + sb.append(" ("); + List listItems = (List) criterion.getValue(); + boolean comma = false; + for (int k = 0; k < listItems.size(); k++) { + if (comma) { + sb.append(", "); + } else { + comma = true; + } + if (criterion.getTypeHandler() == null) { + sb.append(String.format(parmPhrase3, i, j, k)); + } else { + sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); + } + } + sb.append(')'); + } + } + sb.append(')'); + } + } + + if (sb.length() > 0) { + sql.WHERE(sb.toString()); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserMapperExt.java b/service/src/main/java/com/hfkj/dao/BsUserMapperExt.java index 4078eb8..1e5277e 100644 --- a/service/src/main/java/com/hfkj/dao/BsUserMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsUserMapperExt.java @@ -4,4 +4,4 @@ package com.hfkj.dao; * mapper扩展类 */ public interface BsUserMapperExt { -} \ No newline at end of file +} diff --git a/service/src/main/java/com/hfkj/entity/BsUserGradeCount.java b/service/src/main/java/com/hfkj/entity/BsUserGradeCount.java new file mode 100644 index 0000000..54e7e4b --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsUserGradeCount.java @@ -0,0 +1,174 @@ +package com.hfkj.entity; + +import java.io.Serializable; +import java.util.Date; + +/** + * bs_user_grade_count + * @author + */ +/** + * + * 代码由工具生成 + * + **/ +public class BsUserGradeCount implements Serializable { + /** + * 主键 + */ + private Long id; + + /** + * 统计周期 + */ + private Date startTime; + + /** + * 统计周期 + */ + private Date endTime; + + /** + * 见习会员数量 + */ + private Long grade1; + + /** + * 正式会员数量 + */ + private Long grade2; + + /** + * 团长数量 + */ + private Long grade3; + + /** + * 渠道数量 + */ + private Long grade4; + + private Date createTime; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public Date getEndTime() { + return endTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + + public Long getGrade1() { + return grade1; + } + + public void setGrade1(Long grade1) { + this.grade1 = grade1; + } + + public Long getGrade2() { + return grade2; + } + + public void setGrade2(Long grade2) { + this.grade2 = grade2; + } + + public Long getGrade3() { + return grade3; + } + + public void setGrade3(Long grade3) { + this.grade3 = grade3; + } + + public Long getGrade4() { + return grade4; + } + + public void setGrade4(Long grade4) { + this.grade4 = grade4; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + BsUserGradeCount other = (BsUserGradeCount) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime())) + && (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime())) + && (this.getGrade1() == null ? other.getGrade1() == null : this.getGrade1().equals(other.getGrade1())) + && (this.getGrade2() == null ? other.getGrade2() == null : this.getGrade2().equals(other.getGrade2())) + && (this.getGrade3() == null ? other.getGrade3() == null : this.getGrade3().equals(other.getGrade3())) + && (this.getGrade4() == null ? other.getGrade4() == null : this.getGrade4().equals(other.getGrade4())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode()); + result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode()); + result = prime * result + ((getGrade1() == null) ? 0 : getGrade1().hashCode()); + result = prime * result + ((getGrade2() == null) ? 0 : getGrade2().hashCode()); + result = prime * result + ((getGrade3() == null) ? 0 : getGrade3().hashCode()); + result = prime * result + ((getGrade4() == null) ? 0 : getGrade4().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", startTime=").append(startTime); + sb.append(", endTime=").append(endTime); + sb.append(", grade1=").append(grade1); + sb.append(", grade2=").append(grade2); + sb.append(", grade3=").append(grade3); + sb.append(", grade4=").append(grade4); + sb.append(", createTime=").append(createTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsUserGradeCountExample.java b/service/src/main/java/com/hfkj/entity/BsUserGradeCountExample.java new file mode 100644 index 0000000..9411bed --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsUserGradeCountExample.java @@ -0,0 +1,703 @@ +package com.hfkj.entity; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class BsUserGradeCountExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public BsUserGradeCountExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andStartTimeIsNull() { + addCriterion("start_time is null"); + return (Criteria) this; + } + + public Criteria andStartTimeIsNotNull() { + addCriterion("start_time is not null"); + return (Criteria) this; + } + + public Criteria andStartTimeEqualTo(Date value) { + addCriterion("start_time =", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeNotEqualTo(Date value) { + addCriterion("start_time <>", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeGreaterThan(Date value) { + addCriterion("start_time >", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeGreaterThanOrEqualTo(Date value) { + addCriterion("start_time >=", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeLessThan(Date value) { + addCriterion("start_time <", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeLessThanOrEqualTo(Date value) { + addCriterion("start_time <=", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeIn(List values) { + addCriterion("start_time in", values, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeNotIn(List values) { + addCriterion("start_time not in", values, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeBetween(Date value1, Date value2) { + addCriterion("start_time between", value1, value2, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeNotBetween(Date value1, Date value2) { + addCriterion("start_time not between", value1, value2, "startTime"); + return (Criteria) this; + } + + public Criteria andEndTimeIsNull() { + addCriterion("end_time is null"); + return (Criteria) this; + } + + public Criteria andEndTimeIsNotNull() { + addCriterion("end_time is not null"); + return (Criteria) this; + } + + public Criteria andEndTimeEqualTo(Date value) { + addCriterion("end_time =", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeNotEqualTo(Date value) { + addCriterion("end_time <>", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeGreaterThan(Date value) { + addCriterion("end_time >", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeGreaterThanOrEqualTo(Date value) { + addCriterion("end_time >=", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeLessThan(Date value) { + addCriterion("end_time <", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeLessThanOrEqualTo(Date value) { + addCriterion("end_time <=", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeIn(List values) { + addCriterion("end_time in", values, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeNotIn(List values) { + addCriterion("end_time not in", values, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeBetween(Date value1, Date value2) { + addCriterion("end_time between", value1, value2, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeNotBetween(Date value1, Date value2) { + addCriterion("end_time not between", value1, value2, "endTime"); + return (Criteria) this; + } + + public Criteria andGrade1IsNull() { + addCriterion("grade1 is null"); + return (Criteria) this; + } + + public Criteria andGrade1IsNotNull() { + addCriterion("grade1 is not null"); + return (Criteria) this; + } + + public Criteria andGrade1EqualTo(Long value) { + addCriterion("grade1 =", value, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1NotEqualTo(Long value) { + addCriterion("grade1 <>", value, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1GreaterThan(Long value) { + addCriterion("grade1 >", value, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1GreaterThanOrEqualTo(Long value) { + addCriterion("grade1 >=", value, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1LessThan(Long value) { + addCriterion("grade1 <", value, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1LessThanOrEqualTo(Long value) { + addCriterion("grade1 <=", value, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1In(List values) { + addCriterion("grade1 in", values, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1NotIn(List values) { + addCriterion("grade1 not in", values, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1Between(Long value1, Long value2) { + addCriterion("grade1 between", value1, value2, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1NotBetween(Long value1, Long value2) { + addCriterion("grade1 not between", value1, value2, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade2IsNull() { + addCriterion("grade2 is null"); + return (Criteria) this; + } + + public Criteria andGrade2IsNotNull() { + addCriterion("grade2 is not null"); + return (Criteria) this; + } + + public Criteria andGrade2EqualTo(Long value) { + addCriterion("grade2 =", value, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2NotEqualTo(Long value) { + addCriterion("grade2 <>", value, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2GreaterThan(Long value) { + addCriterion("grade2 >", value, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2GreaterThanOrEqualTo(Long value) { + addCriterion("grade2 >=", value, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2LessThan(Long value) { + addCriterion("grade2 <", value, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2LessThanOrEqualTo(Long value) { + addCriterion("grade2 <=", value, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2In(List values) { + addCriterion("grade2 in", values, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2NotIn(List values) { + addCriterion("grade2 not in", values, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2Between(Long value1, Long value2) { + addCriterion("grade2 between", value1, value2, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2NotBetween(Long value1, Long value2) { + addCriterion("grade2 not between", value1, value2, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade3IsNull() { + addCriterion("grade3 is null"); + return (Criteria) this; + } + + public Criteria andGrade3IsNotNull() { + addCriterion("grade3 is not null"); + return (Criteria) this; + } + + public Criteria andGrade3EqualTo(Long value) { + addCriterion("grade3 =", value, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3NotEqualTo(Long value) { + addCriterion("grade3 <>", value, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3GreaterThan(Long value) { + addCriterion("grade3 >", value, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3GreaterThanOrEqualTo(Long value) { + addCriterion("grade3 >=", value, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3LessThan(Long value) { + addCriterion("grade3 <", value, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3LessThanOrEqualTo(Long value) { + addCriterion("grade3 <=", value, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3In(List values) { + addCriterion("grade3 in", values, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3NotIn(List values) { + addCriterion("grade3 not in", values, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3Between(Long value1, Long value2) { + addCriterion("grade3 between", value1, value2, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3NotBetween(Long value1, Long value2) { + addCriterion("grade3 not between", value1, value2, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade4IsNull() { + addCriterion("grade4 is null"); + return (Criteria) this; + } + + public Criteria andGrade4IsNotNull() { + addCriterion("grade4 is not null"); + return (Criteria) this; + } + + public Criteria andGrade4EqualTo(Long value) { + addCriterion("grade4 =", value, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4NotEqualTo(Long value) { + addCriterion("grade4 <>", value, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4GreaterThan(Long value) { + addCriterion("grade4 >", value, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4GreaterThanOrEqualTo(Long value) { + addCriterion("grade4 >=", value, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4LessThan(Long value) { + addCriterion("grade4 <", value, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4LessThanOrEqualTo(Long value) { + addCriterion("grade4 <=", value, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4In(List values) { + addCriterion("grade4 in", values, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4NotIn(List values) { + addCriterion("grade4 not in", values, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4Between(Long value1, Long value2) { + addCriterion("grade4 between", value1, value2, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4NotBetween(Long value1, Long value2) { + addCriterion("grade4 not between", value1, value2, "grade4"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/service/user/BsUserCountService.java b/service/src/main/java/com/hfkj/service/user/BsUserCountService.java new file mode 100644 index 0000000..c36b310 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/BsUserCountService.java @@ -0,0 +1,55 @@ +package com.hfkj.service.user; + +import com.hfkj.sysenum.user.UserGradeEnum; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @className: BsUserService + * @author: HuRui + * @date: 2024/10/20 + **/ +public interface BsUserCountService { + + /** + * 平台总注册用户数 + * @param timeS + * @param timeE + */ + Long countPlatformRegister(Date timeS, Date timeE); + + /** + * 新增用户数 + * @param timeS + * @param timeE + * @return + */ + Long countAdd(Date timeS, Date timeE); + + /** + * 登录用户数 + * @param timeS + * @param timeE + * @return + */ + Long countLogin(Date timeS, Date timeE); + + /** + * 下单用户数 + * @param timeS + * @param timeE + * @return + */ + Long countPlaceOrder(Date timeS, Date timeE) throws Exception; + + /** + * 统计等级用户 + * @param timeS + * @param timeE + * @return + */ + List> countUserGrade(Date timeS, Date timeE) throws Exception; + +} diff --git a/service/src/main/java/com/hfkj/service/user/impl/BsUserCountServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/BsUserCountServiceImpl.java new file mode 100644 index 0000000..0f6b350 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/impl/BsUserCountServiceImpl.java @@ -0,0 +1,66 @@ +package com.hfkj.service.user.impl; + +import com.hfkj.common.utils.DateUtil; +import com.hfkj.dao.BsOrderMapper; +import com.hfkj.dao.BsUserGradeCountMapper; +import com.hfkj.dao.BsUserLoginLogMapper; +import com.hfkj.dao.BsUserMapper; +import com.hfkj.entity.BsUserExample; +import com.hfkj.entity.BsUserGradeCount; +import com.hfkj.entity.BsUserLoginLogExample; +import com.hfkj.service.user.BsUserCountService; +import com.hfkj.sysenum.user.UserGradeEnum; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @className: BsUserCountServiceImpl + * @author: HuRui + * @date: 2024/10/20 + **/ +@Service("userCountService") +public class BsUserCountServiceImpl implements BsUserCountService { + @Resource + private BsUserMapper userMapper; + @Resource + private BsUserLoginLogMapper userLoginLogMapper; + @Resource + private BsUserGradeCountMapper userGradeCountMapper; + @Resource + private BsOrderMapper orderMapper; + + @Override + public Long countPlatformRegister(Date timeS, Date timeE) { + BsUserExample example = new BsUserExample(); + example.createCriteria().andCreateTimeGreaterThanOrEqualTo(timeS).andCreateTimeLessThanOrEqualTo(timeE); + return userMapper.countByExample(example); + } + + @Override + public Long countAdd(Date timeS, Date timeE) { + BsUserExample example = new BsUserExample(); + example.createCriteria().andCreateTimeGreaterThanOrEqualTo(timeS).andCreateTimeLessThanOrEqualTo(timeE); + return userMapper.countByExample(example); + } + + @Override + public Long countLogin(Date timeS, Date timeE) { + BsUserLoginLogExample example = new BsUserLoginLogExample(); + example.createCriteria().andCreateTimeGreaterThanOrEqualTo(timeS).andCreateTimeLessThanOrEqualTo(timeE); + return userLoginLogMapper.countByExample(example); + } + + @Override + public Long countPlaceOrder(Date timeS, Date timeE) throws Exception { + return orderMapper.countPlaceOrder(DateUtil.date2String(timeS, DateUtil.Y_M_D_HMS), DateUtil.date2String(timeE, DateUtil.Y_M_D_HMS)); + } + + @Override + public List> countUserGrade(Date timeS, Date timeE) throws Exception { + return userGradeCountMapper.collect(DateUtil.date2String(timeS, DateUtil.Y_M_D_HMS), DateUtil.date2String(timeE, DateUtil.Y_M_D_HMS)); + } +} diff --git a/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java index 0a708f5..3085fba 100644 --- a/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java @@ -186,8 +186,8 @@ public class BsUserServiceImpl implements BsUserService { if (user == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户"); } - if (!user.getStatus().equals(UserStatusEnum.status1.getCode())) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "状态不正确,无法封禁"); + if (!user.getStatus().equals(UserStatusEnum.status2.getCode())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "状态不正确,无法恢复"); } user.setStatus(UserStatusEnum.status1.getCode()); updateInfo(user); From fa93f774ef0a7f1428e4b26a74c2b9bb45586ce1 Mon Sep 17 00:00:00 2001 From: hu177768073 <177768073@qq.com> Date: Wed, 23 Oct 2024 16:46:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=AD=89=E7=BA=A7=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BsUserGradeConfigController.java | 90 ++ .../com/hfkj/schedule/UserGradeSchedule.java | 18 +- .../com/hfkj/dao/BsUserGradeConfigMapper.java | 125 +++ .../hfkj/dao/BsUserGradeConfigMapperExt.java | 7 + .../dao/BsUserGradeConfigSqlProvider.java | 332 ++++++ .../com/hfkj/entity/BsUserGradeConfig.java | 230 +++++ .../hfkj/entity/BsUserGradeConfigExample.java | 974 ++++++++++++++++++ .../user/BsUserGradeConfigService.java | 35 + .../impl/BsUserGradeConfigServiceImpl.java | 60 ++ 9 files changed, 1865 insertions(+), 6 deletions(-) create mode 100644 bweb/src/main/java/com/hfkj/controller/BsUserGradeConfigController.java create mode 100644 service/src/main/java/com/hfkj/dao/BsUserGradeConfigMapper.java create mode 100644 service/src/main/java/com/hfkj/dao/BsUserGradeConfigMapperExt.java create mode 100644 service/src/main/java/com/hfkj/dao/BsUserGradeConfigSqlProvider.java create mode 100644 service/src/main/java/com/hfkj/entity/BsUserGradeConfig.java create mode 100644 service/src/main/java/com/hfkj/entity/BsUserGradeConfigExample.java create mode 100644 service/src/main/java/com/hfkj/service/user/BsUserGradeConfigService.java create mode 100644 service/src/main/java/com/hfkj/service/user/impl/BsUserGradeConfigServiceImpl.java diff --git a/bweb/src/main/java/com/hfkj/controller/BsUserGradeConfigController.java b/bweb/src/main/java/com/hfkj/controller/BsUserGradeConfigController.java new file mode 100644 index 0000000..139ed23 --- /dev/null +++ b/bweb/src/main/java/com/hfkj/controller/BsUserGradeConfigController.java @@ -0,0 +1,90 @@ +package com.hfkj.controller; + +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.entity.BsUserGradeConfig; +import com.hfkj.model.ResponseData; +import com.hfkj.service.user.BsUserGradeConfigService; +import com.hfkj.sysenum.user.UserGradeEnum; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.HashMap; + +/** + * @className: BsUserGradeConfigController + * @author: HuRui + * @date: 2024/10/23 + **/ +@Controller +@RequestMapping(value = "/userGradeConfig") +@Api(value = "用户等级配置") +public class BsUserGradeConfigController { + private static Logger log = LoggerFactory.getLogger(BsUserCountController.class); + @Resource + private BsUserGradeConfigService userGradeConfigService; + + @RequestMapping(value="/update",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "修改") + public ResponseData update(@RequestBody BsUserGradeConfig body) { + try { + if (body.getGrade() == null + || body.getGradeIncomeRatio() == null + || body.getOrderIncomeRatio() == null + ) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + // 查询配置 + BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.getDataByType(body.getGrade())); + if (config == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + config.setGradeIncomeRatio(body.getGradeIncomeRatio()); + config.setOrderIncomeRatio(body.getOrderIncomeRatio()); + config.setPromotionConditions1(body.getPromotionConditions1()); + config.setPromotionConditions2(body.getPromotionConditions2()); + config.setPromotionConditions3(body.getPromotionConditions3()); + userGradeConfigService.updateData(config); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getConfig",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询配置") + public ResponseData getConfig(@RequestParam(value = "grade" , required = true) Integer grade) { + try { + + return ResponseMsgUtil.success(userGradeConfigService.getConfig(UserGradeEnum.getDataByType(grade))); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getList",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询列表") + public ResponseData getList() { + try { + + return ResponseMsgUtil.success(userGradeConfigService.getList(new HashMap<>())); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } +} diff --git a/schedule/src/main/java/com/hfkj/schedule/UserGradeSchedule.java b/schedule/src/main/java/com/hfkj/schedule/UserGradeSchedule.java index 88c4b1d..9b90240 100644 --- a/schedule/src/main/java/com/hfkj/schedule/UserGradeSchedule.java +++ b/schedule/src/main/java/com/hfkj/schedule/UserGradeSchedule.java @@ -25,6 +25,7 @@ import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; /** * @className: UserGradeSchedule @@ -119,7 +120,7 @@ public class UserGradeSchedule { } - @Scheduled(cron = "0 30 5 * * ?") // 每日凌晨05:00:00 执行一次 + @Scheduled(cron = "0 30 5 * * ?") // 每日凌晨05:30:00 执行一次 public void count() { try { // 昨日时间 @@ -127,13 +128,18 @@ public class UserGradeSchedule { BsUserGradeCount userGradeCount = new BsUserGradeCount(); userGradeCount.setStartTime(todayTime.get("timeS")); - userGradeCount.setEndTime(todayTime.get("timeE")); + userGradeCount.setEndTime(new Date()); userGradeCount.setCreateTime(new Date()); - // userGradeCount.setGrade1(userCountService.countUserGrade(UserGradeEnum.grade1, todayTime.get("timeS"), todayTime.get("timeE"))); - // userGradeCount.setGrade2(userCountService.countUserGrade(UserGradeEnum.grade2, todayTime.get("timeS"), todayTime.get("timeE"))); - // userGradeCount.setGrade3(userCountService.countUserGrade(UserGradeEnum.grade3, todayTime.get("timeS"), todayTime.get("timeE"))); - // userGradeCount.setGrade4(userCountService.countUserGrade(UserGradeEnum.grade4, todayTime.get("timeS"), todayTime.get("timeE"))); + List> mapList = userCountService.countUserGrade(todayTime.get("timeS"), userGradeCount.getEndTime()); + List> grade1 = mapList.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade1.getCode())).collect(Collectors.toList()); + List> grade2 = mapList.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade2.getCode())).collect(Collectors.toList()); + List> grade3 = mapList.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade3.getCode())).collect(Collectors.toList()); + List> grade4 = mapList.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade4.getCode())).collect(Collectors.toList()); + userGradeCount.setGrade1(grade1.isEmpty()?0L:Long.parseLong(grade1.get(0).get("count").toString())); + userGradeCount.setGrade2(grade2.isEmpty()?0L:Long.parseLong(grade2.get(0).get("count").toString())); + userGradeCount.setGrade3(grade3.isEmpty()?0L:Long.parseLong(grade3.get(0).get("count").toString())); + userGradeCount.setGrade4(grade4.isEmpty()?0L:Long.parseLong(grade4.get(0).get("count").toString())); userGradeCountMapper.insert(userGradeCount); } catch (Exception e) { diff --git a/service/src/main/java/com/hfkj/dao/BsUserGradeConfigMapper.java b/service/src/main/java/com/hfkj/dao/BsUserGradeConfigMapper.java new file mode 100644 index 0000000..70ed14a --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserGradeConfigMapper.java @@ -0,0 +1,125 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsUserGradeConfig; +import com.hfkj.entity.BsUserGradeConfigExample; +import java.util.List; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.DeleteProvider; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.InsertProvider; +import org.apache.ibatis.annotations.Options; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Result; +import org.apache.ibatis.annotations.Results; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.SelectProvider; +import org.apache.ibatis.annotations.Update; +import org.apache.ibatis.annotations.UpdateProvider; +import org.apache.ibatis.type.JdbcType; +import org.springframework.stereotype.Repository; + +/** + * + * 代码由工具生成,请勿修改!!! + * 如果需要扩展请在其父类进行扩展 + * + **/ +@Repository +public interface BsUserGradeConfigMapper extends BsUserGradeConfigMapperExt { + @SelectProvider(type=BsUserGradeConfigSqlProvider.class, method="countByExample") + long countByExample(BsUserGradeConfigExample example); + + @DeleteProvider(type=BsUserGradeConfigSqlProvider.class, method="deleteByExample") + int deleteByExample(BsUserGradeConfigExample example); + + @Delete({ + "delete from bs_user_grade_config", + "where id = #{id,jdbcType=INTEGER}" + }) + int deleteByPrimaryKey(Integer id); + + @Insert({ + "insert into bs_user_grade_config (grade, grade_income_ratio, ", + "order_income_ratio, promotion_conditions_1, ", + "promotion_conditions_2, promotion_conditions_3, ", + "create_time, update_time, ", + "ext_1, ext_2, ext_3)", + "values (#{grade,jdbcType=INTEGER}, #{gradeIncomeRatio,jdbcType=DECIMAL}, ", + "#{orderIncomeRatio,jdbcType=DECIMAL}, #{promotionConditions1,jdbcType=DECIMAL}, ", + "#{promotionConditions2,jdbcType=DECIMAL}, #{promotionConditions3,jdbcType=DECIMAL}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + }) + @Options(useGeneratedKeys=true,keyProperty="id") + int insert(BsUserGradeConfig record); + + @InsertProvider(type=BsUserGradeConfigSqlProvider.class, method="insertSelective") + @Options(useGeneratedKeys=true,keyProperty="id") + int insertSelective(BsUserGradeConfig record); + + @SelectProvider(type=BsUserGradeConfigSqlProvider.class, method="selectByExample") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true), + @Result(column="grade", property="grade", jdbcType=JdbcType.INTEGER), + @Result(column="grade_income_ratio", property="gradeIncomeRatio", jdbcType=JdbcType.DECIMAL), + @Result(column="order_income_ratio", property="orderIncomeRatio", jdbcType=JdbcType.DECIMAL), + @Result(column="promotion_conditions_1", property="promotionConditions1", jdbcType=JdbcType.DECIMAL), + @Result(column="promotion_conditions_2", property="promotionConditions2", jdbcType=JdbcType.DECIMAL), + @Result(column="promotion_conditions_3", property="promotionConditions3", jdbcType=JdbcType.DECIMAL), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + }) + List selectByExample(BsUserGradeConfigExample example); + + @Select({ + "select", + "id, grade, grade_income_ratio, order_income_ratio, promotion_conditions_1, promotion_conditions_2, ", + "promotion_conditions_3, create_time, update_time, ext_1, ext_2, ext_3", + "from bs_user_grade_config", + "where id = #{id,jdbcType=INTEGER}" + }) + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true), + @Result(column="grade", property="grade", jdbcType=JdbcType.INTEGER), + @Result(column="grade_income_ratio", property="gradeIncomeRatio", jdbcType=JdbcType.DECIMAL), + @Result(column="order_income_ratio", property="orderIncomeRatio", jdbcType=JdbcType.DECIMAL), + @Result(column="promotion_conditions_1", property="promotionConditions1", jdbcType=JdbcType.DECIMAL), + @Result(column="promotion_conditions_2", property="promotionConditions2", jdbcType=JdbcType.DECIMAL), + @Result(column="promotion_conditions_3", property="promotionConditions3", jdbcType=JdbcType.DECIMAL), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + }) + BsUserGradeConfig selectByPrimaryKey(Integer id); + + @UpdateProvider(type=BsUserGradeConfigSqlProvider.class, method="updateByExampleSelective") + int updateByExampleSelective(@Param("record") BsUserGradeConfig record, @Param("example") BsUserGradeConfigExample example); + + @UpdateProvider(type=BsUserGradeConfigSqlProvider.class, method="updateByExample") + int updateByExample(@Param("record") BsUserGradeConfig record, @Param("example") BsUserGradeConfigExample example); + + @UpdateProvider(type=BsUserGradeConfigSqlProvider.class, method="updateByPrimaryKeySelective") + int updateByPrimaryKeySelective(BsUserGradeConfig record); + + @Update({ + "update bs_user_grade_config", + "set grade = #{grade,jdbcType=INTEGER},", + "grade_income_ratio = #{gradeIncomeRatio,jdbcType=DECIMAL},", + "order_income_ratio = #{orderIncomeRatio,jdbcType=DECIMAL},", + "promotion_conditions_1 = #{promotionConditions1,jdbcType=DECIMAL},", + "promotion_conditions_2 = #{promotionConditions2,jdbcType=DECIMAL},", + "promotion_conditions_3 = #{promotionConditions3,jdbcType=DECIMAL},", + "create_time = #{createTime,jdbcType=TIMESTAMP},", + "update_time = #{updateTime,jdbcType=TIMESTAMP},", + "ext_1 = #{ext1,jdbcType=VARCHAR},", + "ext_2 = #{ext2,jdbcType=VARCHAR},", + "ext_3 = #{ext3,jdbcType=VARCHAR}", + "where id = #{id,jdbcType=INTEGER}" + }) + int updateByPrimaryKey(BsUserGradeConfig record); +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserGradeConfigMapperExt.java b/service/src/main/java/com/hfkj/dao/BsUserGradeConfigMapperExt.java new file mode 100644 index 0000000..89426ed --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserGradeConfigMapperExt.java @@ -0,0 +1,7 @@ +package com.hfkj.dao; + +/** + * mapper扩展类 + */ +public interface BsUserGradeConfigMapperExt { +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserGradeConfigSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsUserGradeConfigSqlProvider.java new file mode 100644 index 0000000..0f23fd4 --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserGradeConfigSqlProvider.java @@ -0,0 +1,332 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsUserGradeConfig; +import com.hfkj.entity.BsUserGradeConfigExample.Criteria; +import com.hfkj.entity.BsUserGradeConfigExample.Criterion; +import com.hfkj.entity.BsUserGradeConfigExample; +import java.util.List; +import java.util.Map; +import org.apache.ibatis.jdbc.SQL; + +public class BsUserGradeConfigSqlProvider { + + public String countByExample(BsUserGradeConfigExample example) { + SQL sql = new SQL(); + sql.SELECT("count(*)").FROM("bs_user_grade_config"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String deleteByExample(BsUserGradeConfigExample example) { + SQL sql = new SQL(); + sql.DELETE_FROM("bs_user_grade_config"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String insertSelective(BsUserGradeConfig record) { + SQL sql = new SQL(); + sql.INSERT_INTO("bs_user_grade_config"); + + if (record.getGrade() != null) { + sql.VALUES("grade", "#{grade,jdbcType=INTEGER}"); + } + + if (record.getGradeIncomeRatio() != null) { + sql.VALUES("grade_income_ratio", "#{gradeIncomeRatio,jdbcType=DECIMAL}"); + } + + if (record.getOrderIncomeRatio() != null) { + sql.VALUES("order_income_ratio", "#{orderIncomeRatio,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions1() != null) { + sql.VALUES("promotion_conditions_1", "#{promotionConditions1,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions2() != null) { + sql.VALUES("promotion_conditions_2", "#{promotionConditions2,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions3() != null) { + sql.VALUES("promotion_conditions_3", "#{promotionConditions3,jdbcType=DECIMAL}"); + } + + if (record.getCreateTime() != null) { + sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); + } + + if (record.getUpdateTime() != null) { + sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); + } + + if (record.getExt1() != null) { + sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); + } + + if (record.getExt2() != null) { + sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}"); + } + + if (record.getExt3() != null) { + sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); + } + + return sql.toString(); + } + + public String selectByExample(BsUserGradeConfigExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("grade"); + sql.SELECT("grade_income_ratio"); + sql.SELECT("order_income_ratio"); + sql.SELECT("promotion_conditions_1"); + sql.SELECT("promotion_conditions_2"); + sql.SELECT("promotion_conditions_3"); + sql.SELECT("create_time"); + sql.SELECT("update_time"); + sql.SELECT("ext_1"); + sql.SELECT("ext_2"); + sql.SELECT("ext_3"); + sql.FROM("bs_user_grade_config"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + + return sql.toString(); + } + + public String updateByExampleSelective(Map parameter) { + BsUserGradeConfig record = (BsUserGradeConfig) parameter.get("record"); + BsUserGradeConfigExample example = (BsUserGradeConfigExample) parameter.get("example"); + + SQL sql = new SQL(); + sql.UPDATE("bs_user_grade_config"); + + if (record.getId() != null) { + sql.SET("id = #{record.id,jdbcType=INTEGER}"); + } + + if (record.getGrade() != null) { + sql.SET("grade = #{record.grade,jdbcType=INTEGER}"); + } + + if (record.getGradeIncomeRatio() != null) { + sql.SET("grade_income_ratio = #{record.gradeIncomeRatio,jdbcType=DECIMAL}"); + } + + if (record.getOrderIncomeRatio() != null) { + sql.SET("order_income_ratio = #{record.orderIncomeRatio,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions1() != null) { + sql.SET("promotion_conditions_1 = #{record.promotionConditions1,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions2() != null) { + sql.SET("promotion_conditions_2 = #{record.promotionConditions2,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions3() != null) { + sql.SET("promotion_conditions_3 = #{record.promotionConditions3,jdbcType=DECIMAL}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + } + + if (record.getUpdateTime() != null) { + sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); + } + + if (record.getExt1() != null) { + sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); + } + + if (record.getExt2() != null) { + sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); + } + + if (record.getExt3() != null) { + sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); + } + + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByExample(Map parameter) { + SQL sql = new SQL(); + sql.UPDATE("bs_user_grade_config"); + + sql.SET("id = #{record.id,jdbcType=INTEGER}"); + sql.SET("grade = #{record.grade,jdbcType=INTEGER}"); + sql.SET("grade_income_ratio = #{record.gradeIncomeRatio,jdbcType=DECIMAL}"); + sql.SET("order_income_ratio = #{record.orderIncomeRatio,jdbcType=DECIMAL}"); + sql.SET("promotion_conditions_1 = #{record.promotionConditions1,jdbcType=DECIMAL}"); + sql.SET("promotion_conditions_2 = #{record.promotionConditions2,jdbcType=DECIMAL}"); + sql.SET("promotion_conditions_3 = #{record.promotionConditions3,jdbcType=DECIMAL}"); + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); + sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); + sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); + sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); + + BsUserGradeConfigExample example = (BsUserGradeConfigExample) parameter.get("example"); + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByPrimaryKeySelective(BsUserGradeConfig record) { + SQL sql = new SQL(); + sql.UPDATE("bs_user_grade_config"); + + if (record.getGrade() != null) { + sql.SET("grade = #{grade,jdbcType=INTEGER}"); + } + + if (record.getGradeIncomeRatio() != null) { + sql.SET("grade_income_ratio = #{gradeIncomeRatio,jdbcType=DECIMAL}"); + } + + if (record.getOrderIncomeRatio() != null) { + sql.SET("order_income_ratio = #{orderIncomeRatio,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions1() != null) { + sql.SET("promotion_conditions_1 = #{promotionConditions1,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions2() != null) { + sql.SET("promotion_conditions_2 = #{promotionConditions2,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions3() != null) { + sql.SET("promotion_conditions_3 = #{promotionConditions3,jdbcType=DECIMAL}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); + } + + if (record.getUpdateTime() != null) { + sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); + } + + if (record.getExt1() != null) { + sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); + } + + if (record.getExt2() != null) { + sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); + } + + if (record.getExt3() != null) { + sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); + } + + sql.WHERE("id = #{id,jdbcType=INTEGER}"); + + return sql.toString(); + } + + protected void applyWhere(SQL sql, BsUserGradeConfigExample example, boolean includeExamplePhrase) { + if (example == null) { + return; + } + + String parmPhrase1; + String parmPhrase1_th; + String parmPhrase2; + String parmPhrase2_th; + String parmPhrase3; + String parmPhrase3_th; + if (includeExamplePhrase) { + parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; + parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; + parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; + parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; + parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; + parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; + } else { + parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; + parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; + parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; + parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; + parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; + parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; + } + + StringBuilder sb = new StringBuilder(); + List oredCriteria = example.getOredCriteria(); + boolean firstCriteria = true; + for (int i = 0; i < oredCriteria.size(); i++) { + Criteria criteria = oredCriteria.get(i); + if (criteria.isValid()) { + if (firstCriteria) { + firstCriteria = false; + } else { + sb.append(" or "); + } + + sb.append('('); + List criterions = criteria.getAllCriteria(); + boolean firstCriterion = true; + for (int j = 0; j < criterions.size(); j++) { + Criterion criterion = criterions.get(j); + if (firstCriterion) { + firstCriterion = false; + } else { + sb.append(" and "); + } + + if (criterion.isNoValue()) { + sb.append(criterion.getCondition()); + } else if (criterion.isSingleValue()) { + if (criterion.getTypeHandler() == null) { + sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); + } else { + sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); + } + } else if (criterion.isBetweenValue()) { + if (criterion.getTypeHandler() == null) { + sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); + } else { + sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); + } + } else if (criterion.isListValue()) { + sb.append(criterion.getCondition()); + sb.append(" ("); + List listItems = (List) criterion.getValue(); + boolean comma = false; + for (int k = 0; k < listItems.size(); k++) { + if (comma) { + sb.append(", "); + } else { + comma = true; + } + if (criterion.getTypeHandler() == null) { + sb.append(String.format(parmPhrase3, i, j, k)); + } else { + sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); + } + } + sb.append(')'); + } + } + sb.append(')'); + } + } + + if (sb.length() > 0) { + sql.WHERE(sb.toString()); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsUserGradeConfig.java b/service/src/main/java/com/hfkj/entity/BsUserGradeConfig.java new file mode 100644 index 0000000..137beef --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsUserGradeConfig.java @@ -0,0 +1,230 @@ +package com.hfkj.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * bs_user_grade_config + * @author + */ +/** + * + * 代码由工具生成 + * + **/ +public class BsUserGradeConfig implements Serializable { + private Integer id; + + /** + * 等级 + */ + private Integer grade; + + /** + * 等级收益 + */ + private BigDecimal gradeIncomeRatio; + + /** + * 订单收益 + */ + private BigDecimal orderIncomeRatio; + + /** + * 晋升条件1 + */ + private BigDecimal promotionConditions1; + + /** + * 晋升条件2 + */ + private BigDecimal promotionConditions2; + + /** + * 晋升条件3 + */ + private BigDecimal promotionConditions3; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 修改时间 + */ + private Date updateTime; + + private String ext1; + + private String ext2; + + private String ext3; + + private static final long serialVersionUID = 1L; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getGrade() { + return grade; + } + + public void setGrade(Integer grade) { + this.grade = grade; + } + + public BigDecimal getGradeIncomeRatio() { + return gradeIncomeRatio; + } + + public void setGradeIncomeRatio(BigDecimal gradeIncomeRatio) { + this.gradeIncomeRatio = gradeIncomeRatio; + } + + public BigDecimal getOrderIncomeRatio() { + return orderIncomeRatio; + } + + public void setOrderIncomeRatio(BigDecimal orderIncomeRatio) { + this.orderIncomeRatio = orderIncomeRatio; + } + + public BigDecimal getPromotionConditions1() { + return promotionConditions1; + } + + public void setPromotionConditions1(BigDecimal promotionConditions1) { + this.promotionConditions1 = promotionConditions1; + } + + public BigDecimal getPromotionConditions2() { + return promotionConditions2; + } + + public void setPromotionConditions2(BigDecimal promotionConditions2) { + this.promotionConditions2 = promotionConditions2; + } + + public BigDecimal getPromotionConditions3() { + return promotionConditions3; + } + + public void setPromotionConditions3(BigDecimal promotionConditions3) { + this.promotionConditions3 = promotionConditions3; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getExt1() { + return ext1; + } + + public void setExt1(String ext1) { + this.ext1 = ext1; + } + + public String getExt2() { + return ext2; + } + + public void setExt2(String ext2) { + this.ext2 = ext2; + } + + public String getExt3() { + return ext3; + } + + public void setExt3(String ext3) { + this.ext3 = ext3; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + BsUserGradeConfig other = (BsUserGradeConfig) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getGrade() == null ? other.getGrade() == null : this.getGrade().equals(other.getGrade())) + && (this.getGradeIncomeRatio() == null ? other.getGradeIncomeRatio() == null : this.getGradeIncomeRatio().equals(other.getGradeIncomeRatio())) + && (this.getOrderIncomeRatio() == null ? other.getOrderIncomeRatio() == null : this.getOrderIncomeRatio().equals(other.getOrderIncomeRatio())) + && (this.getPromotionConditions1() == null ? other.getPromotionConditions1() == null : this.getPromotionConditions1().equals(other.getPromotionConditions1())) + && (this.getPromotionConditions2() == null ? other.getPromotionConditions2() == null : this.getPromotionConditions2().equals(other.getPromotionConditions2())) + && (this.getPromotionConditions3() == null ? other.getPromotionConditions3() == null : this.getPromotionConditions3().equals(other.getPromotionConditions3())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) + && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) + && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) + && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) + && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getGrade() == null) ? 0 : getGrade().hashCode()); + result = prime * result + ((getGradeIncomeRatio() == null) ? 0 : getGradeIncomeRatio().hashCode()); + result = prime * result + ((getOrderIncomeRatio() == null) ? 0 : getOrderIncomeRatio().hashCode()); + result = prime * result + ((getPromotionConditions1() == null) ? 0 : getPromotionConditions1().hashCode()); + result = prime * result + ((getPromotionConditions2() == null) ? 0 : getPromotionConditions2().hashCode()); + result = prime * result + ((getPromotionConditions3() == null) ? 0 : getPromotionConditions3().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); + result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); + result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); + result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", grade=").append(grade); + sb.append(", gradeIncomeRatio=").append(gradeIncomeRatio); + sb.append(", orderIncomeRatio=").append(orderIncomeRatio); + sb.append(", promotionConditions1=").append(promotionConditions1); + sb.append(", promotionConditions2=").append(promotionConditions2); + sb.append(", promotionConditions3=").append(promotionConditions3); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", ext1=").append(ext1); + sb.append(", ext2=").append(ext2); + sb.append(", ext3=").append(ext3); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsUserGradeConfigExample.java b/service/src/main/java/com/hfkj/entity/BsUserGradeConfigExample.java new file mode 100644 index 0000000..b8cb000 --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsUserGradeConfigExample.java @@ -0,0 +1,974 @@ +package com.hfkj.entity; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class BsUserGradeConfigExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public BsUserGradeConfigExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andGradeIsNull() { + addCriterion("grade is null"); + return (Criteria) this; + } + + public Criteria andGradeIsNotNull() { + addCriterion("grade is not null"); + return (Criteria) this; + } + + public Criteria andGradeEqualTo(Integer value) { + addCriterion("grade =", value, "grade"); + return (Criteria) this; + } + + public Criteria andGradeNotEqualTo(Integer value) { + addCriterion("grade <>", value, "grade"); + return (Criteria) this; + } + + public Criteria andGradeGreaterThan(Integer value) { + addCriterion("grade >", value, "grade"); + return (Criteria) this; + } + + public Criteria andGradeGreaterThanOrEqualTo(Integer value) { + addCriterion("grade >=", value, "grade"); + return (Criteria) this; + } + + public Criteria andGradeLessThan(Integer value) { + addCriterion("grade <", value, "grade"); + return (Criteria) this; + } + + public Criteria andGradeLessThanOrEqualTo(Integer value) { + addCriterion("grade <=", value, "grade"); + return (Criteria) this; + } + + public Criteria andGradeIn(List values) { + addCriterion("grade in", values, "grade"); + return (Criteria) this; + } + + public Criteria andGradeNotIn(List values) { + addCriterion("grade not in", values, "grade"); + return (Criteria) this; + } + + public Criteria andGradeBetween(Integer value1, Integer value2) { + addCriterion("grade between", value1, value2, "grade"); + return (Criteria) this; + } + + public Criteria andGradeNotBetween(Integer value1, Integer value2) { + addCriterion("grade not between", value1, value2, "grade"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioIsNull() { + addCriterion("grade_income_ratio is null"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioIsNotNull() { + addCriterion("grade_income_ratio is not null"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioEqualTo(BigDecimal value) { + addCriterion("grade_income_ratio =", value, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioNotEqualTo(BigDecimal value) { + addCriterion("grade_income_ratio <>", value, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioGreaterThan(BigDecimal value) { + addCriterion("grade_income_ratio >", value, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("grade_income_ratio >=", value, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioLessThan(BigDecimal value) { + addCriterion("grade_income_ratio <", value, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioLessThanOrEqualTo(BigDecimal value) { + addCriterion("grade_income_ratio <=", value, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioIn(List values) { + addCriterion("grade_income_ratio in", values, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioNotIn(List values) { + addCriterion("grade_income_ratio not in", values, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("grade_income_ratio between", value1, value2, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("grade_income_ratio not between", value1, value2, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioIsNull() { + addCriterion("order_income_ratio is null"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioIsNotNull() { + addCriterion("order_income_ratio is not null"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioEqualTo(BigDecimal value) { + addCriterion("order_income_ratio =", value, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioNotEqualTo(BigDecimal value) { + addCriterion("order_income_ratio <>", value, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioGreaterThan(BigDecimal value) { + addCriterion("order_income_ratio >", value, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("order_income_ratio >=", value, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioLessThan(BigDecimal value) { + addCriterion("order_income_ratio <", value, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioLessThanOrEqualTo(BigDecimal value) { + addCriterion("order_income_ratio <=", value, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioIn(List values) { + addCriterion("order_income_ratio in", values, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioNotIn(List values) { + addCriterion("order_income_ratio not in", values, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("order_income_ratio between", value1, value2, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("order_income_ratio not between", value1, value2, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1IsNull() { + addCriterion("promotion_conditions_1 is null"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1IsNotNull() { + addCriterion("promotion_conditions_1 is not null"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1EqualTo(BigDecimal value) { + addCriterion("promotion_conditions_1 =", value, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1NotEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_1 <>", value, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1GreaterThan(BigDecimal value) { + addCriterion("promotion_conditions_1 >", value, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1GreaterThanOrEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_1 >=", value, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1LessThan(BigDecimal value) { + addCriterion("promotion_conditions_1 <", value, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1LessThanOrEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_1 <=", value, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1In(List values) { + addCriterion("promotion_conditions_1 in", values, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1NotIn(List values) { + addCriterion("promotion_conditions_1 not in", values, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1Between(BigDecimal value1, BigDecimal value2) { + addCriterion("promotion_conditions_1 between", value1, value2, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1NotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("promotion_conditions_1 not between", value1, value2, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2IsNull() { + addCriterion("promotion_conditions_2 is null"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2IsNotNull() { + addCriterion("promotion_conditions_2 is not null"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2EqualTo(BigDecimal value) { + addCriterion("promotion_conditions_2 =", value, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2NotEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_2 <>", value, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2GreaterThan(BigDecimal value) { + addCriterion("promotion_conditions_2 >", value, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2GreaterThanOrEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_2 >=", value, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2LessThan(BigDecimal value) { + addCriterion("promotion_conditions_2 <", value, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2LessThanOrEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_2 <=", value, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2In(List values) { + addCriterion("promotion_conditions_2 in", values, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2NotIn(List values) { + addCriterion("promotion_conditions_2 not in", values, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2Between(BigDecimal value1, BigDecimal value2) { + addCriterion("promotion_conditions_2 between", value1, value2, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2NotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("promotion_conditions_2 not between", value1, value2, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3IsNull() { + addCriterion("promotion_conditions_3 is null"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3IsNotNull() { + addCriterion("promotion_conditions_3 is not null"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3EqualTo(BigDecimal value) { + addCriterion("promotion_conditions_3 =", value, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3NotEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_3 <>", value, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3GreaterThan(BigDecimal value) { + addCriterion("promotion_conditions_3 >", value, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3GreaterThanOrEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_3 >=", value, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3LessThan(BigDecimal value) { + addCriterion("promotion_conditions_3 <", value, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3LessThanOrEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_3 <=", value, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3In(List values) { + addCriterion("promotion_conditions_3 in", values, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3NotIn(List values) { + addCriterion("promotion_conditions_3 not in", values, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3Between(BigDecimal value1, BigDecimal value2) { + addCriterion("promotion_conditions_3 between", value1, value2, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3NotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("promotion_conditions_3 not between", value1, value2, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andExt1IsNull() { + addCriterion("ext_1 is null"); + return (Criteria) this; + } + + public Criteria andExt1IsNotNull() { + addCriterion("ext_1 is not null"); + return (Criteria) this; + } + + public Criteria andExt1EqualTo(String value) { + addCriterion("ext_1 =", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotEqualTo(String value) { + addCriterion("ext_1 <>", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThan(String value) { + addCriterion("ext_1 >", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThanOrEqualTo(String value) { + addCriterion("ext_1 >=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThan(String value) { + addCriterion("ext_1 <", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThanOrEqualTo(String value) { + addCriterion("ext_1 <=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Like(String value) { + addCriterion("ext_1 like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotLike(String value) { + addCriterion("ext_1 not like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1In(List values) { + addCriterion("ext_1 in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotIn(List values) { + addCriterion("ext_1 not in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Between(String value1, String value2) { + addCriterion("ext_1 between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotBetween(String value1, String value2) { + addCriterion("ext_1 not between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt2IsNull() { + addCriterion("ext_2 is null"); + return (Criteria) this; + } + + public Criteria andExt2IsNotNull() { + addCriterion("ext_2 is not null"); + return (Criteria) this; + } + + public Criteria andExt2EqualTo(String value) { + addCriterion("ext_2 =", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotEqualTo(String value) { + addCriterion("ext_2 <>", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThan(String value) { + addCriterion("ext_2 >", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThanOrEqualTo(String value) { + addCriterion("ext_2 >=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThan(String value) { + addCriterion("ext_2 <", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThanOrEqualTo(String value) { + addCriterion("ext_2 <=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Like(String value) { + addCriterion("ext_2 like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotLike(String value) { + addCriterion("ext_2 not like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2In(List values) { + addCriterion("ext_2 in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotIn(List values) { + addCriterion("ext_2 not in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Between(String value1, String value2) { + addCriterion("ext_2 between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotBetween(String value1, String value2) { + addCriterion("ext_2 not between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt3IsNull() { + addCriterion("ext_3 is null"); + return (Criteria) this; + } + + public Criteria andExt3IsNotNull() { + addCriterion("ext_3 is not null"); + return (Criteria) this; + } + + public Criteria andExt3EqualTo(String value) { + addCriterion("ext_3 =", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotEqualTo(String value) { + addCriterion("ext_3 <>", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThan(String value) { + addCriterion("ext_3 >", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThanOrEqualTo(String value) { + addCriterion("ext_3 >=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThan(String value) { + addCriterion("ext_3 <", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThanOrEqualTo(String value) { + addCriterion("ext_3 <=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Like(String value) { + addCriterion("ext_3 like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotLike(String value) { + addCriterion("ext_3 not like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3In(List values) { + addCriterion("ext_3 in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotIn(List values) { + addCriterion("ext_3 not in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Between(String value1, String value2) { + addCriterion("ext_3 between", value1, value2, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotBetween(String value1, String value2) { + addCriterion("ext_3 not between", value1, value2, "ext3"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/service/user/BsUserGradeConfigService.java b/service/src/main/java/com/hfkj/service/user/BsUserGradeConfigService.java new file mode 100644 index 0000000..a76f61d --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/BsUserGradeConfigService.java @@ -0,0 +1,35 @@ +package com.hfkj.service.user; + +import com.hfkj.entity.BsUserGradeConfig; +import com.hfkj.sysenum.user.UserGradeEnum; + +import java.util.List; +import java.util.Map; + +/** + * @className: BsUserGradeConfigService + * @author: HuRui + * @date: 2024/10/23 + **/ +public interface BsUserGradeConfigService { + + /** + * 修改数据 + * @param data + */ + void updateData(BsUserGradeConfig data); + + /** + * 获取配置 + * @param userGrade + * @return + */ + BsUserGradeConfig getConfig(UserGradeEnum userGrade); + + /** + * 查询列表 + * @param param + * @return + */ + List getList(Map param); +} diff --git a/service/src/main/java/com/hfkj/service/user/impl/BsUserGradeConfigServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/BsUserGradeConfigServiceImpl.java new file mode 100644 index 0000000..db4cc91 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/impl/BsUserGradeConfigServiceImpl.java @@ -0,0 +1,60 @@ +package com.hfkj.service.user.impl; + +import com.hfkj.common.utils.RedisUtil; +import com.hfkj.dao.BsUserGradeConfigMapper; +import com.hfkj.entity.BsUserGradeConfig; +import com.hfkj.entity.BsUserGradeConfigExample; +import com.hfkj.service.user.BsUserGradeConfigService; +import com.hfkj.sysenum.user.UserGradeEnum; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * @className: BsUserGradeConfigServiceImpl + * @author: HuRui + * @date: 2024/10/23 + **/ +@Service("userGradeConfigService") +public class BsUserGradeConfigServiceImpl implements BsUserGradeConfigService { + @Resource + private BsUserGradeConfigMapper userGradeConfigMapper; + @Resource + private RedisUtil redisUtil; + private final static String CACHE = "USER_GRADE_CONFIG:"; + @Override + public void updateData(BsUserGradeConfig data) { + userGradeConfigMapper.updateByPrimaryKey(data); + // 缓存 + redisUtil.set(CACHE+data.getGrade(), data); + } + + @Override + public BsUserGradeConfig getConfig(UserGradeEnum userGrade) { + Object cache = redisUtil.get(CACHE + userGrade); + if (cache != null) { + return (BsUserGradeConfig) cache; + } + + BsUserGradeConfigExample example = new BsUserGradeConfigExample(); + example.createCriteria().andGradeEqualTo(userGrade.getCode()); + List list = userGradeConfigMapper.selectByExample(example); + if (!list.isEmpty()) { + BsUserGradeConfig data = list.get(0); + // 缓存 + redisUtil.set(CACHE+data.getGrade(), data); + return data; + } + return null; + } + + @Override + public List getList(Map param) { + BsUserGradeConfigExample example = new BsUserGradeConfigExample(); + example.createCriteria(); + example.setOrderByClause("id asc"); + return userGradeConfigMapper.selectByExample(example); + } +} From c5cff06b2f1d53569d3f4a2c377a6f0483105c63 Mon Sep 17 00:00:00 2001 From: hu177768073 <177768073@qq.com> Date: Thu, 24 Oct 2024 10:38:06 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hfkj/dao/BsUserMapper.java | 11 +- .../java/com/hfkj/dao/BsUserSqlProvider.java | 28 ++++ .../src/main/java/com/hfkj/entity/BsUser.java | 33 +++++ .../java/com/hfkj/entity/BsUserExample.java | 121 ++++++++++++++++++ 4 files changed, 192 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/com/hfkj/dao/BsUserMapper.java b/service/src/main/java/com/hfkj/dao/BsUserMapper.java index 876339b..42dc362 100644 --- a/service/src/main/java/com/hfkj/dao/BsUserMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsUserMapper.java @@ -42,12 +42,14 @@ public interface BsUserMapper extends BsUserMapperExt { "insert into bs_user (head_img, `name`, ", "phone, grade, wechat_num, ", "invite_user_id, invite_time, ", + "partner_level, partner_income_per, ", "`status`, create_time, ", "update_time, ext_1, ", "ext_2, ext_3)", "values (#{headImg,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ", "#{phone,jdbcType=VARCHAR}, #{grade,jdbcType=INTEGER}, #{wechatNum,jdbcType=VARCHAR}, ", "#{inviteUserId,jdbcType=BIGINT}, #{inviteTime,jdbcType=TIMESTAMP}, ", + "#{partnerLevel,jdbcType=INTEGER}, #{partnerIncomePer,jdbcType=DECIMAL}, ", "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" @@ -69,6 +71,8 @@ public interface BsUserMapper extends BsUserMapperExt { @Result(column="wechat_num", property="wechatNum", jdbcType=JdbcType.VARCHAR), @Result(column="invite_user_id", property="inviteUserId", jdbcType=JdbcType.BIGINT), @Result(column="invite_time", property="inviteTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="partner_level", property="partnerLevel", jdbcType=JdbcType.INTEGER), + @Result(column="partner_income_per", property="partnerIncomePer", jdbcType=JdbcType.DECIMAL), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @@ -81,7 +85,8 @@ public interface BsUserMapper extends BsUserMapperExt { @Select({ "select", "id, head_img, `name`, phone, grade, wechat_num, invite_user_id, invite_time, ", - "`status`, create_time, update_time, ext_1, ext_2, ext_3", + "partner_level, partner_income_per, `status`, create_time, update_time, ext_1, ", + "ext_2, ext_3", "from bs_user", "where id = #{id,jdbcType=BIGINT}" }) @@ -94,6 +99,8 @@ public interface BsUserMapper extends BsUserMapperExt { @Result(column="wechat_num", property="wechatNum", jdbcType=JdbcType.VARCHAR), @Result(column="invite_user_id", property="inviteUserId", jdbcType=JdbcType.BIGINT), @Result(column="invite_time", property="inviteTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="partner_level", property="partnerLevel", jdbcType=JdbcType.INTEGER), + @Result(column="partner_income_per", property="partnerIncomePer", jdbcType=JdbcType.DECIMAL), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @@ -121,6 +128,8 @@ public interface BsUserMapper extends BsUserMapperExt { "wechat_num = #{wechatNum,jdbcType=VARCHAR},", "invite_user_id = #{inviteUserId,jdbcType=BIGINT},", "invite_time = #{inviteTime,jdbcType=TIMESTAMP},", + "partner_level = #{partnerLevel,jdbcType=INTEGER},", + "partner_income_per = #{partnerIncomePer,jdbcType=DECIMAL},", "`status` = #{status,jdbcType=INTEGER},", "create_time = #{createTime,jdbcType=TIMESTAMP},", "update_time = #{updateTime,jdbcType=TIMESTAMP},", diff --git a/service/src/main/java/com/hfkj/dao/BsUserSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsUserSqlProvider.java index d73baf0..107aec7 100644 --- a/service/src/main/java/com/hfkj/dao/BsUserSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsUserSqlProvider.java @@ -56,6 +56,14 @@ public class BsUserSqlProvider { sql.VALUES("invite_time", "#{inviteTime,jdbcType=TIMESTAMP}"); } + if (record.getPartnerLevel() != null) { + sql.VALUES("partner_level", "#{partnerLevel,jdbcType=INTEGER}"); + } + + if (record.getPartnerIncomePer() != null) { + sql.VALUES("partner_income_per", "#{partnerIncomePer,jdbcType=DECIMAL}"); + } + if (record.getStatus() != null) { sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); } @@ -97,6 +105,8 @@ public class BsUserSqlProvider { sql.SELECT("wechat_num"); sql.SELECT("invite_user_id"); sql.SELECT("invite_time"); + sql.SELECT("partner_level"); + sql.SELECT("partner_income_per"); sql.SELECT("`status`"); sql.SELECT("create_time"); sql.SELECT("update_time"); @@ -152,6 +162,14 @@ public class BsUserSqlProvider { sql.SET("invite_time = #{record.inviteTime,jdbcType=TIMESTAMP}"); } + if (record.getPartnerLevel() != null) { + sql.SET("partner_level = #{record.partnerLevel,jdbcType=INTEGER}"); + } + + if (record.getPartnerIncomePer() != null) { + sql.SET("partner_income_per = #{record.partnerIncomePer,jdbcType=DECIMAL}"); + } + if (record.getStatus() != null) { sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); } @@ -192,6 +210,8 @@ public class BsUserSqlProvider { sql.SET("wechat_num = #{record.wechatNum,jdbcType=VARCHAR}"); sql.SET("invite_user_id = #{record.inviteUserId,jdbcType=BIGINT}"); sql.SET("invite_time = #{record.inviteTime,jdbcType=TIMESTAMP}"); + sql.SET("partner_level = #{record.partnerLevel,jdbcType=INTEGER}"); + sql.SET("partner_income_per = #{record.partnerIncomePer,jdbcType=DECIMAL}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); @@ -236,6 +256,14 @@ public class BsUserSqlProvider { sql.SET("invite_time = #{inviteTime,jdbcType=TIMESTAMP}"); } + if (record.getPartnerLevel() != null) { + sql.SET("partner_level = #{partnerLevel,jdbcType=INTEGER}"); + } + + if (record.getPartnerIncomePer() != null) { + sql.SET("partner_income_per = #{partnerIncomePer,jdbcType=DECIMAL}"); + } + if (record.getStatus() != null) { sql.SET("`status` = #{status,jdbcType=INTEGER}"); } diff --git a/service/src/main/java/com/hfkj/entity/BsUser.java b/service/src/main/java/com/hfkj/entity/BsUser.java index 9dae977..7447507 100644 --- a/service/src/main/java/com/hfkj/entity/BsUser.java +++ b/service/src/main/java/com/hfkj/entity/BsUser.java @@ -1,6 +1,7 @@ package com.hfkj.entity; import java.io.Serializable; +import java.math.BigDecimal; import java.util.Date; /** @@ -53,6 +54,16 @@ public class BsUser implements Serializable { */ private Date inviteTime; + /** + * 合伙人等级 + */ + private Integer partnerLevel; + + /** + * 合伙人权益收益加成 + */ + private BigDecimal partnerIncomePer; + /** * 状态 0:删除 1:正常 2:禁用 */ @@ -140,6 +151,22 @@ public class BsUser implements Serializable { this.inviteTime = inviteTime; } + public Integer getPartnerLevel() { + return partnerLevel; + } + + public void setPartnerLevel(Integer partnerLevel) { + this.partnerLevel = partnerLevel; + } + + public BigDecimal getPartnerIncomePer() { + return partnerIncomePer; + } + + public void setPartnerIncomePer(BigDecimal partnerIncomePer) { + this.partnerIncomePer = partnerIncomePer; + } + public Integer getStatus() { return status; } @@ -208,6 +235,8 @@ public class BsUser implements Serializable { && (this.getWechatNum() == null ? other.getWechatNum() == null : this.getWechatNum().equals(other.getWechatNum())) && (this.getInviteUserId() == null ? other.getInviteUserId() == null : this.getInviteUserId().equals(other.getInviteUserId())) && (this.getInviteTime() == null ? other.getInviteTime() == null : this.getInviteTime().equals(other.getInviteTime())) + && (this.getPartnerLevel() == null ? other.getPartnerLevel() == null : this.getPartnerLevel().equals(other.getPartnerLevel())) + && (this.getPartnerIncomePer() == null ? other.getPartnerIncomePer() == null : this.getPartnerIncomePer().equals(other.getPartnerIncomePer())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) @@ -228,6 +257,8 @@ public class BsUser implements Serializable { result = prime * result + ((getWechatNum() == null) ? 0 : getWechatNum().hashCode()); result = prime * result + ((getInviteUserId() == null) ? 0 : getInviteUserId().hashCode()); result = prime * result + ((getInviteTime() == null) ? 0 : getInviteTime().hashCode()); + result = prime * result + ((getPartnerLevel() == null) ? 0 : getPartnerLevel().hashCode()); + result = prime * result + ((getPartnerIncomePer() == null) ? 0 : getPartnerIncomePer().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); @@ -251,6 +282,8 @@ public class BsUser implements Serializable { sb.append(", wechatNum=").append(wechatNum); sb.append(", inviteUserId=").append(inviteUserId); sb.append(", inviteTime=").append(inviteTime); + sb.append(", partnerLevel=").append(partnerLevel); + sb.append(", partnerIncomePer=").append(partnerIncomePer); sb.append(", status=").append(status); sb.append(", createTime=").append(createTime); sb.append(", updateTime=").append(updateTime); diff --git a/service/src/main/java/com/hfkj/entity/BsUserExample.java b/service/src/main/java/com/hfkj/entity/BsUserExample.java index 43d5a69..f305789 100644 --- a/service/src/main/java/com/hfkj/entity/BsUserExample.java +++ b/service/src/main/java/com/hfkj/entity/BsUserExample.java @@ -1,5 +1,6 @@ package com.hfkj.entity; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -645,6 +646,126 @@ public class BsUserExample { return (Criteria) this; } + public Criteria andPartnerLevelIsNull() { + addCriterion("partner_level is null"); + return (Criteria) this; + } + + public Criteria andPartnerLevelIsNotNull() { + addCriterion("partner_level is not null"); + return (Criteria) this; + } + + public Criteria andPartnerLevelEqualTo(Integer value) { + addCriterion("partner_level =", value, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelNotEqualTo(Integer value) { + addCriterion("partner_level <>", value, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelGreaterThan(Integer value) { + addCriterion("partner_level >", value, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelGreaterThanOrEqualTo(Integer value) { + addCriterion("partner_level >=", value, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelLessThan(Integer value) { + addCriterion("partner_level <", value, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelLessThanOrEqualTo(Integer value) { + addCriterion("partner_level <=", value, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelIn(List values) { + addCriterion("partner_level in", values, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelNotIn(List values) { + addCriterion("partner_level not in", values, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelBetween(Integer value1, Integer value2) { + addCriterion("partner_level between", value1, value2, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelNotBetween(Integer value1, Integer value2) { + addCriterion("partner_level not between", value1, value2, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerIsNull() { + addCriterion("partner_income_per is null"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerIsNotNull() { + addCriterion("partner_income_per is not null"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerEqualTo(BigDecimal value) { + addCriterion("partner_income_per =", value, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerNotEqualTo(BigDecimal value) { + addCriterion("partner_income_per <>", value, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerGreaterThan(BigDecimal value) { + addCriterion("partner_income_per >", value, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("partner_income_per >=", value, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerLessThan(BigDecimal value) { + addCriterion("partner_income_per <", value, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerLessThanOrEqualTo(BigDecimal value) { + addCriterion("partner_income_per <=", value, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerIn(List values) { + addCriterion("partner_income_per in", values, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerNotIn(List values) { + addCriterion("partner_income_per not in", values, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("partner_income_per between", value1, value2, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("partner_income_per not between", value1, value2, "partnerIncomePer"); + return (Criteria) this; + } + public Criteria andStatusIsNull() { addCriterion("`status` is null"); return (Criteria) this;