【B2C-爱购物商城】 开发文档 day04

版权声明:★Study hard and make progress every day.☺★ https://blog.csdn.net/qq_38225558/article/details/86415669

一、商品模块数据库&代码工具准备

1.数据库准备:

2.中导入工具类:

二、商品品牌 - 后端实现

1.集成模板生成代码 - 配置query和controller - 具体可看项目源码

// 调整 query 生成目录演示
focList.add(new FileOutConfig("/templates/query.java.vm") {
    @Override
    public String outputFile(TableInfo tableInfo) {
        return rb.getString("OutputDirBase")+ "/com/zhengqing/aigou/query/" + tableInfo.getEntityName() + "Query.java";
    }
});
cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg);

//controller配置
focList.add(new FileOutConfig("/templates/controller.java.vm") {
    @Override
    public String outputFile(TableInfo tableInfo) {
        return rb.getString("OutputDir")+ "/com/zhengqing/aigou/controller/" + tableInfo.getEntityName() + "Controller.java";
    }
});
cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg);

2. 中加入util依赖

<dependency>
    <groupId>com.zhengqing</groupId>
    <artifactId>basic_util</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

3.运行代码生成器: 

生成3张表  --> 

4.完善业务代码...

5.启动测试:

http://127.0.0.1:7001/

①swagger测试

自己:http://127.0.0.1:8002/swagger-ui.html

网关:http://127.0.0.1:9527/swagger-ui.html

如果如下启动报错:

重启网关  - 访问成功!

②postman测试增删改查+高级查询

注:save中有id是修改,无id是保存数据!!

         --> 执行效果图:

二、商品品牌 - 前端实现表格数据

代码部分略...


源码和文档:https://pan.baidu.com/s/1RC8ceNFzSwFbGEg6Vt0_fg

猜你喜欢

转载自blog.csdn.net/qq_38225558/article/details/86415669