diff --git a/xdclass-coupon-service/src/main/java/net/jieyuu/config/InterceptorConfig.java b/xdclass-coupon-service/src/main/java/net/jieyuu/config/InterceptorConfig.java index 325e5dd..87a45a6 100644 --- a/xdclass-coupon-service/src/main/java/net/jieyuu/config/InterceptorConfig.java +++ b/xdclass-coupon-service/src/main/java/net/jieyuu/config/InterceptorConfig.java @@ -18,7 +18,7 @@ public class InterceptorConfig implements WebMvcConfigurer { //拦截的路径 .addPathPatterns("/api/coupon/*/**","/api/coupon_record/v1/*/**") //放行的路径 - .excludePathPatterns("/api/coupon/*/page_coupon"); + .excludePathPatterns("/api/coupon/*/page_coupon","/api/coupon/*/initNewUserCoupon"); WebMvcConfigurer.super.addInterceptors(registry); } diff --git a/xdclass-coupon-service/src/main/java/net/jieyuu/controller/CouponController.java b/xdclass-coupon-service/src/main/java/net/jieyuu/controller/CouponController.java index 3c58a57..2731cbf 100644 --- a/xdclass-coupon-service/src/main/java/net/jieyuu/controller/CouponController.java +++ b/xdclass-coupon-service/src/main/java/net/jieyuu/controller/CouponController.java @@ -4,6 +4,7 @@ package net.jieyuu.controller; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import net.jieyuu.enums.CouponCategoryEnum; +import net.jieyuu.request.NewUserRequest; import net.jieyuu.service.CouponService; import net.jieyuu.utils.JsonData; import org.springframework.beans.factory.annotation.Autowired; @@ -39,16 +40,23 @@ public class CouponController { } - @ApiOperation("领取优惠券") @GetMapping("add/promotion/{coupon_id}") public JsonData addPromotionCoupon( - @ApiParam(value = "优惠券id",required = true) - @PathVariable("coupon_id")long couponId) { + @ApiParam(value = "优惠券id", required = true) + @PathVariable("coupon_id") long couponId) { JsonData jsonData = couponService.addCoupon(couponId, CouponCategoryEnum.PROMOTION); return jsonData; } + @ApiOperation("拉新发放优惠券") + @PostMapping("new_user_coupon") + public JsonData addNewUserCoupon(@ApiParam("用户对象") @RequestBody NewUserRequest newUserRequest) { + JsonData jsonData = couponService.initNewUserCoupon(newUserRequest); + return jsonData; + + } + } diff --git a/xdclass-coupon-service/src/main/java/net/jieyuu/request/NewUserRequest.java b/xdclass-coupon-service/src/main/java/net/jieyuu/request/NewUserRequest.java new file mode 100644 index 0000000..7071393 --- /dev/null +++ b/xdclass-coupon-service/src/main/java/net/jieyuu/request/NewUserRequest.java @@ -0,0 +1,21 @@ +package net.jieyuu.request; + + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@ApiModel +@Data +public class NewUserRequest { + + @ApiModelProperty(value = "新用户注册id", example = "19") + @JsonProperty("user_id") + private long userId; + + @ApiModelProperty(value = "名称", example = "jieyuu") + @JsonProperty("name") + private String name; + +} diff --git a/xdclass-coupon-service/src/main/java/net/jieyuu/service/CouponService.java b/xdclass-coupon-service/src/main/java/net/jieyuu/service/CouponService.java index 3a0ac07..835dfea 100644 --- a/xdclass-coupon-service/src/main/java/net/jieyuu/service/CouponService.java +++ b/xdclass-coupon-service/src/main/java/net/jieyuu/service/CouponService.java @@ -2,6 +2,7 @@ package net.jieyuu.service; import net.jieyuu.enums.CouponCategoryEnum; +import net.jieyuu.request.NewUserRequest; import net.jieyuu.utils.JsonData; import java.util.Map; @@ -31,4 +32,11 @@ public interface CouponService { * @return */ JsonData addCoupon(long couponId, CouponCategoryEnum couponCategoryEnum); + + /** + * 新用户注册发放优惠券 + * @param newUserRequest + * @return + */ + JsonData initNewUserCoupon(NewUserRequest newUserRequest); } diff --git a/xdclass-coupon-service/src/main/java/net/jieyuu/service/impl/CouponServiceImpl.java b/xdclass-coupon-service/src/main/java/net/jieyuu/service/impl/CouponServiceImpl.java index 2e2a764..85c0aa4 100644 --- a/xdclass-coupon-service/src/main/java/net/jieyuu/service/impl/CouponServiceImpl.java +++ b/xdclass-coupon-service/src/main/java/net/jieyuu/service/impl/CouponServiceImpl.java @@ -15,6 +15,7 @@ import net.jieyuu.model.CouponDO; import net.jieyuu.mapper.CouponMapper; import net.jieyuu.model.CouponRecordDO; import net.jieyuu.model.LoginUser; +import net.jieyuu.request.NewUserRequest; import net.jieyuu.service.CouponService; import net.jieyuu.utils.CommonUtil; import net.jieyuu.utils.JsonData; @@ -26,8 +27,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; + import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -128,6 +131,34 @@ public class CouponServiceImpl implements CouponService { return JsonData.buildSuccess(); } + /** + * 微服务调用时没登录,没有token + *

+ * 本地发放优惠券,需要构造token存入threadlocal + * + * @param newUserRequest + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) + public JsonData initNewUserCoupon(NewUserRequest newUserRequest) { + LoginUser loginUser = new LoginUser(); + loginUser.setName(newUserRequest.getName()); + loginUser.setId(newUserRequest.getUserId()); + // 发放优惠券接口需要threadlocal + LoginInterceptor.threadLocal.set(loginUser); + + List couponList = couponMapper.selectList(new QueryWrapper() + .eq("category", CouponCategoryEnum.NEW_USER.name())); + for (CouponDO couponDO : couponList) { + // 幂等操作 调用需要加锁 + // 发放 + this.addCoupon(couponDO.getId(), CouponCategoryEnum.NEW_USER); + } + return JsonData.buildSuccess(); + } + + /** * 校验优惠券是否可以领取 * diff --git a/xdclass-coupon-service/src/test/java/net/jieyuu/db/MyBatisPlusGenerator.java b/xdclass-coupon-service/src/test/java/net/jieyuu/db/MyBatisPlusGenerator.java index 0d29d61..3290ba5 100644 --- a/xdclass-coupon-service/src/test/java/net/jieyuu/db/MyBatisPlusGenerator.java +++ b/xdclass-coupon-service/src/test/java/net/jieyuu/db/MyBatisPlusGenerator.java @@ -48,7 +48,6 @@ public class MyBatisPlusGenerator { // 设置数据库类型 dsConfig.setDbType(DbType.MYSQL) .setDriverName("com.mysql.cj.jdbc.Driver") - //TODO TODO TODO TODO .setUrl("jdbc:mysql://134.175.219.253:3306/xdclass_coupon?useSSL=false") .setUsername("root") .setPassword("59ae8683c59fead903132a8d440bd7d9fd4936529d1d6f45f9d41111d7537bdd"); diff --git a/xdclass-product-service/pom.xml b/xdclass-product-service/pom.xml index 470ab74..bff81aa 100644 --- a/xdclass-product-service/pom.xml +++ b/xdclass-product-service/pom.xml @@ -11,6 +11,13 @@ xdclass-product-service + + + net.jieyuu + xdclass-common + 1.0-SNAPSHOT + + 8 diff --git a/xdclass-product-service/src/main/java/net/jieyuu/ProductApplication.java b/xdclass-product-service/src/main/java/net/jieyuu/ProductApplication.java new file mode 100644 index 0000000..d47ca5e --- /dev/null +++ b/xdclass-product-service/src/main/java/net/jieyuu/ProductApplication.java @@ -0,0 +1,15 @@ +package net.jieyuu; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringBootApplication +@EnableTransactionManagement +@MapperScan("net.jieyuu.mapper") +public class ProductApplication { + public static void main(String[] args) { + SpringApplication.run(ProductApplication.class, args); + } +} diff --git a/xdclass-product-service/src/main/java/net/jieyuu/controller/BannerController.java b/xdclass-product-service/src/main/java/net/jieyuu/controller/BannerController.java new file mode 100644 index 0000000..e07de82 --- /dev/null +++ b/xdclass-product-service/src/main/java/net/jieyuu/controller/BannerController.java @@ -0,0 +1,38 @@ +package net.jieyuu.controller; + + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import net.jieyuu.service.BannerService; +import net.jieyuu.utils.JsonData; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 前端控制器 + *

+ * + * @author jieyuu + * @since 2024-08-07 + */ + +@Api("轮播图模块") +@RestController +@RequestMapping("/api/banner/v1") +public class BannerController { + + @Autowired + private BannerService bannerService; + + @ApiOperation("轮播图列表接口") + @GetMapping("list") + public JsonData list() { + return JsonData.buildSuccess(bannerService.list()); + } + +} + diff --git a/xdclass-product-service/src/main/java/net/jieyuu/controller/ProductController.java b/xdclass-product-service/src/main/java/net/jieyuu/controller/ProductController.java new file mode 100644 index 0000000..7e8a342 --- /dev/null +++ b/xdclass-product-service/src/main/java/net/jieyuu/controller/ProductController.java @@ -0,0 +1,21 @@ +package net.jieyuu.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 前端控制器 + *

+ * + * @author jieyuu + * @since 2024-08-07 + */ +@RestController +@RequestMapping("/productDO") +public class ProductController { + +} + diff --git a/xdclass-product-service/src/main/java/net/jieyuu/mapper/BannerMapper.java b/xdclass-product-service/src/main/java/net/jieyuu/mapper/BannerMapper.java new file mode 100644 index 0000000..95eb29f --- /dev/null +++ b/xdclass-product-service/src/main/java/net/jieyuu/mapper/BannerMapper.java @@ -0,0 +1,16 @@ +package net.jieyuu.mapper; + +import net.jieyuu.model.BannerDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jieyuu + * @since 2024-08-07 + */ +public interface BannerMapper extends BaseMapper { + +} diff --git a/xdclass-product-service/src/main/java/net/jieyuu/mapper/ProductMapper.java b/xdclass-product-service/src/main/java/net/jieyuu/mapper/ProductMapper.java new file mode 100644 index 0000000..bdfa33a --- /dev/null +++ b/xdclass-product-service/src/main/java/net/jieyuu/mapper/ProductMapper.java @@ -0,0 +1,16 @@ +package net.jieyuu.mapper; + +import net.jieyuu.model.ProductDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jieyuu + * @since 2024-08-07 + */ +public interface ProductMapper extends BaseMapper { + +} diff --git a/xdclass-product-service/src/main/java/net/jieyuu/model/BannerDO.java b/xdclass-product-service/src/main/java/net/jieyuu/model/BannerDO.java new file mode 100644 index 0000000..2847362 --- /dev/null +++ b/xdclass-product-service/src/main/java/net/jieyuu/model/BannerDO.java @@ -0,0 +1,44 @@ +package net.jieyuu.model; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * + *

+ * + * @author jieyuu + * @since 2024-08-07 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("banner") +public class BannerDO implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 图片 + */ + private String img; + + /** + * 跳转地址 + */ + private String url; + + /** + * 权重 + */ + private Integer weight; + + +} diff --git a/xdclass-product-service/src/main/java/net/jieyuu/model/ProductDO.java b/xdclass-product-service/src/main/java/net/jieyuu/model/ProductDO.java new file mode 100644 index 0000000..98a9982 --- /dev/null +++ b/xdclass-product-service/src/main/java/net/jieyuu/model/ProductDO.java @@ -0,0 +1,71 @@ +package net.jieyuu.model; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * + *

+ * + * @author jieyuu + * @since 2024-08-07 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("product") +public class ProductDO implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 标题 + */ + private String title; + + /** + * 封面图 + */ + private String coverImg; + + /** + * 详情 + */ + private String detail; + + /** + * 老价格 + */ + private BigDecimal oldPrice; + + /** + * 新价格 + */ + private BigDecimal price; + + /** + * 库存 + */ + private Integer stock; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 锁定库存 + */ + private Integer lockStock; + + +} diff --git a/xdclass-product-service/src/main/java/net/jieyuu/service/BannerService.java b/xdclass-product-service/src/main/java/net/jieyuu/service/BannerService.java new file mode 100644 index 0000000..9f67b3b --- /dev/null +++ b/xdclass-product-service/src/main/java/net/jieyuu/service/BannerService.java @@ -0,0 +1,21 @@ +package net.jieyuu.service; + +import net.jieyuu.model.BannerDO; +import com.baomidou.mybatisplus.extension.service.IService; +import net.jieyuu.vo.BannerVO; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author jieyuu + * @since 2024-08-07 + */ +public interface BannerService { + List list(); + + +} diff --git a/xdclass-product-service/src/main/java/net/jieyuu/service/ProductService.java b/xdclass-product-service/src/main/java/net/jieyuu/service/ProductService.java new file mode 100644 index 0000000..5719ad5 --- /dev/null +++ b/xdclass-product-service/src/main/java/net/jieyuu/service/ProductService.java @@ -0,0 +1,16 @@ +package net.jieyuu.service; + +import net.jieyuu.model.ProductDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author jieyuu + * @since 2024-08-07 + */ +public interface ProductService extends IService { + +} diff --git a/xdclass-product-service/src/main/java/net/jieyuu/service/impl/BannerServiceImpl.java b/xdclass-product-service/src/main/java/net/jieyuu/service/impl/BannerServiceImpl.java new file mode 100644 index 0000000..89f0408 --- /dev/null +++ b/xdclass-product-service/src/main/java/net/jieyuu/service/impl/BannerServiceImpl.java @@ -0,0 +1,43 @@ +package net.jieyuu.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import net.jieyuu.model.BannerDO; +import net.jieyuu.mapper.BannerMapper; +import net.jieyuu.service.BannerService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import net.jieyuu.vo.BannerVO; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author jieyuu + * @since 2024-08-07 + */ +@Service +public class BannerServiceImpl implements BannerService { + + @Autowired + private BannerMapper bannerMapper; + + @Override + public List list() { + List bannerDOList = bannerMapper.selectList(new QueryWrapper().orderByAsc("weight")); + + List bannerVOList = bannerDOList.stream().map(obj -> { + BannerVO bannerVO = new BannerVO(); + BeanUtils.copyProperties(obj, bannerVO); + return bannerVO; + }).collect(Collectors.toList()); + + return bannerVOList; + } + +} diff --git a/xdclass-product-service/src/main/java/net/jieyuu/service/impl/ProductServiceImpl.java b/xdclass-product-service/src/main/java/net/jieyuu/service/impl/ProductServiceImpl.java new file mode 100644 index 0000000..ba8a14b --- /dev/null +++ b/xdclass-product-service/src/main/java/net/jieyuu/service/impl/ProductServiceImpl.java @@ -0,0 +1,20 @@ +package net.jieyuu.service.impl; + +import net.jieyuu.model.ProductDO; +import net.jieyuu.mapper.ProductMapper; +import net.jieyuu.service.ProductService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author jieyuu + * @since 2024-08-07 + */ +@Service +public class ProductServiceImpl extends ServiceImpl implements ProductService { + +} diff --git a/xdclass-product-service/src/main/java/net/jieyuu/vo/BannerVO.java b/xdclass-product-service/src/main/java/net/jieyuu/vo/BannerVO.java new file mode 100644 index 0000000..a42d3a2 --- /dev/null +++ b/xdclass-product-service/src/main/java/net/jieyuu/vo/BannerVO.java @@ -0,0 +1,26 @@ +package net.jieyuu.vo; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class BannerVO { + + private Integer id; + + /** + * 图片 + */ + private String img; + + /** + * 跳转地址 + */ + private String url; + + /** + * 权重 + */ + private Integer weight; +} \ No newline at end of file diff --git a/xdclass-product-service/src/main/resources/application.yml b/xdclass-product-service/src/main/resources/application.yml new file mode 100644 index 0000000..c103ee2 --- /dev/null +++ b/xdclass-product-service/src/main/resources/application.yml @@ -0,0 +1,29 @@ +server: + port: 9003 + +spring: + application: + name: xdclass_product-service + + #数据库配置 + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://134.175.219.253:3306/xdclass_product?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai + username: root + password: 59ae8683c59fead903132a8d440bd7d9fd4936529d1d6f45f9d41111d7537bdd + redis: + host: 134.175.219.253 + password: 123456 + port: 8000 + +#配置plus打印sql日志 +mybatis-plus: + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + +#设置日志级别,ERROR/WARN/INFO/DEBUG,默认是INFO以上才显示 +logging: + level: + root: INFO + + diff --git a/xdclass-product-service/src/main/resources/mapper/BannerMapper.xml b/xdclass-product-service/src/main/resources/mapper/BannerMapper.xml new file mode 100644 index 0000000..e530d29 --- /dev/null +++ b/xdclass-product-service/src/main/resources/mapper/BannerMapper.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + id, img, url, weight + + + diff --git a/xdclass-product-service/src/main/resources/mapper/ProductMapper.xml b/xdclass-product-service/src/main/resources/mapper/ProductMapper.xml new file mode 100644 index 0000000..10dc521 --- /dev/null +++ b/xdclass-product-service/src/main/resources/mapper/ProductMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + id, title, cover_img, detail, old_price, price, stock, create_time, lock_stock + + + diff --git a/xdclass-product-service/src/test/java/net/jieyuu/db/MyBatisPlusGenerator.java b/xdclass-product-service/src/test/java/net/jieyuu/db/MyBatisPlusGenerator.java new file mode 100644 index 0000000..ae823a0 --- /dev/null +++ b/xdclass-product-service/src/test/java/net/jieyuu/db/MyBatisPlusGenerator.java @@ -0,0 +1,91 @@ +package net.jieyuu.db; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.generator.AutoGenerator; +import com.baomidou.mybatisplus.generator.config.DataSourceConfig; +import com.baomidou.mybatisplus.generator.config.GlobalConfig; +import com.baomidou.mybatisplus.generator.config.PackageConfig; +import com.baomidou.mybatisplus.generator.config.StrategyConfig; +import com.baomidou.mybatisplus.generator.config.rules.DateType; +import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; + +public class MyBatisPlusGenerator { + + public static void main(String[] args) { + //1. 全局配置 + GlobalConfig config = new GlobalConfig(); + + // 作者 + config.setAuthor("jieyuu") + // 生成路径,最好使用绝对路径,window路径是不一样的 + + .setOutputDir("D:\\workspace\\project\\xdclass-shop\\xdclass-shop\\xdclass-product-service\\src\\main\\java") + // 文件覆盖 + .setFileOverride(true) + // 主键策略 + .setIdType(IdType.AUTO) + + .setDateType(DateType.ONLY_DATE) + // 设置生成的service接口的名字的首字母是否为I,默认Service是以I开头的 + .setServiceName("%sService") + + //实体类结尾名称 + .setEntityName("%sDO") + + //生成基本的resultMap + .setBaseResultMap(true) + + //不使用AR模式 + .setActiveRecord(false) + + //生成基本的SQL片段 + .setBaseColumnList(true); + + //2. 数据源配置 + DataSourceConfig dsConfig = new DataSourceConfig(); + // 设置数据库类型 + dsConfig.setDbType(DbType.MYSQL) + .setDriverName("com.mysql.cj.jdbc.Driver") + .setUrl("jdbc:mysql://134.175.219.253:3306/xdclass_product?useSSL=false") + .setUsername("root") + .setPassword("59ae8683c59fead903132a8d440bd7d9fd4936529d1d6f45f9d41111d7537bdd"); + + //3. 策略配置globalConfiguration中 + StrategyConfig stConfig = new StrategyConfig(); + + //全局大写命名 + stConfig.setCapitalMode(true) + // 数据库表映射到实体的命名策略 + .setNaming(NamingStrategy.underline_to_camel) + + //使用lombok + .setEntityLombokModel(true) + + //使用restcontroller注解 + .setRestControllerStyle(true) + + // 生成的表, 支持多表一起生成,以数组形式填写 + .setInclude("banner", "product"); + + //4. 包名策略配置 + PackageConfig pkConfig = new PackageConfig(); + pkConfig.setParent("net.jieyuu") + .setMapper("mapper") + .setService("service") + .setController("controller") + .setEntity("model") + .setXml("mapper"); + + //5. 整合配置 + AutoGenerator ag = new AutoGenerator(); + ag.setGlobalConfig(config) + .setDataSource(dsConfig) + .setStrategy(stConfig) + .setPackageInfo(pkConfig); + + //6. 执行操作 + ag.execute(); + System.out.println("======= 小滴课堂 Done 相关代码生成完毕 ========"); + } +} \ No newline at end of file diff --git a/xdclass-user-service/src/test/java/net/jieyuu/db/MyBatisPlusGenerator.java b/xdclass-user-service/src/test/java/net/jieyuu/db/MyBatisPlusGenerator.java index 353f324..112de78 100644 --- a/xdclass-user-service/src/test/java/net/jieyuu/db/MyBatisPlusGenerator.java +++ b/xdclass-user-service/src/test/java/net/jieyuu/db/MyBatisPlusGenerator.java @@ -20,7 +20,6 @@ public class MyBatisPlusGenerator { // 作者 .setAuthor("jieyuu") // 生成路径,最好使用绝对路径,window路径是不一样的 - //TODO TODO TODO TODO .setOutputDir("D:\\workspace\\project\\xdclass-shop\\xdclass-shop\\xdclass-user-service\\src\\main\\java") // 文件覆盖 .setFileOverride(true) @@ -48,7 +47,6 @@ public class MyBatisPlusGenerator { // 设置数据库类型 dsConfig.setDbType(DbType.MYSQL) .setDriverName("com.mysql.cj.jdbc.Driver") - //TODO TODO TODO TODO .setUrl("jdbc:mysql://134.175.219.253:3306/xdclass_user?useSSL=false") .setUsername("root") .setPassword("59ae8683c59fead903132a8d440bd7d9fd4936529d1d6f45f9d41111d7537bdd"); @@ -68,7 +66,6 @@ public class MyBatisPlusGenerator { .setRestControllerStyle(true) // 生成的表, 支持多表一起生成,以数组形式填写 - //TODO TODO TODO TODO .setInclude("user","address"); //4. 包名策略配置