一 点睛
通过人人开源快速生成基本的前后端代码,以满足基本的增删改查,然后根据实际业务,去修改前面生成的基本代码,以满足实际业务需求。
二 依赖表的结构
/*表: pms_brand*/------------------
/*列信息*/-----------
Field Type Collation Null Key Default Extra Privileges Comment
------------ ------------- ------------------ ------ ------ ------- -------------- ------------------------------- --------------------------------------
brand_id bigint(20) (NULL) NO PRI (NULL) auto_increment select,insert,update,references 品牌id
name char(50) utf8mb4_general_ci YES (NULL) select,insert,update,references 品牌名
logo varchar(2000) utf8mb4_general_ci YES (NULL) select,insert,update,references 品牌logo地址
descript longtext utf8mb4_general_ci YES (NULL) select,insert,update,references 介绍
show_status tinyint(4) (NULL) YES (NULL) select,insert,update,references 显示状态[0-不显示;1-显示]
first_letter char(1) utf8mb4_general_ci YES (NULL) select,insert,update,references 检索首字母
sort int(11) (NULL) YES (NULL) select,insert,update,references 排序
/*索引信息*/--------------
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
--------- ---------- -------- ------------ ----------- --------- ----------- -------- ------ ------ ---------- ------- ---------------
pms_brand 0 PRIMARY 1 brand_id A 0 (NULL) (NULL) BTREE
/*DDL 信息*/------------
CREATE TABLE `pms_brand` (
`brand_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '品牌id',
`name` char(50) DEFAULT NULL COMMENT '品牌名',
`logo` varchar(2000) DEFAULT NULL COMMENT '品牌logo地址',
`descript` longtext COMMENT '介绍',
`show_status` tinyint(4) DEFAULT NULL COMMENT '显示状态[0-不显示;1-显示]',
`first_letter` char(1) DEFAULT NULL COMMENT '检索首字母',
`sort` int(11) DEFAULT NULL COMMENT '排序',
PRIMARY KEY (`brand_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='品牌'
三 人人开源相关配置
1 application.yml
server:
port: 80
# mysql
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
#MySQL配置
driverClassName: com.mysql.jdbc.Driver
# 修改数据库的URL
url: jdbc:mysql://192.168.0.110:3306/gulimall_pms?useUnicode=true&characterEncoding=UTF-8&useSSL=false
# 修改数据库的用户名
username: root
# 修改数据库的密码
password: root
#oracle配置
# driverClassName: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@47.100.206.162:1521:xe
# username: renren
# password: 123456
#SQLServer配置
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://192.168.10.10:1433;DatabaseName=renren_fast
# username: sa
# password: 123456
#PostgreSQL配置
# driverClassName: org.postgresql.Driver
# url: jdbc:postgresql://192.168.10.10:5432/renren_fast
# username: postgres
# password: 123456
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
resources:
static-locations: classpath:/static/,classpath:/views/
mybatis:
mapperLocations: classpath:mapper/**/*.xml
pagehelper:
reasonable: true
supportMethodsArguments: true
params: count=countSql
#指定数据库,可选值有【mysql、oracle、sqlserver、postgresql】
renren:
database: mysql
2 generator.properties
# 代码生成器,配置信息
# 主目录格式: com + 组织名
mainPath=com.atguigu
# 包名格式: com + 组织名 + 项目名
package=com.atguigu.gulimall
# 模块名
moduleName=product
# 作者
author=cakin
# Email
email=798103175@qq.com
# 表前缀:类名不会包含表前缀
tablePrefix=pms_
# 类型转换的配置信息,这部分内容固定
tinyint=Integer
smallint=Integer
mediumint=Integer
int=Integer
integer