GeneratorSqlmap是mybatis逆向工程的main入口,能让你减少写sql的好帮手
mail发送邮件
RandomString随机字符串用来做验证码的
4.0.0
com
marketManage
war
0.0.1-SNAPSHOT
marketManage Maven Webapp
http://maven.apache.org
com.alibaba
fastjson
1.2.62
org.springframework
spring-webmvc
4.1.3.RELEASE
org.springframework
spring-core
4.1.3.RELEASE
org.springframework
spring-web
4.1.3.RELEASE
org.springframework
spring-oxm
4.1.3.RELEASE
org.springframework
spring-tx
4.1.3.RELEASE
org.springframework
spring-jdbc
4.1.3.RELEASE
org.springframework
spring-aop
4.1.3.RELEASE
org.springframework
spring-context-support
4.1.3.RELEASE
org.springframework
spring-test
4.1.3.RELEASE
org.mybatis
mybatis-spring
1.3.1
org.mybatis
mybatis
3.2.8
org.springframework
spring-jdbc
4.1.3.RELEASE
mysql
mysql-connector-java
5.1.48
org.mybatis.generator
mybatis-generator-core
1.3.7
com.fasterxml.jackson.core
jackson-databind
2.9.10.1
com.fasterxml.jackson.core
jackson-core
2.9.10
com.fasterxml.jackson.core
jackson-annotations
2.9.10
javax.mail
mail
1.4
org.apache.maven.plugins
maven-compiler-plugin
2.3.2
1.7
这博客编辑器真的是有问题,复制大段代码的时候时不时抽筋,害的我一行行复制的。这件事得记在小本本上,【滑稽】。
create database marketManager;
#管理员表
CREATE TABLE `marketmanager`.`managers` (
`mId` INT NOT NULL AUTO_INCREMENT,
`pass` VARCHAR(45) NOT NULL,
`mName` VARCHAR(45) NULL,
`mEmail` VARCHAR(45) NULL,
`mSex` VARCHAR(45) NULL,
`mPhone` VARCHAR(45) NULL,
PRIMARY KEY (`mId`));
##雇员表
CREATE TABLE `marketmanager`.`employeer` (
`eId` INT NOT NULL AUTO_INCREMENT,
`eName` VARCHAR(45) NULL,
`epass` VARCHAR(45) NULL,
`eSex` VARCHAR(45) NULL,
`eEmail` VARCHAR(45) NULL,
`ePhone` VARCHAR(45) NULL,
PRIMARY KEY (`eId`));
##会员表
CREATE TABLE `marketmanager`.`user`(
`uId` INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(`uId`),
`uName` VARCHAR(45) NULL,
`upass` VARCHAR(45) NULL,
`uRegister` Date
);
##仓库管理员
CREATE TABLE `marketmanager`.`store` (
`stoId` INT NOT NULL AUTO_INCREMENT,
`pass` VARCHAR(45) NOT NULL,
`stoName` VARCHAR(45) NULL,
`stoEmail` VARCHAR(45) NULL,
`stotSex` VARCHAR(45) NULL,
`stoPhone` VARCHAR(45) NULL,
PRIMARY KEY (`stoId`));
##商品表
CREATE TABLE `marketmanager`.`goods` (
`gId` INT NOT NULL AUTO_INCREMENT,
primary key(`gId`),
`gName` VARCHAR(45) NULL,
`gType` VARCHAR(45) NULL
);
##销售表
create table `marketmanager`.`transaction`(
`tId` INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(`tId`),
`gId` INT,
`eId` INT,
`buyDay` date,
`num` int,
`price` double
);
##供货商表
create table `marketmanager`.`supplier`(
`sId` INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(`sId`),
`sName` VARCHAR(45) NULL,
`sAddress` VARCHAR(45) NULL,
`sPhone` VARCHAR(45) NULL
);
##进货表
create table `marketmanager`.`stock`(
`stId` INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(`stId`),
`gId` INT,
`sId` INT,
`num` int
);
##插入managers表
insert into managers(mId,pass,mName,mEmail,mSex,mPhone) values(1,'123','lst','[email protected]','男','18917183336');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf','[email protected]','男','10001');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf01','[email protected]','男','10001');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf2','[email protected]','男','10001');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf3','[email protected]','男','10001');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf4','[email protected]','男','10001');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf5','[email protected]','男','10001');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf6','[email protected]','男','10001');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf7','[email protected]','男','10001');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf8','[email protected]','男','10001');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf9','[email protected]','男','10001');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf11','[email protected]','男','10001');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf12','[email protected]','男','10001');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf13','[email protected]','男','10001');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf14','[email protected]','男','10001');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf15','[email protected]','男','10001');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('123','lhf','[email protected]','女','13992236542');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('456','wzl','[email protected]','男','13554266875');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('789','wlv','[email protected]','女','13120512264');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('147','lyx','[email protected]','女','18795826548');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('258','ztt','[email protected]','女','15098403502');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('369','zy','[email protected]','男','13352644859');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('951','wyw','[email protected]','女','18749992635');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('753','hdx','[email protected]','男','18993336528');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('157','cyr','[email protected]','男','15996235426');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('359','znx','[email protected]','男','15230500264');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('759','zwy','[email protected]','女','15236442582');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('957','htl','[email protected]','男','12365215251');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('153','xyy','[email protected]','女','18995624523');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('351','els','[email protected]','女','18336524152');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('681','fxq','[email protected]','男','13552648726');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('sjx','龙傲天','[email protected]','女','18993332541');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('sal','美羊羊','[email protected]','女','18745026523');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('xla','红太狼','[email protected]','女','14523679999');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('xal','纪晓岚','[email protected]','男','18888888888');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('ihy','诸葛亮','[email protected]','男','13993321547');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('loy','皇太后','[email protected]','女','13998245426');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('otg','杀马特','[email protected]','男','18332697458');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('inl','陆涛韬','[email protected]','男','19332687458');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('ccl','张雅雅','[email protected]','女','15268999426');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('och','余杭逍','[email protected]','男','18332452215');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('qiy','派大星','[email protected]','男','1523652415');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('dhc','小程序','[email protected]','男','15236254128');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('dlc','宁荣荣','[email protected]','女','19332826485');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('tyd','黄晓明','[email protected]','男','18221542673');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('sot','曹郁睿','[email protected]','女','18993326425');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('sax521','阿萨姆','[email protected]','男','12365241526');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('xki541','冰红茶','[email protected]','男','13926412521');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('wcg624','苦力怕','[email protected]','女','13526412582');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('swb129','手残党','[email protected]','男','18546924521');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('krv54','可可粉','[email protected]','女','19644215215');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('wog597','蔡徐坤','[email protected]','女','19562340512');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('ogj524','甘家堡','[email protected]','女','15423625412');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('ojv452','不带你','[email protected]','男','13252415264');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('csa364','哦测试','[email protected]','男','13526425552');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('wol652','古墓丽影','[email protected]','女','19888542625');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('cso954','刺客信条','[email protected]','男','18632542521');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('kyv152','阿里巴巴','[email protected]','男','13665421524');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('our215','含辛茹苦','[email protected]','男','18996526325');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('dlo957','苦不堪言','[email protected]','女','18232521452');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('lkb963','言出必行','[email protected]','男','13526245214');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('bsm328','行为举止','[email protected]','男','19854252362');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('vfu957','指鹿为马','[email protected]','女','12365241528');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('vjr652','马到成功','[email protected]','女','18542635214');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('vfo652','功成名就','[email protected]','女','175425125236');
insert into managers(pass,mName,mEmail,mSex,mPhone) values('eyc518','就事论事','zhongyuwanle163.com','男','12652345216');
##插入employeer表
repair table employeer;
insert into employeer(eId,eName,epass,eSex,eEmail,ePhone)values(1,'ccc','1234','男','[email protected]','18917183336');
insert into employeer(eName,epass,eSex,eEmail,ePhone)values('wyh','1234','男','[email protected]','13214303');
##插入store
insert into store(stoId,pass,stoName,stoEmail,stotSex,stoPhone)values(1,'1111','jry','[email protected]','男',18917183336);
insert into store(pass,stoName,stoEmail,stotSex,stoPhone)values('1111','yjq','[email protected]','男',18917183336);
##插入goods表
insert into goods(gId,gType,gName) values(1,'书籍','钢铁是怎么炼成的?');
insert into goods(gType,gName) values('电子产品','电脑');
##插入supplier表
insert into supplier(sId,sName,sAddress,sPhone) values(1,'神州电脑有限公司','随便写路123号','18917183336');
insert into supplier(sName,sAddress,sPhone) values('台湾华硕电脑有限公司','随便写路124号','100011000');
##插入stock表
insert into stock(stId,gid,sId,num) values(1,2,1,123);
insert into stock(gid,sId,num) values(2,2,123);
在本系统中实际只使用了employeer,store,managers,其他的没时间写了,反正功能实现,其他的就是复制改名字
driverClass=com.mysql.jdbc.Driver
jdbcUrl=jdbc:mysql://localhost:3306/marketManager?characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
user=root
password=root
如果你是mysql8.0以上
driverclass改成com.mysql.cj.jdbc.Driver
package com.market.test;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.exception.XMLParserException;
import org.mybatis.generator.internal.DefaultShellCallback;
public class GeneratorSqlmap {
public void generator() throws Exception{
List<String> warnings = new ArrayList<String>();
boolean overwrite = true;
//指定 逆向工程配置文件
File configFile = new File("generatorConfig.xml");
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(configFile);
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config,
callback, warnings);
myBatisGenerator.generate(null);
}
// public static void main(String[] args) throws Exception {
// try {
// GeneratorSqlmap generatorSqlmap = new GeneratorSqlmap();
// generatorSqlmap.generator();
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// }
}
用的时候把注释去了,网站写完了可以把逆向工程删了
好了数据模块解决了
整合的看那个王雪亮博客,不想复制黏贴代码了,一行行太繁了。
接下来请看我的下一个博客