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] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=94=A8=E6=88=B7=E7=AD=89?= =?UTF-8?q?=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); + } +}