├── .gitignore ├── .travis.yml ├── README.md ├── generate_web.db ├── img ├── dbList.png ├── demo.png ├── tbList.png └── template_manage.png ├── mybatis-generator-web-biz ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── github │ │ └── mustfun │ │ └── generator │ │ └── biz │ │ ├── BootLauncher.java │ │ ├── config │ │ └── InitDataBase.java │ │ ├── facade │ │ ├── CityController.java │ │ └── impl │ │ │ ├── CityControllerImpl.java │ │ │ ├── ExtApiControllerImpl.java │ │ │ └── IndexControllerImpl.java │ │ └── mq │ │ └── MqConfig.java │ └── resources │ ├── static │ ├── css │ │ ├── chartist.min.css │ │ ├── fullcalendar.min.css │ │ ├── img │ │ │ ├── sample-1.jpg │ │ │ ├── sort_asc.png │ │ │ ├── sort_asc_disabled.png │ │ │ ├── sort_both.png │ │ │ ├── sort_desc.png │ │ │ ├── sort_desc_disabled.png │ │ │ └── user-bg.jpg │ │ ├── jquery-jvectormap.css │ │ ├── jquery.dataTables.min.css │ │ ├── jquery.dataTables.min01.css │ │ ├── materialize.css │ │ ├── morris.css │ │ ├── page-center.css │ │ ├── perfect-scrollbar.css │ │ ├── prism.css │ │ ├── style.css │ │ └── xcharts.min.css │ ├── font │ │ ├── Material-Design-Icons │ │ │ ├── Material-Design-Icons.eot │ │ │ └── Material-Design-Icons.ttf │ │ └── roboto │ │ │ ├── Roboto-Bold.ttf │ │ │ ├── Roboto-Light.ttf │ │ │ ├── Roboto-Medium.ttf │ │ │ ├── Roboto-Regular.ttf │ │ │ └── Roboto-Thin.ttf │ ├── img │ │ ├── avatar.jpg │ │ ├── generic-logo.png │ │ ├── login-logo.png │ │ ├── materialize-logo.png │ │ ├── office.jpg │ │ ├── sample-1.jpg │ │ ├── signature-scan.png │ │ ├── style_typography_roboto.png │ │ └── user-bg.jpg │ └── js │ │ ├── chart-script.js │ │ ├── chart.min.js │ │ ├── chartist-script.js │ │ ├── chartist.min.js │ │ ├── chartjs-sample-chart.js │ │ ├── d3.min.js │ │ ├── data-tables-script.js │ │ ├── flot-chart.js │ │ ├── flot-script.js │ │ ├── fullcalendar-script.js │ │ ├── fullcalendar.min.js │ │ ├── jquery-1.11.3.js │ │ ├── jquery-jvectormap-1.2.2.min.js │ │ ├── jquery-jvectormap-world-mill-en.js │ │ ├── jquery-ui.custom.min.js │ │ ├── jquery.dataTables.min.js │ │ ├── jquery.flot.min.js │ │ ├── jquery.flot.pie.js │ │ ├── jquery.flot.stack.js │ │ ├── jquery.flot.time.js │ │ ├── jquery.sparkline.min.js │ │ ├── materialize.js │ │ ├── materialize.min.js │ │ ├── moment.min.js │ │ ├── morris-script.js │ │ ├── morris.min.js │ │ ├── perfect-scrollbar.min.js │ │ ├── plugins.js │ │ ├── prism.js │ │ ├── raphael-min.js │ │ ├── sparkline-script.js │ │ ├── vectormap-script.js │ │ ├── xcharts-script.js │ │ └── xcharts.min.js │ ├── temp │ ├── Bo.java.vm │ ├── Controller.java.vm │ ├── Dao.java.vm │ ├── Dao.xml.vm │ ├── Po.java.vm │ ├── Req.java.vm │ ├── Resp.java.vm │ ├── Result.java.vm │ ├── Service.java.vm │ └── ServiceImpl.java.vm │ └── templates │ ├── app-email.html │ ├── app-widget.html │ ├── changelogs.html │ ├── charts-chartist.html │ ├── charts-chartjs.html │ ├── charts-flotcharts.html │ ├── charts-morris.html │ ├── charts-sparklines.html │ ├── charts-xcharts.html │ ├── common │ ├── footer.html │ ├── header.html │ ├── loading.html │ ├── receource.html │ ├── rightSidebar.html │ ├── scripts.html │ └── sidebar.html │ ├── core │ ├── addTemplate.html │ ├── configList.html │ ├── dbList.html │ ├── index.html │ ├── tableList.html │ ├── templateList.html │ └── ui-modals.html │ ├── css-color.html │ ├── css-grid.html │ ├── css-helpers.html │ ├── css-icons.html │ ├── css-media.html │ ├── css-sass.html │ ├── css-shadow.html │ ├── css-typography.html │ ├── form-elements.html │ ├── form-layouts.html │ ├── index.html │ ├── index01.html │ ├── page-404.html │ ├── page-500.html │ ├── page-blank.html │ ├── page-invoice.html │ ├── page-lock-screen.html │ ├── page-login.html │ ├── page-register.html │ ├── table-basic.html │ ├── table-data.html │ ├── ui-accordions.html │ ├── ui-badges.html │ ├── ui-buttons.html │ ├── ui-cards.html │ ├── ui-collections.html │ ├── ui-media.html │ ├── ui-modals.html │ ├── ui-navbar.html │ ├── ui-pagination.html │ ├── ui-preloader.html │ ├── ui-toasts.html │ └── ui-tooltip.html ├── mybatis-generator-web-business ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── github │ └── mustfun │ └── generator │ └── business │ └── App.java ├── mybatis-generator-web-config ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── github │ │ └── mustfun │ │ └── generator │ │ └── config │ │ └── App.java │ └── resources │ ├── config │ ├── application-dev.yml │ ├── application-pre.yml │ ├── application-prod.yml │ └── application-qa.yml │ ├── ehcache.xml │ ├── generator │ └── generator-config.properties │ ├── import.sql │ ├── logback-test.xml │ ├── logback.xml │ └── mybatis │ ├── generatorConfig.xml │ ├── mybatis-config.xml │ └── spring-mybatis.xml ├── mybatis-generator-web-dao ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── github │ │ └── mustfun │ │ └── generator │ │ └── dao │ │ └── mapper │ │ ├── CityMapper.java │ │ ├── DbSourceMapper.java │ │ ├── OrderMapper.java │ │ └── TemplateMapper.java │ └── resources │ └── mybatis │ └── mapper │ ├── dbSourceMapper.xml │ ├── orderMapper.xml │ └── templateMapper.xml ├── mybatis-generator-web-facade ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── github │ └── mustfun │ └── generator │ └── facade │ └── App.java ├── mybatis-generator-web-model ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── github │ └── mustfun │ └── generator │ └── model │ ├── constants │ └── FileConstants.java │ ├── enums │ ├── DbTypeEnums.java │ └── VmTypeEnums.java │ ├── po │ ├── City.java │ ├── DbConfigPo.java │ ├── DbSourcePo.java │ ├── LocalColumn.java │ ├── LocalTable.java │ ├── Order.java │ └── Template.java │ └── result │ └── Result.java ├── mybatis-generator-web-parent └── pom.xml ├── mybatis-generator-web-service ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── github │ └── mustfun │ └── generator │ └── service │ ├── DbSourceService.java │ ├── ExtApiService.java │ ├── OrderService.java │ ├── TemplateService.java │ └── impl │ ├── DbSourceServiceImpl.java │ ├── ExtApiServiceImpl.java │ ├── GenerateCodeService.java │ ├── OrderServiceImpl.java │ └── TemplateServiceImpl.java ├── mybatis-generator-web-support ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── github │ └── mustfun │ └── generator │ └── support │ ├── config │ ├── AbstractDataSourceConfig.java │ ├── BaseDruidConfig.java │ ├── DruidConfig.java │ ├── DruidOtherConfig.java │ ├── MasterDataSourceConfig.java │ ├── MasterSlaveDataSourceConfig.java │ ├── MybatisConfig.java │ ├── SlaveDataSourceConfig.java │ └── SlaveDruidConfig.java │ ├── handler │ ├── ConnectionHolder.java │ └── SpringContextHolder.java │ ├── result │ └── BaseResult.java │ ├── transcation │ └── TransactionConfig.java │ ├── util │ ├── DateUtils.java │ └── DbUtil.java │ └── web │ └── WebConfig.java ├── mybatis-generator-web-test ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── github │ └── mustfun │ └── generator │ └── test │ ├── DataBaseTools.java │ └── TestDataSource.java └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Java template 3 | # Compiled class file 4 | *.class 5 | 6 | # Log file 7 | *.log 8 | #idea 9 | .idea 10 | *.iml 11 | 12 | # BlueJ files 13 | *.ctxt 14 | 15 | # Mobile Tools for Java (J2ME) 16 | .mtj.tmp/ 17 | 18 | # Package Files # 19 | *.jar 20 | *.war 21 | *.ear 22 | *.zip 23 | *.tar.gz 24 | *.rar 25 | .target 26 | 27 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 28 | hs_err_pid* 29 | 30 | /**/target/ 31 | 32 | # jrebel 33 | rebel.xml 34 | *.bak 35 | 36 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk8 4 | sudo: false 5 | script: 6 | - mvn cobertura:cobertura 7 | - echo '代码覆盖率统计完毕....' 8 | after_success: 9 | - bash <(curl -s https://codecov.io/bash) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 自动代码生成工具 2 | 3 | [](https://travis-ci.org/mustfun/mybatis-generator-web) 4 | [](https://codecov.io/gh/mustfun/warning-control) 5 |  6 | [](https://maven-badges.herokuapp.com/maven-central/com.github.mustfun/warning-control/badge.svg) 7 | [](https://opensource.org/licenses/mit-license.php) 8 | 9 | 10 | ### 1、用处 11 | 一键生成Mybatis Mapper文件、Dao文件,Service , Controller层增删改查代码 12 | ### 2、介绍 13 | 本工具基于模板配置而成,可自定义模板,可以生成自己的Controller/Service/Dao/XML文件,比如您想要在类中自定义一些注解,修改模板即可 14 | ### 3、展示 15 | #### 数据库列表如下图所示: 16 | 17 |  18 | 19 | #### 读取到的表如下: 20 | 21 |  22 | 23 | #### 模板配置如下: 24 | 可随心所欲配置模板,自定义你所需要的代码出来 25 | 26 |  27 | 28 | #### 生成的代码如下: 29 | 30 |  31 | 32 | #### Mapper文件生成教完善 33 | 含有queryListByCondition等常用方法 34 | 35 | ```java 36 | 37 | ``` 38 | 39 | -------------------------------------------------------------------------------- /generate_web.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/generate_web.db -------------------------------------------------------------------------------- /img/dbList.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/img/dbList.png -------------------------------------------------------------------------------- /img/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/img/demo.png -------------------------------------------------------------------------------- /img/tbList.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/img/tbList.png -------------------------------------------------------------------------------- /img/template_manage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/img/template_manage.png -------------------------------------------------------------------------------- /mybatis-generator-web-biz/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | mybatis-generator-web-parent 5 | com.github.mustfun 6 | 1.0.0-SNAPSHOT 7 | ../mybatis-generator-web-parent/pom.xml 8 | 9 | 4.0.0 10 | 11 | mybatis-generator-web-biz 12 | jar 13 | 14 | mybatis-generator-web-biz 15 | http://www.biwan.com 16 | 17 | 18 | com.itar.soa.mybatis-generator-web.BootLauncher 19 | 20 | 21 | 22 | 23 | com.github.mustfun 24 | mybatis-generator-web-business 25 | 1.0.0-SNAPSHOT 26 | 27 | 28 | junit 29 | junit 30 | 31 | 32 | 33 | 34 | 35 | mybatis-generator-web-biz 36 | 37 | 38 | org.springframework.boot 39 | spring-boot-maven-plugin 40 | ${springboot.version} 41 | 42 | 43 | 44 | repackage 45 | 46 | 47 | exec 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/java/com/github/mustfun/generator/biz/BootLauncher.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.biz; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.ComponentScan; 6 | 7 | /** 8 | * @author dengzhiyuan 9 | */ 10 | @SpringBootApplication 11 | @ComponentScan(basePackages = {"com.github.mustfun.generator"}) 12 | public class BootLauncher { 13 | public static void main(String[] args) { 14 | SpringApplication springApplication = new SpringApplication(BootLauncher.class); 15 | springApplication.run(args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/java/com/github/mustfun/generator/biz/config/InitDataBase.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.biz.config; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.github.mustfun.generator.model.constants.FileConstants; 5 | import com.github.mustfun.generator.model.po.DbConfigPo; 6 | import com.github.mustfun.generator.model.po.DbSourcePo; 7 | import com.github.mustfun.generator.service.DbSourceService; 8 | import com.github.mustfun.generator.service.ExtApiService; 9 | import org.apache.commons.io.IOUtils; 10 | import org.slf4j.Logger; 11 | import org.slf4j.LoggerFactory; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Component; 14 | 15 | import javax.annotation.PostConstruct; 16 | import java.io.FileInputStream; 17 | import java.io.IOException; 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | /** 22 | * @author dengzhiyuan 23 | * @version 1.0 24 | * @date 2018/4/16 25 | * @since 1.0 26 | */ 27 | @Component 28 | public class InitDataBase { 29 | 30 | private static final Logger LOG = LoggerFactory.getLogger(InitDataBase.class); 31 | 32 | @Autowired 33 | private ExtApiService extApiService; 34 | 35 | @Autowired 36 | private DbSourceService dbSourceService; 37 | 38 | @PostConstruct 39 | public void initDataBase(){ 40 | List dbSourcePos = dbSourceService.queryList(); 41 | for (DbSourcePo dbSourcePo : dbSourcePos) { 42 | extApiService.initDb(dbSourcePo); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/java/com/github/mustfun/generator/biz/facade/CityController.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.biz.facade; 2 | 3 | import com.github.mustfun.generator.model.po.City; 4 | import com.github.mustfun.generator.support.result.BaseResult; 5 | 6 | /** 7 | * Created by dengzhiyuan on 2017/4/6. 8 | */ 9 | public interface CityController { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/java/com/github/mustfun/generator/biz/facade/impl/CityControllerImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.biz.facade.impl; 2 | 3 | import com.github.mustfun.generator.biz.facade.CityController; 4 | import com.github.mustfun.generator.model.po.City; 5 | import com.github.mustfun.generator.service.DbSourceService; 6 | import com.github.mustfun.generator.support.result.BaseResult; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.http.MediaType; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RequestMethod; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | /** 14 | * @author dengzhiyuan 15 | * @version 1.0 16 | * @date 2017/5/4 17 | * @since 1.0 18 | */ 19 | @RestController 20 | @RequestMapping("/city") 21 | public class CityControllerImpl implements CityController { 22 | 23 | @Autowired 24 | private DbSourceService dbSourceService; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/java/com/github/mustfun/generator/biz/facade/impl/ExtApiControllerImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.biz.facade.impl; 2 | 3 | import com.github.mustfun.generator.model.po.DbConfigPo; 4 | import com.github.mustfun.generator.model.po.DbSourcePo; 5 | import com.github.mustfun.generator.model.po.Template; 6 | import com.github.mustfun.generator.service.ExtApiService; 7 | import com.github.mustfun.generator.support.result.BaseResult; 8 | import org.apache.commons.io.IOUtils; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.http.MediaType; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | import javax.servlet.http.HttpServletResponse; 16 | import java.io.IOException; 17 | import java.util.List; 18 | 19 | /** 20 | * @author dengzhiyuan 21 | * @version 1.0 22 | * @date 2017/5/4 23 | * @since 1.0 24 | */ 25 | @RestController 26 | @RequestMapping("/api") 27 | public class ExtApiControllerImpl { 28 | 29 | private static final Logger LOG = LoggerFactory.getLogger(ExtApiControllerImpl.class); 30 | @Autowired 31 | private ExtApiService extApiService; 32 | 33 | 34 | @RequestMapping(value = "save_db_config",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE) 35 | public BaseResult saveDbConfig(DbSourcePo dbSourcePo) { 36 | return extApiService.saveDbConfig(dbSourcePo); 37 | } 38 | 39 | @RequestMapping(value = "save_template",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE) 40 | public BaseResult saveTemplate(Template dbSourcePo) { 41 | return extApiService.saveTemplate(dbSourcePo); 42 | } 43 | 44 | @RequestMapping(value = "delete_template/{id}",method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_UTF8_VALUE) 45 | public BaseResult deleteTemplate(@PathVariable("id") Integer dbSourcePo) { 46 | return extApiService.deleteTemplate(dbSourcePo); 47 | } 48 | 49 | @RequestMapping(value = "update_template/{id}",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE) 50 | public BaseResult updateTemplate(Template template) { 51 | return extApiService.updateTemplate(template); 52 | } 53 | 54 | 55 | @RequestMapping(value = "generate_code",method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_UTF8_VALUE) 56 | public void generateCode(@RequestParam("tableName") List tableNames,@RequestParam("packageName") String packageName, 57 | @RequestParam("address")String address,@RequestParam("vmList")List vmList, 58 | HttpServletResponse response) { 59 | byte[] data = extApiService.generateCode(tableNames,packageName, address,vmList); 60 | response.reset(); 61 | response.setHeader("Content-Disposition", "attachment; filename=\"generator-web.zip\""); 62 | response.addHeader("Content-Length", "" + data.length); 63 | response.setContentType("application/octet-stream; charset=UTF-8"); 64 | 65 | try { 66 | IOUtils.write(data, response.getOutputStream()); 67 | } catch (IOException e) { 68 | LOG.error("下载代码异常,{}",e); 69 | } 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/java/com/github/mustfun/generator/biz/facade/impl/IndexControllerImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.biz.facade.impl; 2 | 3 | import com.github.mustfun.generator.model.enums.DbTypeEnums; 4 | import com.github.mustfun.generator.model.enums.VmTypeEnums; 5 | import com.github.mustfun.generator.model.po.DbSourcePo; 6 | import com.github.mustfun.generator.model.po.LocalTable; 7 | import com.github.mustfun.generator.model.po.Template; 8 | import com.github.mustfun.generator.service.DbSourceService; 9 | import com.github.mustfun.generator.service.ExtApiService; 10 | import com.github.mustfun.generator.service.TemplateService; 11 | import com.github.mustfun.generator.support.handler.ConnectionHolder; 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.stereotype.Controller; 16 | import org.springframework.ui.Model; 17 | import org.springframework.web.bind.annotation.PathVariable; 18 | import org.springframework.web.bind.annotation.RequestMapping; 19 | import org.springframework.web.bind.annotation.RequestMethod; 20 | import org.springframework.web.bind.annotation.RequestParam; 21 | 22 | import java.sql.Connection; 23 | import java.util.List; 24 | 25 | /** 26 | * @author dengzhiyuan 27 | * @version 1.0 28 | * @date 2017/5/4 29 | * @since 1.0 30 | */ 31 | @Controller 32 | @RequestMapping("/") 33 | public class IndexControllerImpl{ 34 | 35 | private static final Logger LOG = LoggerFactory.getLogger(IndexControllerImpl.class); 36 | 37 | @Autowired 38 | private ExtApiService extApiService; 39 | 40 | @Autowired 41 | private DbSourceService dbService; 42 | 43 | @Autowired 44 | private TemplateService templateService; 45 | 46 | 47 | @RequestMapping(value = "/",method = RequestMethod.GET) 48 | public String index() { 49 | return "core/index"; 50 | } 51 | 52 | 53 | @RequestMapping(value = "/dbList",method = RequestMethod.GET) 54 | public String dbList(Model model) { 55 | //List strings = IOUtils.readLines(new FileInputStream(FileConstants.TEMP_DB_CONFIG_DB), "UTF-8"); 56 | //从数据库中读取 57 | List dbSourcePos = dbService.queryList(); 58 | for (DbSourcePo dbSourcePo : dbSourcePos) { 59 | extApiService.initDb(dbSourcePo); 60 | } 61 | model.addAttribute("dbConfigList", dbSourcePos); 62 | return "core/dbList"; 63 | } 64 | 65 | @RequestMapping(value = "/templateList",method = RequestMethod.GET) 66 | public String templateList(Model model) { 67 | //从数据库中读取 68 | List templates = templateService.queryList(); 69 | model.addAttribute("templateList", templates); 70 | model.addAttribute("vmTypeList", VmTypeEnums.values()); 71 | model.addAttribute("dbTypeList", DbTypeEnums.values()); 72 | return "core/templateList"; 73 | } 74 | 75 | @RequestMapping(value = "/configList",method = RequestMethod.GET) 76 | public String configList(Model model) { 77 | return "core/configList"; 78 | } 79 | 80 | @RequestMapping(value = "/addTemplate",method = RequestMethod.GET) 81 | public String addTemplate(Model model) { 82 | List templates = templateService.queryList(); 83 | model.addAttribute("templateList", templates); 84 | model.addAttribute("vmTypeList", VmTypeEnums.values()); 85 | model.addAttribute("dbTypeList", DbTypeEnums.values()); 86 | model.addAttribute("template", new Template()); 87 | return "core/addTemplate"; 88 | } 89 | 90 | 91 | @RequestMapping(value = "/updateTemplate/{id}",method = RequestMethod.GET) 92 | public String updateTemplate(Model model, @PathVariable("id")Integer id) { 93 | Template templates = templateService.getOne(id); 94 | model.addAttribute("template", templates); 95 | model.addAttribute("vmTypeList", VmTypeEnums.values()); 96 | model.addAttribute("dbTypeList", DbTypeEnums.values()); 97 | return "core/addTemplate"; 98 | } 99 | 100 | 101 | @RequestMapping(value = "/tableList",method = RequestMethod.GET) 102 | public String tableList(Model model,@RequestParam("key") Integer key) { 103 | LOG.info("拿到的数据库ID是{}",key); 104 | //尝试存进数据库中 105 | if (key==null){ 106 | throw new RuntimeException("参数不合法"); 107 | } 108 | DbSourcePo dbConfigPo = dbService.getOne(key); 109 | Connection connection = ConnectionHolder.getConnection(dbConfigPo.getDbAddress()+dbConfigPo.getDbName()); 110 | List tables = extApiService.getTables(connection); 111 | model.addAttribute("tables", tables); 112 | model.addAttribute("key", dbConfigPo.getDbAddress()+dbConfigPo.getDbName()); 113 | List templates = templateService.queryList(); 114 | model.addAttribute("templates", templates); 115 | return "core/tableList"; 116 | } 117 | 118 | @RequestMapping(value = "/modal",method = RequestMethod.GET) 119 | public String modal() { 120 | return "core/ui-modals"; 121 | } 122 | 123 | 124 | } 125 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/java/com/github/mustfun/generator/biz/mq/MqConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.biz.mq; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | /** 7 | * Created by dengzhiyuan on 2017/4/6. 8 | */ 9 | //@Configuration 10 | //@ConfigurationProperties(prefix = "rocketMq") 11 | public class MqConfig { 12 | private String name; 13 | 14 | public void setName(String name) { 15 | this.name = name; 16 | } 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/css/img/sample-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/css/img/sample-1.jpg -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/css/img/sort_asc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/css/img/sort_asc.png -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/css/img/sort_asc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/css/img/sort_asc_disabled.png -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/css/img/sort_both.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/css/img/sort_both.png -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/css/img/sort_desc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/css/img/sort_desc.png -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/css/img/sort_desc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/css/img/sort_desc_disabled.png -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/css/img/user-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/css/img/user-bg.jpg -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/css/jquery-jvectormap.css: -------------------------------------------------------------------------------- 1 | .jvectormap-label { position: absolute; display: none; border: solid 1px #000; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; background-color: #292929; background-color: rgba(0,0,0,0.8); color: white; font-size: 12px; padding: 4px 10px; } 2 | .jvectormap-zoomin, .jvectormap-zoomout { position: absolute; left: 10px; background: #fff; border: 1px solid #f0f0f0; box-shadow: 0 1px 1px rgba(0,0,0,0.1); padding: 0px; font-weight: bold; font-size: 20px; color: #aaa; width: 24px; height: 24px; line-height: 22px; text-align: center; cursor: pointer; } 3 | .jvectormap-zoomin { top: 10px; } 4 | .jvectormap-zoomout { top: 33px; } 5 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/css/morris.css: -------------------------------------------------------------------------------- 1 | .morris-hover{position:absolute;z-index:1000}.morris-hover.morris-default-style{border-radius:10px;padding:6px;color:#666;background:rgba(255,255,255,0.8);border:solid 2px rgba(230,230,230,0.8);font-family:sans-serif;font-size:12px;text-align:center}.morris-hover.morris-default-style .morris-hover-row-label{font-weight:bold;margin:0.25em 0} 2 | .morris-hover.morris-default-style .morris-hover-point{white-space:nowrap;margin:0.1em 0} 3 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/css/page-center.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | height: 100%; 4 | } 5 | html { 6 | display: table; 7 | margin: auto; 8 | } 9 | body { 10 | display: table-cell; 11 | vertical-align: middle; 12 | } 13 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/css/perfect-scrollbar.css: -------------------------------------------------------------------------------- 1 | .ps-container.ps-active-x > .ps-scrollbar-x-rail, .ps-container.ps-active-y > .ps-scrollbar-y-rail { display: block; } 2 | .ps-container.ps-in-scrolling { pointer-events: none; } 3 | .ps-container.ps-in-scrolling > .ps-scrollbar-x-rail { background-color: rgba(10,10,10,0.3); opacity: 0.9; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=90)"; filter: alpha(opacity=90); } 4 | .ps-container.ps-in-scrolling > .ps-scrollbar-x-rail > .ps-scrollbar-x { background-color: rgba(130,130,138,0.9); } 5 | .ps-container.ps-in-scrolling > .ps-scrollbar-y-rail { background-color: rgba(10,10,10,0.3); opacity: 0.9; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=90)"; filter: alpha(opacity=90); } 6 | .ps-container.ps-in-scrolling > .ps-scrollbar-y-rail > .ps-scrollbar-y { background-color: rgba(130,130,138,0.9); } 7 | .ps-container > .ps-scrollbar-x-rail { display: none; position: absolute; /* please don't change 'position' */ 8 | -webkit-border-radius: 0px; -moz-border-radius: 0px; -ms-border-radius: 0px; border-radius: 0px; opacity: 0; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter: alpha(opacity=0); -webkit-transition: background-color 0.2s linear, opacity 0.2s linear; -moz-transition: background-color 0.2s linear, opacity 0.2s linear; -o-transition: background-color 0.2s linear, opacity 0.2s linear; transition: background-color 0.2s linear, opacity 0.2s linear; bottom: 3px; /* there must be 'bottom' for ps-scrollbar-x-rail */ 9 | height: 5px; } 10 | .ps-container > .ps-scrollbar-x-rail > .ps-scrollbar-x { position: absolute; /* please don't change 'position' */ 11 | background-color: rgba(130,130,138,1); -webkit-border-radius: 0px; -moz-border-radius: 0px; -ms-border-radius: 0px; border-radius: 0px; -webkit-transition: background-color 0.2s linear; -moz-transition: background-color 0.2s linear; -o-transition: background-color 0.2s linear; transition: background-color 0.2s linear; bottom: 0; /* there must be 'bottom' for ps-scrollbar-x */ 12 | height: 5px; } 13 | .ps-container > .ps-scrollbar-y-rail { display: none; position: absolute; /* please don't change 'position' */ 14 | -webkit-border-radius: 0px; -moz-border-radius: 0px; -ms-border-radius: 0px; border-radius: 0px; opacity: 0; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter: alpha(opacity=0); -webkit-transition: background-color 0.2s linear, opacity 0.2s linear; -moz-transition: background-color 0.2s linear, opacity 0.2s linear; -o-transition: background-color 0.2s linear, opacity 0.2s linear; transition: background-color 0.2s linear, opacity 0.2s linear; right: 3px; /* there must be 'right' for ps-scrollbar-y-rail */ 15 | width: 5px; } 16 | .ps-container > .ps-scrollbar-y-rail > .ps-scrollbar-y { position: absolute; /* please don't change 'position' */ 17 | background-color: rgba(130,130,138,1); -webkit-border-radius: 0px; -moz-border-radius: 0px; -ms-border-radius: 0px; border-radius: 0px; -webkit-transition: background-color 0.2s linear; -moz-transition: background-color 0.2s linear; -o-transition: background-color 0.2s linear; transition: background-color 0.2s linear; right: 0; /* there must be 'right' for ps-scrollbar-y */ 18 | width: 5px; } 19 | .ps-container:hover.ps-in-scrolling { pointer-events: none; } 20 | .ps-container:hover.ps-in-scrolling > .ps-scrollbar-x-rail { background-color: rgba(10,10,10,0.3); opacity: 0.9; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=90)"; filter: alpha(opacity=90); } 21 | .ps-container:hover.ps-in-scrolling > .ps-scrollbar-x-rail > .ps-scrollbar-x { background-color: rgba(130,130,138,0.9); } 22 | .ps-container:hover.ps-in-scrolling > .ps-scrollbar-y-rail { background-color: rgba(10,10,10,0.3); opacity: 0.9; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=90)"; filter: alpha(opacity=90); } 23 | .ps-container:hover.ps-in-scrolling > .ps-scrollbar-y-rail > .ps-scrollbar-y { background-color: rgba(130,130,138,0.9); } 24 | .ps-container:hover > .ps-scrollbar-x-rail, .ps-container:hover > .ps-scrollbar-y-rail { opacity: 0.6; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=60)"; filter: alpha(opacity=60); } 25 | .ps-container:hover > .ps-scrollbar-x-rail:hover { background-color: rgba(10,10,10,0.3); opacity: 0.9; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=90)"; filter: alpha(opacity=90); } 26 | .ps-container:hover > .ps-scrollbar-x-rail:hover > .ps-scrollbar-x { background-color: rgba(130,130,138,0.9); } 27 | .ps-container:hover > .ps-scrollbar-y-rail:hover { background-color: rgba(10,10,10,0.3); opacity: 0.9; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=90)"; filter: alpha(opacity=90); } 28 | .ps-container:hover > .ps-scrollbar-y-rail:hover > .ps-scrollbar-y { background-color: rgba(130,130,138,0.9); } 29 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/css/prism.css: -------------------------------------------------------------------------------- 1 | /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+scss+bash */ 2 | /** 3 | * prism.js default theme for JavaScript, CSS and HTML 4 | * Based on dabblet (http://dabblet.com) 5 | * @author Lea Verou 6 | */ 7 | 8 | code[class*="language-"], 9 | pre[class*="language-"] { 10 | color: black; 11 | /* text-shadow: 0 1px white;*/ 12 | font-family: 'Inconsolata', Monaco, Consolas, 'Andale Mono', monospace; 13 | direction: ltr; 14 | text-align: left; 15 | white-space: pre; 16 | word-spacing: normal; 17 | word-break: normal; 18 | line-height: 1.4; 19 | 20 | -moz-tab-size: 4; 21 | -o-tab-size: 4; 22 | tab-size: 4; 23 | 24 | -webkit-hyphens: none; 25 | -moz-hyphens: none; 26 | -ms-hyphens: none; 27 | hyphens: none; 28 | } 29 | 30 | pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, 31 | code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { 32 | text-shadow: none; 33 | background: #b3d4fc; 34 | } 35 | 36 | pre[class*="language-"]::selection, pre[class*="language-"] ::selection, 37 | code[class*="language-"]::selection, code[class*="language-"] ::selection { 38 | text-shadow: none; 39 | background: #b3d4fc; 40 | } 41 | 42 | @media print { 43 | code[class*="language-"], 44 | pre[class*="language-"] { 45 | text-shadow: none; 46 | } 47 | } 48 | 49 | /* Code blocks */ 50 | pre[class*="language-"] { 51 | padding: 1em; 52 | margin: .5em 0; 53 | overflow: auto; 54 | } 55 | 56 | :not(pre) > code[class*="language-"], 57 | pre[class*="language-"] { 58 | background: #f5f2f0; 59 | } 60 | 61 | /* Inline code */ 62 | :not(pre) > code[class*="language-"] { 63 | padding: .1em; 64 | border-radius: .3em; 65 | } 66 | 67 | .token.comment, 68 | .token.prolog, 69 | .token.doctype, 70 | .token.cdata { 71 | color: slategray; 72 | } 73 | 74 | .token.punctuation { 75 | color: #999; 76 | } 77 | 78 | .namespace { 79 | opacity: .7; 80 | } 81 | 82 | .token.property, 83 | .token.tag, 84 | .token.boolean, 85 | .token.number, 86 | .token.constant, 87 | .token.symbol, 88 | .token.deleted { 89 | color: #905; 90 | } 91 | 92 | .token.selector, 93 | .token.attr-name, 94 | .token.string, 95 | .token.char, 96 | .token.builtin, 97 | .token.inserted { 98 | color: #690; 99 | } 100 | 101 | .token.operator, 102 | .token.entity, 103 | .token.url, 104 | .language-css .token.string, 105 | .style .token.string { 106 | color: #a67f59; 107 | background: hsla(0, 0%, 100%, .5); 108 | } 109 | 110 | .token.atrule, 111 | .token.attr-value, 112 | .token.keyword { 113 | color: #07a; 114 | } 115 | 116 | .token.function { 117 | color: #DD4A68; 118 | } 119 | 120 | .token.regex, 121 | .token.important, 122 | .token.variable { 123 | color: #e90; 124 | } 125 | 126 | .token.important { 127 | font-weight: bold; 128 | } 129 | 130 | .token.entity { 131 | cursor: help; 132 | } 133 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/css/xcharts.min.css: -------------------------------------------------------------------------------- 1 | .xchart .line{stroke-width:3px;fill:none}.xchart .fill{stroke-width:0}.xchart circle{stroke:#FFF;stroke-width:3px}.xchart .axis .domain{fill:none}.xchart .axis .tick line{stroke:#EEE;stroke-width:1px}.xchart .axis text{font-family:Helvetica,Arial,Verdana,sans-serif;fill:#666;font-size:12px}.xchart .color0 .line{stroke:#3880aa}.xchart .color0 .line .fill{pointer-events:none}.xchart .color0 rect,.xchart .color0 circle{fill:#3880aa}.xchart .color0 .fill{fill:rgba(56,128,170,0.1)}.xchart .color0.comp .line{stroke:#89bbd8}.xchart .color0.comp rect{fill:#89bbd8}.xchart .color0.comp .fill{display:none}.xchart .color0.comp circle,.xchart .color0.comp .pointer{fill:#89bbd8}.xchart .color1 .line{stroke:#4da944}.xchart .color1 .line .fill{pointer-events:none}.xchart .color1 rect,.xchart .color1 circle{fill:#4da944}.xchart .color1 .fill{fill:rgba(77,169,68,0.1)}.xchart .color1.comp .line{stroke:#9dd597}.xchart .color1.comp rect{fill:#9dd597}.xchart .color1.comp .fill{display:none}.xchart .color1.comp circle,.xchart .color1.comp .pointer{fill:#9dd597}.xchart .color2 .line{stroke:#f26522}.xchart .color2 .line .fill{pointer-events:none}.xchart .color2 rect,.xchart .color2 circle{fill:#f26522}.xchart .color2 .fill{fill:rgba(242,101,34,0.1)}.xchart .color2.comp .line{stroke:#f9b99a}.xchart .color2.comp rect{fill:#f9b99a}.xchart .color2.comp .fill{display:none}.xchart .color2.comp circle,.xchart .color2.comp .pointer{fill:#f9b99a}.xchart .color3 .line{stroke:#c6080d}.xchart .color3 .line .fill{pointer-events:none}.xchart .color3 rect,.xchart .color3 circle{fill:#c6080d}.xchart .color3 .fill{fill:rgba(198,8,13,0.1)}.xchart .color3.comp .line{stroke:#f8555a}.xchart .color3.comp rect{fill:#f8555a}.xchart .color3.comp .fill{display:none}.xchart .color3.comp circle,.xchart .color3.comp .pointer{fill:#f8555a}.xchart .color4 .line{stroke:#672d8b}.xchart .color4 .line .fill{pointer-events:none}.xchart .color4 rect,.xchart .color4 circle{fill:#672d8b}.xchart .color4 .fill{fill:rgba(103,45,139,0.1)}.xchart .color4.comp .line{stroke:#a869ce}.xchart .color4.comp rect{fill:#a869ce}.xchart .color4.comp .fill{display:none}.xchart .color4.comp circle,.xchart .color4.comp .pointer{fill:#a869ce}.xchart .color5 .line{stroke:#ce1797}.xchart .color5 .line .fill{pointer-events:none}.xchart .color5 rect,.xchart .color5 circle{fill:#ce1797}.xchart .color5 .fill{fill:rgba(206,23,151,0.1)}.xchart .color5.comp .line{stroke:#f075cb}.xchart .color5.comp rect{fill:#f075cb}.xchart .color5.comp .fill{display:none}.xchart .color5.comp circle,.xchart .color5.comp .pointer{fill:#f075cb}.xchart .color6 .line{stroke:#d9ce00}.xchart .color6 .line .fill{pointer-events:none}.xchart .color6 rect,.xchart .color6 circle{fill:#d9ce00}.xchart .color6 .fill{fill:rgba(217,206,0,0.1)}.xchart .color6.comp .line{stroke:#fff75a}.xchart .color6.comp rect{fill:#fff75a}.xchart .color6.comp .fill{display:none}.xchart .color6.comp circle,.xchart .color6.comp .pointer{fill:#fff75a}.xchart .color7 .line{stroke:#754c24}.xchart .color7 .line .fill{pointer-events:none}.xchart .color7 rect,.xchart .color7 circle{fill:#754c24}.xchart .color7 .fill{fill:rgba(117,76,36,0.1)}.xchart .color7.comp .line{stroke:#c98c50}.xchart .color7.comp rect{fill:#c98c50}.xchart .color7.comp .fill{display:none}.xchart .color7.comp circle,.xchart .color7.comp .pointer{fill:#c98c50}.xchart .color8 .line{stroke:#2eb9b4}.xchart .color8 .line .fill{pointer-events:none}.xchart .color8 rect,.xchart .color8 circle{fill:#2eb9b4}.xchart .color8 .fill{fill:rgba(46,185,180,0.1)}.xchart .color8.comp .line{stroke:#86e1de}.xchart .color8.comp rect{fill:#86e1de}.xchart .color8.comp .fill{display:none}.xchart .color8.comp circle,.xchart .color8.comp .pointer{fill:#86e1de}.xchart .color9 .line{stroke:#0e2e42}.xchart .color9 .line .fill{pointer-events:none}.xchart .color9 rect,.xchart .color9 circle{fill:#0e2e42}.xchart .color9 .fill{fill:rgba(14,46,66,0.1)}.xchart .color9.comp .line{stroke:#2477ab}.xchart .color9.comp rect{fill:#2477ab}.xchart .color9.comp .fill{display:none}.xchart .color9.comp circle,.xchart .color9.comp .pointer{fill:#2477ab} 2 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/font/Material-Design-Icons/Material-Design-Icons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/font/Material-Design-Icons/Material-Design-Icons.eot -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/font/Material-Design-Icons/Material-Design-Icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/font/Material-Design-Icons/Material-Design-Icons.ttf -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/font/roboto/Roboto-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/font/roboto/Roboto-Bold.ttf -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/font/roboto/Roboto-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/font/roboto/Roboto-Light.ttf -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/font/roboto/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/font/roboto/Roboto-Medium.ttf -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/font/roboto/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/font/roboto/Roboto-Regular.ttf -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/font/roboto/Roboto-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/font/roboto/Roboto-Thin.ttf -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/img/avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/img/avatar.jpg -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/img/generic-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/img/generic-logo.png -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/img/login-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/img/login-logo.png -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/img/materialize-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/img/materialize-logo.png -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/img/office.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/img/office.jpg -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/img/sample-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/img/sample-1.jpg -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/img/signature-scan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/img/signature-scan.png -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/img/style_typography_roboto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/img/style_typography_roboto.png -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/img/user-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mustfun/mybatis-generator-web/3ec2869203c67c19940265a381540637cd7db5e8/mybatis-generator-web-biz/src/main/resources/static/img/user-bg.jpg -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/js/chartjs-sample-chart.js: -------------------------------------------------------------------------------- 1 | //Sampel Line Chart 2 | var LineChartSampleData = { 3 | labels: ["January", "February", "March", "April", "May", "June", "July"], 4 | datasets: [{ 5 | label: "My First dataset", 6 | fillColor: "rgba(220,220,220,0.2)", 7 | strokeColor: "rgba(220,220,220,1)", 8 | pointColor: "rgba(220,220,220,1)", 9 | pointStrokeColor: "#fff", 10 | pointHighlightFill: "#fff", 11 | pointHighlightStroke: "rgba(220,220,220,1)", 12 | data: [65, 59, 80, 81, 56, 55, 40] 13 | }, { 14 | label: "My Second dataset", 15 | fillColor: "rgba(151,187,205,0.2)", 16 | strokeColor: "rgba(151,187,205,1)", 17 | pointColor: "rgba(151,187,205,1)", 18 | pointStrokeColor: "#fff", 19 | pointHighlightFill: "#fff", 20 | pointHighlightStroke: "rgba(151,187,205,1)", 21 | data: [28, 48, 40, 19, 86, 27, 90] 22 | }] 23 | }; 24 | 25 | //Sampel Bar Chart 26 | var BarChartSampleData = { 27 | labels: ["January", "February", "March", "April", "May", "June", "July"], 28 | datasets: [ 29 | { 30 | label: "My First dataset", 31 | fillColor: "rgba(220,220,220,0.5)", 32 | strokeColor: "rgba(220,220,220,0.8)", 33 | highlightFill: "rgba(220,220,220,0.75)", 34 | highlightStroke: "rgba(220,220,220,1)", 35 | data: [65, 59, 80, 81, 56, 55, 40] 36 | }, 37 | { 38 | label: "My Second dataset", 39 | fillColor: "rgba(151,187,205,0.5)", 40 | strokeColor: "rgba(151,187,205,0.8)", 41 | highlightFill: "rgba(151,187,205,0.75)", 42 | highlightStroke: "rgba(151,187,205,1)", 43 | data: [28, 48, 40, 19, 86, 27, 90] 44 | } 45 | ] 46 | }; 47 | 48 | 49 | //Sampel Radar Chart 50 | var RadarChartSampleData = { 51 | labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"], 52 | datasets: [ 53 | { 54 | label: "My First dataset", 55 | fillColor: "rgba(220,220,220,0.2)", 56 | strokeColor: "rgba(220,220,220,1)", 57 | pointColor: "rgba(220,220,220,1)", 58 | pointStrokeColor: "#fff", 59 | pointHighlightFill: "#fff", 60 | pointHighlightStroke: "rgba(220,220,220,1)", 61 | data: [65, 59, 90, 81, 56, 55, 40] 62 | }, 63 | { 64 | label: "My Second dataset", 65 | fillColor: "rgba(151,187,205,0.2)", 66 | strokeColor: "rgba(151,187,205,1)", 67 | pointColor: "rgba(151,187,205,1)", 68 | pointStrokeColor: "#fff", 69 | pointHighlightFill: "#fff", 70 | pointHighlightStroke: "rgba(151,187,205,1)", 71 | data: [28, 48, 40, 19, 96, 27, 100] 72 | } 73 | ] 74 | }; 75 | 76 | //Sampel Polor Chart 77 | var PolarChartSampleData = [ 78 | { 79 | value: 300, 80 | color:"#F7464A", 81 | highlight: "#FF5A5E", 82 | label: "Red" 83 | }, 84 | { 85 | value: 50, 86 | color: "#46BFBD", 87 | highlight: "#5AD3D1", 88 | label: "Green" 89 | }, 90 | { 91 | value: 100, 92 | color: "#FDB45C", 93 | highlight: "#FFC870", 94 | label: "Yellow" 95 | }, 96 | { 97 | value: 40, 98 | color: "#949FB1", 99 | highlight: "#A8B3C5", 100 | label: "Grey" 101 | }, 102 | { 103 | value: 120, 104 | color: "#4D5360", 105 | highlight: "#616774", 106 | label: "Dark Grey" 107 | } 108 | 109 | ]; 110 | 111 | //Sampel Pie Doughnut Chart 112 | var PieDoughnutChartSampleData = [ 113 | { 114 | value: 300, 115 | color:"#F7464A", 116 | highlight: "#FF5A5E", 117 | label: "Red" 118 | }, 119 | { 120 | value: 50, 121 | color: "#46BFBD", 122 | highlight: "#5AD3D1", 123 | label: "Green" 124 | }, 125 | { 126 | value: 100, 127 | color: "#FDB45C", 128 | highlight: "#FFC870", 129 | label: "Yellow" 130 | } 131 | ] 132 | 133 | window.onload = function() { 134 | 135 | window.LineChartSample = new Chart(document.getElementById("line-chart-sample").getContext("2d")).Line(LineChartSampleData,{ 136 | responsive:true 137 | }); 138 | 139 | window.BarChartSample = new Chart(document.getElementById("bar-chart-sample").getContext("2d")).Bar(BarChartSampleData,{ 140 | responsive:true 141 | }); 142 | 143 | window.RadarChartSample = new Chart(document.getElementById("radar-chart-sample").getContext("2d")).Radar(RadarChartSampleData,{ 144 | responsive:true 145 | }); 146 | 147 | window.PolarChartSample = new Chart(document.getElementById("polar-chart-sample").getContext("2d")).PolarArea(PolarChartSampleData,{ 148 | responsive:true 149 | }); 150 | 151 | window.PieChartSample = new Chart(document.getElementById("pie-chart-sample").getContext("2d")).Pie(PieDoughnutChartSampleData,{ 152 | responsive:true 153 | }); 154 | window.DoughnutChartSample = new Chart(document.getElementById("doughnut-chart-sample").getContext("2d")).Pie(PieDoughnutChartSampleData,{ 155 | responsive:true 156 | }); 157 | 158 | 159 | }; 160 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/js/data-tables-script.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/js/flot-chart.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/js/fullcalendar-script.js: -------------------------------------------------------------------------------- 1 | 2 | $(document).ready(function() { 3 | 4 | 5 | /* initialize the external events 6 | -----------------------------------------------------------------*/ 7 | $('#external-events .fc-event').each(function() { 8 | 9 | // store data so the calendar knows to render an event upon drop 10 | $(this).data('event', { 11 | title: $.trim($(this).text()), // use the element's text as the event title 12 | stick: true, // maintain when user navigates (see docs on the renderEvent method) 13 | color: '#00bcd4' 14 | }); 15 | 16 | // make the event draggable using jQuery UI 17 | $(this).draggable({ 18 | zIndex: 999, 19 | revert: true, // will cause the event to go back to its 20 | revertDuration: 0 // original position after the drag 21 | }); 22 | 23 | }); 24 | 25 | 26 | /* initialize the calendar 27 | -----------------------------------------------------------------*/ 28 | $('#calendar').fullCalendar({ 29 | header: { 30 | left: 'prev,next today', 31 | center: 'title', 32 | right: 'month,basicWeek,basicDay' 33 | }, 34 | defaultDate: '2015-05-12', 35 | editable: true, 36 | droppable: true, // this allows things to be dropped onto the calendar 37 | eventLimit: true, // allow "more" link when too many events 38 | events: [ 39 | { 40 | title: 'All Day Event', 41 | start: '2015-05-01', 42 | color: '#9c27b0' 43 | }, 44 | { 45 | title: 'Long Event', 46 | start: '2015-05-07', 47 | end: '2015-05-10', 48 | color: '#e91e63' 49 | }, 50 | { 51 | id: 999, 52 | title: 'Repeating Event', 53 | start: '2015-05-09T16:00:00', 54 | color: '#ff1744' 55 | }, 56 | { 57 | id: 999, 58 | title: 'Repeating Event', 59 | start: '2015-05-16T16:00:00', 60 | color: '#aa00ff' 61 | }, 62 | { 63 | title: 'Conference', 64 | start: '2015-05-3', 65 | end: '2015-05-5', 66 | color: '#01579b' 67 | }, 68 | { 69 | title: 'Meeting', 70 | start: '2015-05-12T10:30:00', 71 | end: '2015-05-12T12:30:00', 72 | color: '#2196f3' 73 | }, 74 | { 75 | title: 'Lunch', 76 | start: '2015-05-12T12:00:00', 77 | color: '#ff5722' 78 | }, 79 | { 80 | title: 'Meeting', 81 | start: '2015-05-12T14:30:00', 82 | color: '#4caf50' 83 | }, 84 | { 85 | title: 'Happy Hour', 86 | start: '2015-05-12T17:30:00', 87 | color: '#03a9f4' 88 | }, 89 | { 90 | title: 'Dinner', 91 | start: '2015-05-12T20:00:00', 92 | color: '#009688' 93 | }, 94 | { 95 | title: 'Birthday Party', 96 | start: '2015-05-13T07:00:00', 97 | color: '#00bcd4' 98 | } 99 | ] 100 | }); 101 | 102 | }); -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/js/jquery.dataTables.min.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/js/morris-script.js: -------------------------------------------------------------------------------- 1 | /* Author: 2 | 3 | */ 4 | 5 | $(function() { 6 | // data stolen from http://howmanyleft.co.uk/vehicle/jaguar_'e'_type 7 | var tax_data = [{ 8 | "period": "2011 Q3", 9 | "licensed": 3407, 10 | "sorned": 660 11 | }, { 12 | "period": "2011 Q2", 13 | "licensed": 3351, 14 | "sorned": 629 15 | }, { 16 | "period": "2011 Q1", 17 | "licensed": 3269, 18 | "sorned": 618 19 | }, { 20 | "period": "2010 Q4", 21 | "licensed": 3246, 22 | "sorned": 661 23 | }, { 24 | "period": "2009 Q4", 25 | "licensed": 3171, 26 | "sorned": 676 27 | }, { 28 | "period": "2008 Q4", 29 | "licensed": 3155, 30 | "sorned": 681 31 | }, { 32 | "period": "2007 Q4", 33 | "licensed": 3226, 34 | "sorned": 620 35 | }, { 36 | "period": "2006 Q4", 37 | "licensed": 3245, 38 | "sorned": null 39 | }, { 40 | "period": "2005 Q4", 41 | "licensed": 3289, 42 | "sorned": null 43 | }]; 44 | 45 | 46 | // Use Morris.Bar 47 | Morris.Bar({ 48 | element: 'morris-bar', 49 | data: [{ 50 | x: '2011 Q1', 51 | y: 3, 52 | z: 2, 53 | a: 3 54 | }, { 55 | x: '2011 Q2', 56 | y: 2, 57 | z: null, 58 | a: 1 59 | }, { 60 | x: '2011 Q3', 61 | y: 0, 62 | z: 2, 63 | a: 4 64 | }, { 65 | x: '2011 Q4', 66 | y: 2, 67 | z: 4, 68 | a: 3 69 | }], 70 | xkey: 'x', 71 | ykeys: ['y', 'z', 'a'], 72 | labels: ['Y', 'Z', 'A'] 73 | }); 74 | // Line Chart 75 | Morris.Line({ 76 | element: 'morris-line', 77 | data: tax_data, 78 | xkey: 'period', 79 | ykeys: ['licensed', 'sorned'], 80 | labels: ['Licensed', 'Off the road'] 81 | }); 82 | // Area chart 83 | Morris.Area({ 84 | element: 'morris-area', 85 | data: [{ 86 | period: '2010 Q1', 87 | iphone: 2666, 88 | ipad: null, 89 | itouch: 2647 90 | }, { 91 | period: '2010 Q2', 92 | iphone: 2778, 93 | ipad: 2294, 94 | itouch: 2441 95 | }, { 96 | period: '2010 Q3', 97 | iphone: 4912, 98 | ipad: 1969, 99 | itouch: 2501 100 | }, { 101 | period: '2010 Q4', 102 | iphone: 3767, 103 | ipad: 3597, 104 | itouch: 5689 105 | }, { 106 | period: '2011 Q1', 107 | iphone: 6810, 108 | ipad: 1914, 109 | itouch: 2293 110 | }, { 111 | period: '2011 Q2', 112 | iphone: 5670, 113 | ipad: 4293, 114 | itouch: 1881 115 | }, { 116 | period: '2011 Q3', 117 | iphone: 4820, 118 | ipad: 3795, 119 | itouch: 1588 120 | }, { 121 | period: '2011 Q4', 122 | iphone: 15073, 123 | ipad: 5967, 124 | itouch: 5175 125 | }, { 126 | period: '2012 Q1', 127 | iphone: 10687, 128 | ipad: 4460, 129 | itouch: 2028 130 | }, { 131 | period: '2012 Q2', 132 | iphone: 8432, 133 | ipad: 5713, 134 | itouch: 1791 135 | }], 136 | xkey: 'period', 137 | ykeys: ['iphone', 'ipad', 'itouch'], 138 | labels: ['iPhone', 'iPad', 'iPod Touch'], 139 | pointSize: 2, 140 | hideHover: 'auto' 141 | }); 142 | 143 | 144 | //Donut Chart 145 | Morris.Donut({ 146 | element: 'morris-donut', 147 | data: [{ 148 | label: 'Jam', 149 | value: 25 150 | }, { 151 | label: 'Frosted', 152 | value: 40 153 | }, { 154 | label: 'Custard', 155 | value: 25 156 | }, { 157 | label: 'Sugar', 158 | value: 10 159 | }], 160 | formatter: function(y) { 161 | return y + "%" 162 | } 163 | }); 164 | 165 | $('.code-example').each(function(index, el) { 166 | eval($(el).text()); 167 | }); 168 | }); 169 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/js/vectormap-script.js: -------------------------------------------------------------------------------- 1 | /*-------------------------------- 2 | Vector maps 3 | --------------------------------*/ 4 | 5 | $('#world-map-markers').vectorMap({ 6 | map: 'world_mill_en', 7 | scaleColors: ['#1fb5ac', '#1fb5ac'], 8 | normalizeFunction: 'polynomial', 9 | hoverOpacity: 0.7, 10 | hoverColor: false, 11 | regionsSelectable: true, 12 | markersSelectable: true, 13 | markersSelectableOne: true, 14 | updateSize: true, 15 | onRegionOver: function(event, code) { 16 | //console.log('region-over', code); 17 | }, 18 | onRegionOut: function(event, code) { 19 | //console.log('region-out', code); 20 | }, 21 | onRegionClick: function(event, code) { 22 | //console.log('region-click', code); 23 | }, 24 | onRegionSelected: function(event, code, isSelected, selectedRegions) { 25 | //console.log('region-select', code, isSelected, selectedRegions); 26 | if (window.localStorage) { 27 | window.localStorage.setItem( 28 | 'jvectormap-selected-regions', 29 | JSON.stringify(selectedRegions) 30 | ); 31 | } 32 | }, 33 | 34 | panOnDrag: true, 35 | 36 | focusOn: { 37 | x: 0.5, 38 | y: 0.5, 39 | scale: 1.2, 40 | animate: true 41 | }, 42 | 43 | 44 | regionStyle: { 45 | initial: { 46 | fill: '#b2ebf2', 47 | 'fill-opacity': 1, 48 | stroke: 'false', 49 | 'stroke-width': 0, 50 | 'stroke-opacity': 1 51 | }, 52 | hover: { 53 | fill: '#e0f7fa', 54 | 'fill-opacity': 1, 55 | cursor: 'pointer' 56 | }, 57 | selected: { 58 | fill: '#80deea' 59 | }, 60 | selectedHover: {} 61 | }, 62 | 63 | markerStyle: { 64 | initial: { 65 | fill: '#ff4081', 66 | stroke: '#f8bbd0', 67 | r: 6 68 | }, 69 | hover: { 70 | stroke: '#f8bbd0', 71 | "stroke-width": 3, 72 | cursor: 'pointer' 73 | }, 74 | selected: { 75 | fill: '#f50057', 76 | "stroke-width": 0, 77 | }, 78 | }, 79 | backgroundColor: '#00bcd4', 80 | markers: [{ 81 | latLng: [-38.41, -63.61], 82 | name: 'Argentina', 83 | }, { 84 | latLng: [-25.27, 133.77], 85 | name: 'Australia' 86 | }, { 87 | latLng: [-14.23, -51.92], 88 | name: 'Brazil' 89 | }, { 90 | latLng: [56.13, -106.34], 91 | name: 'Canada' 92 | }, { 93 | latLng: [35.86, 104.19], 94 | name: 'China' 95 | }, { 96 | latLng: [46.22, 2.21], 97 | name: 'France' 98 | }, { 99 | latLng: [51.16, 10.45], 100 | name: 'Germany' 101 | }, { 102 | latLng: [20.59, 78.96], 103 | name: 'India' 104 | }, { 105 | latLng: [41.87, 12.56], 106 | name: 'Italy' 107 | }, { 108 | latLng: [4.21, 101.97], 109 | name: 'Malaysia' 110 | }, { 111 | latLng: [-40.90, 174.88], 112 | name: 'New Zealand' 113 | }] 114 | }); -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/static/js/xcharts-script.js: -------------------------------------------------------------------------------- 1 | //Animated Chart 2 | (function () { 3 | var data = [{"xScale":"ordinal","comp":[],"main":[{"className":".main.l1","data":[{"y":15,"x":"2012-11-19T00:00:00"},{"y":11,"x":"2012-11-20T00:00:00"},{"y":8,"x":"2012-11-21T00:00:00"},{"y":10,"x":"2012-11-22T00:00:00"},{"y":1,"x":"2012-11-23T00:00:00"},{"y":6,"x":"2012-11-24T00:00:00"},{"y":8,"x":"2012-11-25T00:00:00"}]},{"className":".main.l2","data":[{"y":29,"x":"2012-11-19T00:00:00"},{"y":33,"x":"2012-11-20T00:00:00"},{"y":13,"x":"2012-11-21T00:00:00"},{"y":16,"x":"2012-11-22T00:00:00"},{"y":7,"x":"2012-11-23T00:00:00"},{"y":18,"x":"2012-11-24T00:00:00"},{"y":8,"x":"2012-11-25T00:00:00"}]}],"type":"line-dotted","yScale":"linear"},{"xScale":"ordinal","comp":[],"main":[{"className":".main.l1","data":[{"y":12,"x":"2012-11-19T00:00:00"},{"y":18,"x":"2012-11-20T00:00:00"},{"y":8,"x":"2012-11-21T00:00:00"},{"y":7,"x":"2012-11-22T00:00:00"},{"y":6,"x":"2012-11-23T00:00:00"},{"y":12,"x":"2012-11-24T00:00:00"},{"y":8,"x":"2012-11-25T00:00:00"}]},{"className":".main.l2","data":[{"y":29,"x":"2012-11-19T00:00:00"},{"y":33,"x":"2012-11-20T00:00:00"},{"y":13,"x":"2012-11-21T00:00:00"},{"y":16,"x":"2012-11-22T00:00:00"},{"y":7,"x":"2012-11-23T00:00:00"},{"y":18,"x":"2012-11-24T00:00:00"},{"y":8,"x":"2012-11-25T00:00:00"}]}],"type":"cumulative","yScale":"linear"},{"xScale":"ordinal","comp":[],"main":[{"className":".main.l1","data":[{"y":12,"x":"2012-11-19T00:00:00"},{"y":18,"x":"2012-11-20T00:00:00"},{"y":8,"x":"2012-11-21T00:00:00"},{"y":7,"x":"2012-11-22T00:00:00"},{"y":6,"x":"2012-11-23T00:00:00"},{"y":12,"x":"2012-11-24T00:00:00"},{"y":8,"x":"2012-11-25T00:00:00"}]},{"className":".main.l2","data":[{"y":29,"x":"2012-11-19T00:00:00"},{"y":33,"x":"2012-11-20T00:00:00"},{"y":13,"x":"2012-11-21T00:00:00"},{"y":16,"x":"2012-11-22T00:00:00"},{"y":7,"x":"2012-11-23T00:00:00"},{"y":18,"x":"2012-11-24T00:00:00"},{"y":8,"x":"2012-11-25T00:00:00"}]}],"type":"bar","yScale":"linear"}]; 4 | var order = [0, 1, 0, 2], 5 | i = 0, 6 | xFormat = d3.time.format('%A'), 7 | chart = new xChart('line-dotted', data[order[i]], '#chart-animated', { 8 | axisPaddingTop: 5, 9 | dataFormatX: function (x) { 10 | return new Date(x); 11 | }, 12 | tickFormatX: function (x) { 13 | return xFormat(x); 14 | }, 15 | timing: 1250 16 | }), 17 | rotateTimer, 18 | toggles = d3.selectAll('.multi button'), 19 | t = 3500; 20 | 21 | function updateChart(i) { 22 | var d = data[i]; 23 | chart.setData(d); 24 | toggles.classed('toggled', function () { 25 | return (d3.select(this).attr('data-type') === d.type); 26 | }); 27 | return d; 28 | } 29 | 30 | toggles.on('click', function (d, i) { 31 | clearTimeout(rotateTimer); 32 | updateChart(i); 33 | }); 34 | 35 | function rotateChart() { 36 | i += 1; 37 | i = (i >= order.length) ? 0 : i; 38 | var d = updateChart(order[i]); 39 | rotateTimer = setTimeout(rotateChart, t); 40 | } 41 | rotateTimer = setTimeout(rotateChart, t); 42 | }()); 43 | 44 | 45 | 46 | // Line Chart 47 | var dataLine = { 48 | "xScale": "time", 49 | "yScale": "linear", 50 | "type": "line", 51 | "main": [ 52 | { 53 | "className": ".pizza", 54 | "data": [ 55 | { 56 | "x": "2012-11-05", 57 | "y": 1 58 | }, 59 | { 60 | "x": "2012-11-06", 61 | "y": 6 62 | }, 63 | { 64 | "x": "2012-11-07", 65 | "y": 13 66 | }, 67 | { 68 | "x": "2012-11-08", 69 | "y": -3 70 | }, 71 | { 72 | "x": "2012-11-09", 73 | "y": -4 74 | }, 75 | { 76 | "x": "2012-11-10", 77 | "y": 9 78 | }, 79 | { 80 | "x": "2012-11-11", 81 | "y": 6 82 | } 83 | ] 84 | } 85 | ] 86 | }; 87 | var opts = { 88 | "dataFormatX": function (x) { return d3.time.format('%Y-%m-%d').parse(x); }, 89 | "tickFormatX": function (x) { return d3.time.format('%A')(x); } 90 | }; 91 | var linechart = new xChart('line', dataLine, '#line-chart', opts); 92 | 93 | // Basic Bar Chart 94 | var dataBar = { 95 | "xScale": "ordinal", 96 | "yScale": "linear", 97 | "main": [ 98 | { 99 | "className": ".pizza", 100 | "data": [ 101 | { 102 | "x": "Pepperoni", 103 | "y": 4 104 | }, 105 | { 106 | "x": "Cheese", 107 | "y": 8 108 | } 109 | ] 110 | } 111 | ] 112 | }; 113 | var myChart = new xChart('bar', dataBar, '#bar-chart'); 114 | 115 | 116 | 117 | //Interacting With Points 118 | var tt = document.createElement('div'), 119 | leftOffset = -(~~$('html').css('padding-left').replace('px', '') + ~~$('body').css('margin-left').replace('px', '')), 120 | topOffset = -32; 121 | tt.className = 'ex-tooltip'; 122 | document.body.appendChild(tt); 123 | 124 | var dataIP = { 125 | "xScale": "time", 126 | "yScale": "linear", 127 | "main": [ 128 | { 129 | "className": ".pizza", 130 | "data": [ 131 | { 132 | "x": "2012-11-05", 133 | "y": 6 134 | }, 135 | { 136 | "x": "2012-11-06", 137 | "y": 6 138 | }, 139 | { 140 | "x": "2012-11-07", 141 | "y": 8 142 | }, 143 | { 144 | "x": "2012-11-08", 145 | "y": 3 146 | }, 147 | { 148 | "x": "2012-11-09", 149 | "y": 4 150 | }, 151 | { 152 | "x": "2012-11-10", 153 | "y": 9 154 | }, 155 | { 156 | "x": "2012-11-11", 157 | "y": 6 158 | } 159 | ] 160 | } 161 | ] 162 | }; 163 | var opts = { 164 | "dataFormatX": function (x) { return d3.time.format('%Y-%m-%d').parse(x); }, 165 | "tickFormatX": function (x) { return d3.time.format('%A')(x); }, 166 | "mouseover": function (d, i) { 167 | var pos = $(this).offset(); 168 | $(tt).text(d3.time.format('%A')(d.x) + ': ' + d.y) 169 | .css({top: topOffset + pos.top, left: pos.left + leftOffset}) 170 | .show(); 171 | }, 172 | "mouseout": function (x) { 173 | $(tt).hide(); 174 | } 175 | }; 176 | var myChart = new xChart('line-dotted', dataIP, '#interacting-points', opts); 177 | 178 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/temp/Bo.java.vm: -------------------------------------------------------------------------------- 1 | package ${package}.po; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | import java.io.Serializable; 7 | import java.util.Date; 8 | #if(${hasBigDecimal}) 9 | import java.math.BigDecimal; 10 | #end 11 | 12 | /** 13 | * ${comment} 14 | * 15 | * @author ${author} 16 | * @mail ${email} 17 | * @since jdk1.8 18 | * @date ${datetime} 19 | */ 20 | @Setter 21 | @Getter 22 | public class ${className}Bo implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | #foreach ($column in $columns) 26 | /** 27 | *$column.columnComment 28 | */ 29 | private $column.attrType $column.attrLittleName; 30 | #end 31 | } 32 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/temp/Controller.java.vm: -------------------------------------------------------------------------------- 1 | package ${package}.controller; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import com.github.mustfun.generator.model.result.Result; 7 | import org.apache.shiro.authz.annotation.RequiresPermissions; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.PathVariable; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RequestParam; 13 | import org.springframework.web.bind.annotation.RestController; 14 | 15 | import ${package}.po.${className}Po; 16 | import ${package}.service.${className}Service; 17 | import ${mainPath}.utils.PageUtils; 18 | import ${mainPath}.utils.Query; 19 | import ${mainPath}.utils.R; 20 | 21 | 22 | 23 | 24 | /** 25 | * ${comment} 26 | * 27 | * @author ${author} 28 | * @email ${email} 29 | * @date ${datetime} 30 | * @since jdk 1.8 31 | */ 32 | @RestController 33 | @RequestMapping("/${pathName}") 34 | public class ${className}Controller { 35 | @Autowired 36 | private ${className}Service ${classLittleName}Service; 37 | 38 | /** 39 | * 分页查询数据 40 | */ 41 | @RequestMapping("/select_paged") 42 | public Result> selectPaged(RowBounds rowBounds){ 43 | Result> pageResult = new Result<>(); 44 | Page<${className}Po> page = ${classLittleName}Service.selectPaged(rowBounds); 45 | pageResult.setData(page); 46 | return pageResult; 47 | } 48 | 49 | /** 50 | * 通过id查询 51 | * @return 52 | */ 53 | @RequestMapping("/select_by_id") 54 | public Result<${className}Po> selectByPrimaryKey(${pk.attrType} ${pk.attrLittleName}){ 55 | Result<${className}Po> result = new Result<>(); 56 | ${className}Po po = ${classLittleName}Service.selectByPrimaryKey(${pk.attrLittleName}); 57 | result.setData(po); 58 | return result; 59 | } 60 | 61 | /** 62 | * 通过ID删除 63 | * @return 64 | */ 65 | @RequestMapping("/delete_by_id") 66 | public Result deleteByPrimaryKey(${pk.attrType} ${pk.attrLittleName}){ 67 | Result result = new Result<>(); 68 | Integer num = ${classLittleName}Service.deleteByPrimaryKey(${pk.attrLittleName}); 69 | result.setData(num); 70 | return result; 71 | } 72 | 73 | /** 74 | * 新增数据 75 | * @return 76 | */ 77 | @RequestMapping("/save_${classLittleName}") 78 | public Result insert(${className}Po ${classLittleName}){ 79 | Result result = new Result<>(); 80 | Integer num = ${classLittleName}Service.insertSelective(${classLittleName}); 81 | result.setData(num); 82 | return result; 83 | } 84 | 85 | /** 86 | * 修改数据 87 | * @return 88 | */ 89 | @RequestMapping("/update_${classLittleName}") 90 | public Integer updateByPrimaryKeySelective(${className}Po ${classLittleName}){ 91 | Result result = new Result<>(); 92 | Integer num = ${classLittleName}Service.updateByPrimaryKeySelective(${classLittleName}); 93 | result.setData(num); 94 | return result; 95 | } 96 | 97 | 98 | /** 99 | * 查询列表 100 | * @return 101 | */ 102 | @RequestMapping("/query_list") 103 | public Result> queryByCondition(${className}Po ${classLittleName}){ 104 | Result> result = new Result<>(); 105 | List<${className}Po> list = ${classLittleName}Service.query(${classLittleName}); 106 | result.setData(list); 107 | return result; 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/temp/Dao.java.vm: -------------------------------------------------------------------------------- 1 | package ${package}.dao; 2 | 3 | import ${package}.po.${className}Po; 4 | import com.github.pagehelper.Page; 5 | import org.apache.ibatis.session.RowBounds; 6 | import org.apache.ibatis.annotations.Mapper; 7 | 8 | /** 9 | * ${comment}的dao层 10 | * 11 | * @author ${author} 12 | * @email ${email} 13 | * @date ${datetime} 14 | * @since jdk1.8 15 | */ 16 | @Mapper 17 | public interface ${className}Dao { 18 | 19 | /**/ 20 | 21 | Page<${className}Po> selectPaged(RowBounds rowBounds); 22 | 23 | ${className}Po selectByPrimaryKey(${pk.attrType} ${pk.attrLittleName}); 24 | 25 | Integer deleteByPrimaryKey(${pk.attrType} ${pk.attrLittleName}); 26 | 27 | Integer insert(${className}Po ${classLittleName}); 28 | 29 | Integer insertSelective(${className}Po ${classLittleName}); 30 | 31 | Integer insertSelectiveIgnore(${className}Po ${classLittleName}); 32 | 33 | Integer updateByPrimaryKeySelective(${className}Po ${classLittleName}); 34 | 35 | Integer updateByPrimaryKey(${className}Po ${classLittleName}); 36 | 37 | Integer batchInsert(List<${className}Po> list); 38 | 39 | Integer batchUpdate(List<${className}Po> list); 40 | 41 | /** 42 | * 存在即更新 43 | * @param map 44 | * @return 45 | */ 46 | Integer upsert(${className}Po ${classLittleName}); 47 | 48 | /** 49 | * 存在即更新,可选择具体属性 50 | * @param map 51 | * @return 52 | */ 53 | Integer upsertSelective(${className}Po ${classLittleName}); 54 | 55 | List<${className}Po> query(${className}Po ${classLittleName}); 56 | 57 | Long queryTotal(); 58 | 59 | Integer deleteBatch(List<${pk.attrType}> list); 60 | 61 | /**/ 62 | 63 | } 64 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/temp/Po.java.vm: -------------------------------------------------------------------------------- 1 | package ${package}.po; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | #if(${hasBigDecimal}) 6 | import java.math.BigDecimal; 7 | #end 8 | 9 | /** 10 | * ${comment} 11 | * 12 | * @author ${author} 13 | * @mail ${email} 14 | * @since jdk1.8 15 | * @date ${datetime} 16 | */ 17 | public class ${className}Po implements Serializable { 18 | private static final long serialVersionUID = 1L; 19 | 20 | #foreach ($column in $columns) 21 | /** 22 | * ${column.columnComment} 23 | */ 24 | private $column.attrType $column.attrLittleName; 25 | #end 26 | 27 | #foreach ($column in $columns) 28 | /** 29 | * ${column.columnComment} 30 | */ 31 | public void set${column.attrName}($column.attrType $column.attrLittleName) { 32 | this.$column.attrLittleName = $column.attrLittleName; 33 | } 34 | /** 35 | * ${column.columnComment} 36 | */ 37 | public $column.attrType get${column.attrName}() { 38 | return $column.attrLittleName; 39 | } 40 | #end 41 | } 42 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/temp/Req.java.vm: -------------------------------------------------------------------------------- 1 | package ${package}.po; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | import java.io.Serializable; 7 | import java.util.Date; 8 | #if(${hasBigDecimal}) 9 | import java.math.BigDecimal; 10 | #end 11 | 12 | /** 13 | * ${comment} 14 | * 15 | * @author ${author} 16 | * @mail ${email} 17 | * @since jdk1.8 18 | * @date ${datetime} 19 | */ 20 | @Setter 21 | @Getter 22 | public class ${className}Req implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | #foreach ($column in $columns) 26 | /** 27 | *$column.columnComment 28 | */ 29 | private $column.attrType $column.attrLittleName; 30 | #end 31 | } 32 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/temp/Resp.java.vm: -------------------------------------------------------------------------------- 1 | package ${package}.po; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | import java.io.Serializable; 7 | import java.util.Date; 8 | #if(${hasBigDecimal}) 9 | import java.math.BigDecimal; 10 | #end 11 | 12 | /** 13 | * ${comment} 14 | * 15 | * @author ${author} 16 | * @mail ${email} 17 | * @since jdk1.8 18 | * @date ${datetime} 19 | */ 20 | @Setter 21 | @Getter 22 | public class ${className}Resp implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | #foreach ($column in $columns) 26 | /** 27 | *$column.columnComment 28 | */ 29 | private $column.attrType $column.attrLittleName; 30 | #end 31 | } 32 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/temp/Result.java.vm: -------------------------------------------------------------------------------- 1 | package com.hujiang.rma.model.dto.result; 2 | 3 | /** 4 | * 返回基类 5 | * 6 | * @author ${author} 7 | * @email ${email} 8 | * @date ${datetime} 9 | * @since jdk 1.8 10 | */ 11 | public class Result implements java.io.Serializable { 12 | 13 | private static final long serialVersionUID = 2120267584344923858L; 14 | 15 | private Integer status = 0; 16 | 17 | private String message = null; 18 | 19 | private T data = null; 20 | 21 | public Result(){ 22 | 23 | } 24 | 25 | public Result(Integer status, String message, T data) { 26 | this.status = status; 27 | this.message = message; 28 | this.data = data; 29 | } 30 | 31 | public Integer getStatus() { 32 | return status; 33 | } 34 | 35 | public void setStatus(Integer status) { 36 | this.status = status; 37 | } 38 | 39 | public String getMessage() { 40 | return message; 41 | } 42 | 43 | public void setMessage(String message) { 44 | this.message = message; 45 | } 46 | 47 | public T getData() { 48 | return data; 49 | } 50 | 51 | public void setData(T data) { 52 | this.data = data; 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return "Result{" + 58 | "status=" + status + 59 | ", message='" + message + '\'' + 60 | ", data=" + data + 61 | '}'; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/temp/Service.java.vm: -------------------------------------------------------------------------------- 1 | package ${package}.service; 2 | 3 | import ${package}.po.${className}Po; 4 | 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | /** 9 | * ${comment} service层 10 | * 11 | * @author ${author} 12 | * @email ${email} 13 | * @date ${datetime} 14 | * @since jdk 1.8 15 | */ 16 | public interface ${className}Service { 17 | 18 | /**/ 19 | 20 | Page<${className}Po> selectPaged(RowBounds rowBounds); 21 | 22 | ${className}Po selectByPrimaryKey(${pk.attrType} ${pk.attrLittleName}); 23 | 24 | Integer deleteByPrimaryKey(${pk.attrType} ${pk.attrLittleName}); 25 | 26 | Integer insert(${className}Po ${classLittleName}); 27 | 28 | Integer insertSelective(${className}Po ${classLittleName}); 29 | 30 | Integer insertSelectiveIgnore(${className}Po ${classLittleName}); 31 | 32 | Integer updateByPrimaryKeySelective(${className}Po ${classLittleName}); 33 | 34 | Integer updateByPrimaryKey(${className}Po ${classLittleName}); 35 | 36 | Integer batchInsert(List<${className}Po> list); 37 | 38 | Integer batchUpdate(List<${className}Po> list); 39 | 40 | /** 41 | * 存在即更新 42 | * @param map 43 | * @return 44 | */ 45 | Integer upsert(${className}Po ${classLittleName}); 46 | 47 | /** 48 | * 存在即更新,可选择具体属性 49 | * @param map 50 | * @return 51 | */ 52 | Integer upsertSelective(${className}Po ${classLittleName}); 53 | 54 | List<${className}Po> query(${className}Po ${classLittleName}); 55 | 56 | Long queryTotal(); 57 | 58 | Integer deleteBatch(List<${pk.attrType}> list); 59 | 60 | /**/ 61 | 62 | } 63 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/temp/ServiceImpl.java.vm: -------------------------------------------------------------------------------- 1 | package ${package}.service.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import ${package}.dao.${className}Dao; 10 | import ${package}.po.${className}Po; 11 | import ${package}.service.${className}Service; 12 | 13 | 14 | /** 15 | * ${comment} 16 | * 17 | * @author ${author} 18 | * @email ${email} 19 | * @date ${datetime} 20 | * @since jdk 1.8 21 | */ 22 | @Service("${classLittleName}Service") 23 | public class ${className}ServiceImpl implements ${className}Service { 24 | /**/ 25 | 26 | @Autowired 27 | public ${className}Dao ${classLittleName}Dao; 28 | 29 | 30 | 31 | @Override 32 | public Page<${className}Po> selectPaged(RowBounds rowBounds){ 33 | return ${classLittleName}Dao.selectPaged(rowBounds); 34 | } 35 | 36 | @Override 37 | public ${className}Po selectByPrimaryKey(${pk.attrType} ${pk.attrLittleName}){ 38 | return ${classLittleName}Dao.selectByPrimaryKey(${pk.attrLittleName}); 39 | } 40 | 41 | @Override 42 | public Integer deleteByPrimaryKey(${pk.attrType} ${pk.attrLittleName}){ 43 | return ${classLittleName}Dao.deleteByPrimaryKey(${pk.attrLittleName}); 44 | } 45 | 46 | @Override 47 | public Integer insert(${className}Po ${classLittleName}){ 48 | return ${classLittleName}Dao.insert(${classLittleName}); 49 | } 50 | 51 | @Override 52 | public Integer insertSelective(${className}Po ${classLittleName}){ 53 | return ${classLittleName}Dao.insertSelective(${classLittleName}); 54 | } 55 | 56 | @Override 57 | public Integer insertSelectiveIgnore(${className}Po ${classLittleName}){ 58 | return ${classLittleName}Dao.insertSelectiveIgnore(${classLittleName}); 59 | } 60 | 61 | @Override 62 | public Integer updateByPrimaryKeySelective(${className}Po ${classLittleName}){ 63 | return ${classLittleName}Dao.updateByPrimaryKeySelective(${classLittleName}); 64 | } 65 | 66 | @Override 67 | public Integer updateByPrimaryKey(${className}Po ${classLittleName}){ 68 | return ${classLittleName}Dao.updateByPrimaryKey(${classLittleName}); 69 | } 70 | 71 | @Override 72 | public Integer batchInsert(List<${className}Po> list){ 73 | return ${classLittleName}Dao.batchInsert(list); 74 | } 75 | 76 | @Override 77 | public Integer batchUpdate(List<${className}Po> list){ 78 | return ${classLittleName}Dao.batchUpdate(list); 79 | } 80 | 81 | /** 82 | * 存在即更新 83 | * @param map 84 | * @return 85 | */ 86 | @Override 87 | public Integer upsert(${className}Po ${classLittleName}){ 88 | return ${classLittleName}Dao.upsert(${classLittleName}); 89 | } 90 | 91 | /** 92 | * 存在即更新,可选择具体属性 93 | * @param map 94 | * @return 95 | */ 96 | @Override 97 | public Integer upsertSelective(${className}Po ${classLittleName}){ 98 | return ${classLittleName}Dao.upsertSelective(${classLittleName}); 99 | } 100 | 101 | @Override 102 | public List<${className}Po> query(${className}Po ${classLittleName}){ 103 | return ${classLittleName}Dao.query(${classLittleName}); 104 | } 105 | 106 | @Override 107 | public Long queryTotal(){ 108 | return ${classLittleName}Dao.queryTotal(); 109 | } 110 | 111 | @Override 112 | public Integer deleteBatch(List<${pk.attrType}> list){ 113 | return ${classLittleName}Dao.deleteBatch(list); 114 | } 115 | 116 | /**/ 117 | 118 | } 119 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/templates/common/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/templates/common/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/templates/common/loading.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/templates/common/receource.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 数据生成脚本 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/templates/common/scripts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/templates/common/sidebar.html: -------------------------------------------------------------------------------- 1 | 2 | 22 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/templates/core/configList.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 系统配置 25 | 26 | 系统配置 27 | 配置列表 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 预计加入一些常用的配置,待完善,如作者、日期,默认包名、默认路径等 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 126 | 127 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/templates/core/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 强大的模板管理,生成属于你需要的代码 25 | 点击左侧开始 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/templates/core/templateList.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 模板列表 24 | 25 | 26 | 27 | 模板名称 28 | 模板描述 29 | 创建人 30 | 模板类型 31 | 数据库类型 32 | 操作 33 | 34 | 35 | 36 | 37 | 38 | 39 | Eclair 40 | Eclair 41 | 42 | $0.87 43 | 44 | 45 | $0.87 46 | 47 | 48 | 49 | 选择这个 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 138 | 139 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/templates/core/ui-modals.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Modals | Materialize - Material Design Admin Template 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/templates/page-404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 404 Error Page | Materialize - Material Design Admin Template 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | Sorry but we couldn’t find this page :( 75 | 76 | 77 | 78 | 404 79 | 80 | 81 | It seems that this page doesn’t exist. 82 | Back Homepage 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/templates/page-500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 500 Error Page | Materialize - Material Design Admin Template 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | Internal server error 74 | 75 | 76 | 77 | 500 78 | 79 | 80 | Something has gone seriously wrong. Please try later. 81 | Back Homepage 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/templates/page-lock-screen.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Lock Screen Page | Materialize - Material Design Admin Template 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | John Doe 65 | 66 | 67 | 68 | 69 | 70 | 71 | Password 72 | 73 | 74 | 75 | 76 | Login 77 | 78 | 79 | 80 | 81 | Register Now! 82 | 83 | 84 | Forgot password ? 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/templates/page-login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Login Page | Materialize - Material Design Admin Template 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | Material Design Admin Template 65 | 66 | 67 | 68 | 69 | 70 | 71 | Username 72 | 73 | 74 | 75 | 76 | 77 | 78 | Password 79 | 80 | 81 | 82 | 83 | 84 | Remember me 85 | 86 | 87 | 88 | 89 | Login 90 | 91 | 92 | 93 | 94 | Register Now! 95 | 96 | 97 | Forgot password ? 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /mybatis-generator-web-biz/src/main/resources/templates/page-register.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Register Page | Materialize - Material Design Admin Template 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | Register 64 | Join to our community now ! 65 | 66 | 67 | 68 | 69 | 70 | 71 | Username 72 | 73 | 74 | 75 | 76 | 77 | 78 | Email 79 | 80 | 81 | 82 | 83 | 84 | 85 | Password 86 | 87 | 88 | 89 | 90 | 91 | 92 | Password again 93 | 94 | 95 | 96 | 97 | Register Now 98 | 99 | 100 | Already have an account? Login 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /mybatis-generator-web-business/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | mybatis-generator-web-parent 5 | com.github.mustfun 6 | 1.0.0-SNAPSHOT 7 | ../mybatis-generator-web-parent/pom.xml 8 | 9 | 4.0.0 10 | 11 | mybatis-generator-web-business 12 | jar 13 | 14 | mybatis-generator-web-business 15 | http://maven.apache.org 16 | 17 | 18 | 19 | com.github.mustfun 20 | mybatis-generator-web-service 21 | 1.0.0-SNAPSHOT 22 | 23 | 24 | 25 | 26 | UTF-8 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /mybatis-generator-web-business/src/main/java/com/github/mustfun/generator/business/App.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.business; 2 | 3 | /** 4 | * Hello world! 5 | * 6 | */ 7 | public class App 8 | { 9 | public static void main( String[] args ) 10 | { 11 | System.out.println( "Hello World!" ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /mybatis-generator-web-config/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | mybatis-generator-web-parent 5 | com.github.mustfun 6 | 1.0.0-SNAPSHOT 7 | ../mybatis-generator-web-parent/pom.xml 8 | 9 | 4.0.0 10 | 11 | mybatis-generator-web-config 12 | jar 13 | 14 | mybatis-generator-web-config 15 | mustfun.github.io 16 | 17 | 18 | 19 | com.alibaba 20 | druid 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | org.mybatis.generator 31 | mybatis-generator-maven-plugin 32 | 1.3.6 33 | 34 | 35 | 36 | ${basedir}/src/main/resources/mybatis/generatorConfig.xml 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /mybatis-generator-web-config/src/main/java/com/github/mustfun/generator/config/App.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.config; 2 | 3 | /** 4 | * Hello world! 5 | * 6 | */ 7 | public class App 8 | { 9 | public static void main( String[] args ) 10 | { 11 | System.out.println( "Hello World!" ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /mybatis-generator-web-config/src/main/resources/config/application-dev.yml: -------------------------------------------------------------------------------- 1 | database: 2 | druid: 3 | druid: 4 | name: Master 5 | master: 6 | druid: 7 | connectionProperties: connectTimeout=3000;config.decrypt=true 8 | driverClassName: org.sqlite.JDBC 9 | filters: stat,wall,config 10 | initialSize: 3 11 | maxActive: 15 12 | maxWait: 30000 13 | minEvictableIdleTimeMillis: 300000 14 | minIdle: 2 15 | password: bNVOqb7WKLX5Bjnw+LMv92taj25KOxDimXxILPQjw42wgv+1lHzOH8kr97xDwWdhpY67QuYCS7sWN4W46YbkFA== 16 | testOnBorrow: false 17 | testOnReturn: false 18 | testWhileIdle: true 19 | url: jdbc:sqlite:generate_web.db 20 | useUnfairLock: true 21 | validationQuery: select 1 22 | validationQueryTimeout: 2000 23 | logging: 24 | level: 25 | root: INFO 26 | mq: 27 | name: Master 28 | mybatis: 29 | config-location: classpath:mybatis/mybatis-config.xml 30 | mapper-locations: classpath*:/mybatis/mapper/*Mapper.xml 31 | type-aliases-package: com.github.mustfun.generator.dao.mapper #指定别名的包名 32 | # type-handlers-package: com.github.mustfun.generator.dao.mapper #预处理sql用的包 33 | server: 34 | port: 8080 35 | 36 | spring: 37 | thymeleaf: 38 | cache: false 39 | prefix: classpath:/templates/ 40 | suffix: .html 41 | encoding: UTF-8 42 | content-type: text/html 43 | mode: HTML 44 | cache: 45 | jcache: 46 | config: classpath:ehcache.xml 47 | 48 | #关闭healthcheck 49 | endpoints: 50 | health: 51 | enabled: false -------------------------------------------------------------------------------- /mybatis-generator-web-config/src/main/resources/config/application-pre.yml: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /mybatis-generator-web-config/src/main/resources/config/application-prod.yml: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /mybatis-generator-web-config/src/main/resources/config/application-qa.yml: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /mybatis-generator-web-config/src/main/resources/ehcache.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 2000 16 | 17 | 18 | 19 | 20 | 21 | 600 22 | 23 | 24 | -------------------------------------------------------------------------------- /mybatis-generator-web-config/src/main/resources/generator/generator-config.properties: -------------------------------------------------------------------------------- 1 | #\u4EE3\u7801\u751F\u6210\u5668\uFF0C\u914D\u7F6E\u4FE1\u606F 2 | mainPath=com.github.mustfun 3 | #\u5305\u540D 4 | package=com.github.mustfun 5 | #\u4F5C\u8005 6 | author=itar 7 | #Email 8 | email=wuhandzy@gmail.com 9 | #\u8868\u524D\u7F00(\u7C7B\u540D\u4E0D\u4F1A\u5305\u542B\u8868\u524D\u7F00) 10 | tablePrefix=t_ 11 | 12 | #\u7C7B\u578B\u8F6C\u6362\uFF0C\u914D\u7F6E\u4FE1\u606F 13 | TINYINT=Integer 14 | SMALLINT=Integer 15 | MEDIUMINT=Integer 16 | INT=Integer 17 | INTEGER=Integer 18 | BIGINT\ UNSIGNED=Long 19 | BIGINT\ SIGNED=Long 20 | BIGINT=Long 21 | FLOAT=Float 22 | DOUBLE=Double 23 | DECIMAL=BigDecimal 24 | BIT=Boolean 25 | 26 | CHAR=String 27 | VARCHAR=String 28 | TINYTEXT=String 29 | TEXT=String 30 | MEDIUMTEXT=String 31 | LONGTEXT=String 32 | 33 | DATE=Date 34 | DATETIME=Date 35 | TIMESTAMP=Date -------------------------------------------------------------------------------- /mybatis-generator-web-config/src/main/resources/import.sql: -------------------------------------------------------------------------------- 1 | create table db_source 2 | ( 3 | id INTEGER 4 | primary key 5 | autoincrement, 6 | db_name varchar(20), 7 | db_address varchar(40), 8 | user_name varchar(40), 9 | password varchar(40), 10 | create_time datetime 11 | ) 12 | ; 13 | 14 | 15 | create table template 16 | ( 17 | id INTEGER not null 18 | primary key 19 | autoincrement, 20 | tep_name VARCHAR(40), 21 | tep_desc varchar(40), 22 | tep_content TEXT, 23 | create_by VARCHAR(40), 24 | vm_type INTEGER, 25 | db_type INTEGER, 26 | create_time timestamp 27 | ); -------------------------------------------------------------------------------- /mybatis-generator-web-config/src/main/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | true 9 | 10 | ${pattern} 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /mybatis-generator-web-config/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ${log.base}/biwan.log 16 | 17 | ${log.base}/%d{yyyy-MM-dd}/root.%d{yyyy-MM-dd}-%i.log 18 | 90 19 | 20 | 150MB 21 | 22 | 23 | 24 | ${pattern} 25 | 26 | 27 | 28 | 29 | 30 | 31 | ${log.base}/jdbc.log 32 | 33 | ${log.base}/%d{yyyy-MM-dd}/jdbc.%d{yyyy-MM-dd}-%i.log 34 | 90 35 | 36 | 150MB 37 | 38 | 39 | 40 | ${pattern} 41 | 42 | 43 | 44 | 45 | 46 | 47 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /mybatis-generator-web-config/src/main/resources/mybatis/generatorConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /mybatis-generator-web-config/src/main/resources/mybatis/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /mybatis-generator-web-config/src/main/resources/mybatis/spring-mybatis.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | MyBatis配置 10 | 11 | 12 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /mybatis-generator-web-dao/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | mybatis-generator-web-parent 5 | com.github.mustfun 6 | 1.0.0-SNAPSHOT 7 | ../mybatis-generator-web-parent/pom.xml 8 | 9 | 4.0.0 10 | 11 | mybatis-generator-web-dao 12 | jar 13 | 14 | mybatis-generator-web-dao-dao 15 | http://maven.apache.org 16 | 17 | 18 | 19 | com.github.mustfun 20 | mybatis-generator-web-model 21 | 1.0.0-SNAPSHOT 22 | 23 | 24 | 25 | 26 | 27 | cglib 28 | cglib 29 | 3.1 30 | 31 | 32 | 33 | 34 | org.mybatis.spring.boot 35 | mybatis-spring-boot-starter 36 | 37 | 38 | 39 | 40 | junit 41 | junit 42 | test 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /mybatis-generator-web-dao/src/main/java/com/github/mustfun/generator/dao/mapper/CityMapper.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.dao.mapper; 2 | 3 | import com.github.mustfun.generator.model.po.City; 4 | import org.apache.ibatis.annotations.Mapper; 5 | 6 | @Mapper //这个注解会被注册为一个实现类,但是需要sqlSessionFactory,但是这里的sqlSessionFactory我们没有给他指认,所以会是默认的,我们需要给他分库后的 7 | public interface CityMapper { 8 | /** 9 | * This method was generated by MyBatis Generator. 10 | * This method corresponds to the database table city 11 | * 12 | * @mbggenerated 13 | */ 14 | int deleteByPrimaryKey(Integer id); 15 | 16 | /** 17 | * This method was generated by MyBatis Generator. 18 | * This method corresponds to the database table city 19 | * 20 | * @mbggenerated 21 | */ 22 | int insert(City record); 23 | 24 | /** 25 | * This method was generated by MyBatis Generator. 26 | * This method corresponds to the database table city 27 | * 28 | * @mbggenerated 29 | */ 30 | int insertSelective(City record); 31 | 32 | /** 33 | * This method was generated by MyBatis Generator. 34 | * This method corresponds to the database table city 35 | * 36 | * @mbggenerated 37 | */ 38 | City selectByPrimaryKey(Integer id); 39 | 40 | /** 41 | * This method was generated by MyBatis Generator. 42 | * This method corresponds to the database table city 43 | * 44 | * @mbggenerated 45 | */ 46 | int updateByPrimaryKeySelective(City record); 47 | 48 | /** 49 | * This method was generated by MyBatis Generator. 50 | * This method corresponds to the database table city 51 | * 52 | * @mbggenerated 53 | */ 54 | int updateByPrimaryKey(City record); 55 | } -------------------------------------------------------------------------------- /mybatis-generator-web-dao/src/main/java/com/github/mustfun/generator/dao/mapper/DbSourceMapper.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.dao.mapper; 2 | 3 | import com.github.mustfun.generator.model.po.City; 4 | import com.github.mustfun.generator.model.po.DbSourcePo; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | 9 | @Mapper //这个注解会被注册为一个实现类,但是需要sqlSessionFactory,但是这里的sqlSessionFactory我们没有给他指认,所以会是默认的,我们需要给他分库后的 10 | public interface DbSourceMapper { 11 | 12 | int deleteByPrimaryKey(Integer id); 13 | 14 | 15 | int insertSelective(DbSourcePo record); 16 | 17 | DbSourcePo selectByPrimaryKey(Integer id); 18 | 19 | 20 | int updateByPrimaryKeySelective(DbSourcePo record); 21 | 22 | 23 | int updateByPrimaryKey(DbSourcePo record); 24 | 25 | List queryList(); 26 | } -------------------------------------------------------------------------------- /mybatis-generator-web-dao/src/main/java/com/github/mustfun/generator/dao/mapper/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.dao.mapper; 2 | 3 | import com.github.mustfun.generator.model.po.Order; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | @Mapper //这个注解会被注册为一个实现类,但是需要sqlSessionFactory,但是这里的sqlSessionFactory我们没有给他指认,所以会是默认的,我们需要给他分库后的 10 | public interface OrderMapper { 11 | 12 | Order selectByPrimaryKey(@Param("id") Integer id); 13 | 14 | List selectByIdList(List ids); 15 | 16 | 17 | } -------------------------------------------------------------------------------- /mybatis-generator-web-dao/src/main/java/com/github/mustfun/generator/dao/mapper/TemplateMapper.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.dao.mapper; 2 | 3 | import com.github.mustfun.generator.model.po.Template; 4 | import com.github.mustfun.generator.model.po.Template; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | 9 | @Mapper 10 | public interface TemplateMapper { 11 | 12 | int deleteByPrimaryKey(Integer id); 13 | 14 | 15 | int insertSelective(Template record); 16 | 17 | Template selectByPrimaryKey(Integer id); 18 | 19 | 20 | int updateByPrimaryKeySelective(Template record); 21 | 22 | 23 | List queryList(); 24 | } -------------------------------------------------------------------------------- /mybatis-generator-web-dao/src/main/resources/mybatis/mapper/dbSourceMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | id, db_name, db_address,user_name,password,create_time 14 | 15 | 16 | 20 | select 21 | 22 | from db_source 23 | where id = #{id,jdbcType=INTEGER} 24 | 25 | 26 | select 27 | 28 | from db_source 29 | 30 | 31 | 35 | delete from db_source 36 | where id = #{id,jdbcType=INTEGER} 37 | 38 | 39 | 40 | 44 | insert into db_source 45 | 46 | 47 | id, 48 | 49 | 50 | db_name, 51 | 52 | 53 | 54 | db_address, 55 | 56 | 57 | user_name, 58 | 59 | 60 | password, 61 | 62 | 63 | 64 | 65 | #{id}, 66 | 67 | 68 | #{dbName}, 69 | 70 | 71 | #{dbAddress}, 72 | 73 | 74 | #{userName}, 75 | 76 | 77 | #{password}, 78 | 79 | 80 | 81 | 82 | 86 | update db_source 87 | 88 | 89 | name = #{name,jdbcType=VARCHAR}, 90 | 91 | 92 | state = #{state,jdbcType=VARCHAR}, 93 | 94 | 95 | country = #{country,jdbcType=VARCHAR}, 96 | 97 | 98 | where id = #{id,jdbcType=INTEGER} 99 | 100 | 101 | 105 | update db_source 106 | set name = #{name,jdbcType=VARCHAR}, 107 | state = #{state,jdbcType=VARCHAR}, 108 | country = #{country,jdbcType=VARCHAR} 109 | where id = #{id,jdbcType=INTEGER} 110 | 111 | -------------------------------------------------------------------------------- /mybatis-generator-web-dao/src/main/resources/mybatis/mapper/orderMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | order_id, user_id, create_time 12 | 13 | 14 | select 15 | 16 | from t_order 17 | where order_id = #{id,jdbcType=INTEGER} 18 | 19 | 20 | 21 | select 22 | from t_order 23 | WHERE order_id in 24 | 25 | 26 | ${item} 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /mybatis-generator-web-dao/src/main/resources/mybatis/mapper/templateMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | id, tep_name, tep_desc,create_by,tep_content,vm_type,db_type,create_time 16 | 17 | 18 | 19 | select 20 | 21 | from template 22 | where id = #{id,jdbcType=INTEGER} 23 | 24 | 25 | select 26 | 27 | from template 28 | 29 | 30 | 31 | delete from template 32 | where id = #{id,jdbcType=INTEGER} 33 | 34 | 35 | 36 | insert into template 37 | 38 | 39 | id, 40 | 41 | 42 | tep_name, 43 | 44 | 45 | tep_desc, 46 | 47 | 48 | tep_content, 49 | 50 | 51 | vm_type, 52 | 53 | 54 | db_type, 55 | 56 | 57 | create_by, 58 | 59 | 60 | create_time, 61 | 62 | 63 | 64 | 65 | #{id}, 66 | 67 | 68 | #{tepName}, 69 | 70 | 71 | #{tepDesc}, 72 | 73 | 74 | #{tepContent}, 75 | 76 | 77 | #{vmType}, 78 | 79 | 80 | #{dbType}, 81 | 82 | 83 | #{createBy}, 84 | 85 | 86 | #{createTime}, 87 | 88 | 89 | 90 | 91 | 92 | update template 93 | 94 | 95 | id = #{id}, 96 | 97 | 98 | tep_name = #{tepName}, 99 | 100 | 101 | tep_content =#{tepContent}, 102 | 103 | 104 | tep_desc=#{tepDesc}, 105 | 106 | 107 | vm_type=#{vmType}, 108 | 109 | 110 | db_type=#{dbType}, 111 | 112 | 113 | create_by=#{createBy}, 114 | 115 | 116 | create_time=#{createTime}, 117 | 118 | 119 | where id = #{id,jdbcType=INTEGER} 120 | 121 | -------------------------------------------------------------------------------- /mybatis-generator-web-facade/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | mybatis-generator-web-parent 5 | com.github.mustfun 6 | 1.0.0-SNAPSHOT 7 | ../mybatis-generator-web-parent/pom.xml 8 | 9 | 4.0.0 10 | 11 | mybatis-generator-web-facade 12 | jar 13 | 14 | mybatis-generator-web-facade 15 | http://maven.apache.org 16 | 17 | 18 | UTF-8 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /mybatis-generator-web-facade/src/main/java/com/github/mustfun/generator/facade/App.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.facade; 2 | 3 | /** 4 | * Hello world! 5 | * 6 | */ 7 | public class App 8 | { 9 | public static void main( String[] args ) 10 | { 11 | System.out.println( "Hello World!" ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /mybatis-generator-web-model/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | mybatis-generator-web-parent 5 | com.github.mustfun 6 | 1.0.0-SNAPSHOT 7 | ../mybatis-generator-web-parent/pom.xml 8 | 9 | 4.0.0 10 | 11 | mybatis-generator-web-model 12 | jar 13 | 14 | mybatis-generator-web-model 15 | http://www.biwan.com 16 | 17 | 18 | 19 | com.github.mustfun 20 | mybatis-generator-web-config 21 | 1.0.0-SNAPSHOT 22 | 23 | 24 | 25 | org.projectlombok 26 | lombok 27 | 28 | 29 | com.google.guava 30 | guava 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /mybatis-generator-web-model/src/main/java/com/github/mustfun/generator/model/constants/FileConstants.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.model.constants; 2 | 3 | /** 4 | * @author dengzhiyuan 5 | * @version 1.0 6 | * @date 2018/4/16 7 | * @since 1.0 8 | */ 9 | public class FileConstants { 10 | 11 | public static final String TEMP_DB_CONFIG_DB = "temp/dbConfig.db"; 12 | } 13 | -------------------------------------------------------------------------------- /mybatis-generator-web-model/src/main/java/com/github/mustfun/generator/model/enums/DbTypeEnums.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.model.enums; 2 | 3 | /** 4 | * @author dengzhiyuan 5 | * @version 1.0 6 | * @date 2018/5/17 7 | * @since 1.0 8 | */ 9 | public enum DbTypeEnums { 10 | MYSQL(1,"MYSQL数据库"); 11 | 12 | private Integer code; 13 | private String mgs; 14 | 15 | DbTypeEnums(Integer code, String mgs) { 16 | this.code = code; 17 | this.mgs = mgs; 18 | } 19 | 20 | public Integer getCode() { 21 | return code; 22 | } 23 | 24 | public void setCode(Integer code) { 25 | this.code = code; 26 | } 27 | 28 | public String getMgs() { 29 | return mgs; 30 | } 31 | 32 | public void setMgs(String mgs) { 33 | this.mgs = mgs; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /mybatis-generator-web-model/src/main/java/com/github/mustfun/generator/model/enums/VmTypeEnums.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.model.enums; 2 | 3 | /** 4 | * @author dengzhiyuan 5 | * @version 1.0 6 | * @date 2018/5/17 7 | * @since 1.0 8 | */ 9 | public enum VmTypeEnums { 10 | DAO(1,"DAO层"), 11 | CONTROLLER(2,"Controller层"), 12 | CONTROLLER_IMPL(10,"ControllerImpl实现层"), 13 | SERVICE(3,"Service层"), 14 | SERVICE_IMPL(9,"ServiceImpl实现层"), 15 | MAPPER(4,"Mapper文件"), 16 | MODEL_PO(5,"Po层"), 17 | MODEL_BO(6,"Bo层"), 18 | MODEL_REQ(7,"请求Model层"), 19 | MODEL_RESP(8,"返回Model层"), 20 | RESULT(11,"Result层"); 21 | 22 | private Integer code; 23 | private String mgs; 24 | 25 | VmTypeEnums(Integer code, String mgs) { 26 | this.code = code; 27 | this.mgs = mgs; 28 | } 29 | 30 | public Integer getCode() { 31 | return code; 32 | } 33 | 34 | public void setCode(Integer code) { 35 | this.code = code; 36 | } 37 | 38 | public String getMgs() { 39 | return mgs; 40 | } 41 | 42 | public void setMgs(String mgs) { 43 | this.mgs = mgs; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /mybatis-generator-web-model/src/main/java/com/github/mustfun/generator/model/po/City.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.model.po; 2 | 3 | public class City { 4 | /** 5 | * This field was generated by MyBatis Generator. 6 | * This field corresponds to the database column city.id 7 | * 8 | * @mbggenerated 9 | */ 10 | private Integer id; 11 | 12 | /** 13 | * This field was generated by MyBatis Generator. 14 | * This field corresponds to the database column city.name 15 | * 16 | * @mbggenerated 17 | */ 18 | private String name; 19 | 20 | /** 21 | * This field was generated by MyBatis Generator. 22 | * This field corresponds to the database column city.state 23 | * 24 | * @mbggenerated 25 | */ 26 | private String state; 27 | 28 | /** 29 | * This field was generated by MyBatis Generator. 30 | * This field corresponds to the database column city.country 31 | * 32 | * @mbggenerated 33 | */ 34 | private String country; 35 | 36 | /** 37 | * This method was generated by MyBatis Generator. 38 | * This method returns the value of the database column city.id 39 | * 40 | * @return the value of city.id 41 | * 42 | * @mbggenerated 43 | */ 44 | public Integer getId() { 45 | return id; 46 | } 47 | 48 | /** 49 | * This method was generated by MyBatis Generator. 50 | * This method sets the value of the database column city.id 51 | * 52 | * @param id the value for city.id 53 | * 54 | * @mbggenerated 55 | */ 56 | public void setId(Integer id) { 57 | this.id = id; 58 | } 59 | 60 | /** 61 | * This method was generated by MyBatis Generator. 62 | * This method returns the value of the database column city.name 63 | * 64 | * @return the value of city.name 65 | * 66 | * @mbggenerated 67 | */ 68 | public String getName() { 69 | return name; 70 | } 71 | 72 | /** 73 | * This method was generated by MyBatis Generator. 74 | * This method sets the value of the database column city.name 75 | * 76 | * @param name the value for city.name 77 | * 78 | * @mbggenerated 79 | */ 80 | public void setName(String name) { 81 | this.name = name == null ? null : name.trim(); 82 | } 83 | 84 | /** 85 | * This method was generated by MyBatis Generator. 86 | * This method returns the value of the database column city.state 87 | * 88 | * @return the value of city.state 89 | * 90 | * @mbggenerated 91 | */ 92 | public String getState() { 93 | return state; 94 | } 95 | 96 | /** 97 | * This method was generated by MyBatis Generator. 98 | * This method sets the value of the database column city.state 99 | * 100 | * @param state the value for city.state 101 | * 102 | * @mbggenerated 103 | */ 104 | public void setState(String state) { 105 | this.state = state == null ? null : state.trim(); 106 | } 107 | 108 | /** 109 | * This method was generated by MyBatis Generator. 110 | * This method returns the value of the database column city.country 111 | * 112 | * @return the value of city.country 113 | * 114 | * @mbggenerated 115 | */ 116 | public String getCountry() { 117 | return country; 118 | } 119 | 120 | /** 121 | * This method was generated by MyBatis Generator. 122 | * This method sets the value of the database column city.country 123 | * 124 | * @param country the value for city.country 125 | * 126 | * @mbggenerated 127 | */ 128 | public void setCountry(String country) { 129 | this.country = country == null ? null : country.trim(); 130 | } 131 | } -------------------------------------------------------------------------------- /mybatis-generator-web-model/src/main/java/com/github/mustfun/generator/model/po/DbConfigPo.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.model.po; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | /** 7 | * @author dengzhiyuan 8 | * @version 1.0 9 | * @date 2018/4/13 10 | * @since 1.0 11 | */ 12 | @Setter 13 | @Getter 14 | public class DbConfigPo { 15 | private String address; 16 | private String dbName; 17 | private String userName; 18 | private String password; 19 | 20 | @Override 21 | public String toString() { 22 | final StringBuilder sb = new StringBuilder("{"); 23 | sb.append("\"address\":\"") 24 | .append(address).append('\"'); 25 | sb.append(",\"dbName\":\"") 26 | .append(dbName).append('\"'); 27 | sb.append(",\"userName\":\"") 28 | .append(userName).append('\"'); 29 | sb.append(",\"password\":\"") 30 | .append(password).append('\"'); 31 | sb.append('}'); 32 | return sb.toString(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /mybatis-generator-web-model/src/main/java/com/github/mustfun/generator/model/po/DbSourcePo.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.model.po; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | import java.util.Date; 7 | 8 | /** 9 | * @author dengzhiyuan 10 | * @version 1.0 11 | * @date 2018/5/16 12 | * @since 1.0 13 | */ 14 | @Setter 15 | @Getter 16 | public class DbSourcePo { 17 | private Integer id; 18 | private String userName; 19 | private String dbAddress; 20 | private String password; 21 | private String dbName; 22 | private Date createTime; 23 | } 24 | -------------------------------------------------------------------------------- /mybatis-generator-web-model/src/main/java/com/github/mustfun/generator/model/po/LocalColumn.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.model.po; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | /** 7 | * @author dengzhiyuan 8 | * @version 1.0 9 | * @date 2018/4/16 10 | * @since 1.0 11 | */ 12 | @Setter 13 | @Getter 14 | public class LocalColumn { 15 | private String columnName; 16 | private String dataType; 17 | private String columnComment; 18 | private Integer size; 19 | private Boolean nullable; 20 | private Integer position; 21 | 22 | private String extra; 23 | private String jpaColumnDefinition; 24 | private String attrName; 25 | private String attrLittleName; 26 | 27 | private String attrType; 28 | private String pk; 29 | private String columnKey; 30 | } 31 | -------------------------------------------------------------------------------- /mybatis-generator-web-model/src/main/java/com/github/mustfun/generator/model/po/LocalTable.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.model.po; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author dengzhiyuan 10 | * @version 1.0 11 | * @date 2018/4/16 12 | * @since 1.0 13 | */ 14 | @Setter 15 | @Getter 16 | public class LocalTable { 17 | private Integer id; 18 | private String tableName; 19 | private String tableType; 20 | private String comment; 21 | private String className; 22 | private String classLittleName; 23 | private List columnList; 24 | 25 | private LocalColumn pk; 26 | } 27 | -------------------------------------------------------------------------------- /mybatis-generator-web-model/src/main/java/com/github/mustfun/generator/model/po/Order.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.model.po; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * @author dengzhiyuan 7 | * @version 1.0 8 | * @date 2017/4/26 9 | * @since 1.0 10 | */ 11 | public class Order { 12 | private Long orderId; 13 | 14 | private Long userId; 15 | 16 | private Date createTime; 17 | 18 | public Long getOrderId() { 19 | return orderId; 20 | } 21 | 22 | public void setOrderId(Long orderId) { 23 | this.orderId = orderId; 24 | } 25 | 26 | public Long getUserId() { 27 | return userId; 28 | } 29 | 30 | public void setUserId(Long userId) { 31 | this.userId = userId; 32 | } 33 | 34 | public Date getCreateTime() { 35 | return createTime; 36 | } 37 | 38 | public void setCreateTime(Date createTime) { 39 | this.createTime = createTime; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /mybatis-generator-web-model/src/main/java/com/github/mustfun/generator/model/po/Template.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.model.po; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | import java.util.Date; 7 | 8 | /** 9 | * @author dengzhiyuan 10 | * @version 1.0 11 | * @date 2018/5/16 12 | * @since 1.0 13 | */ 14 | 15 | @Setter 16 | @Getter 17 | public class Template { 18 | 19 | private Integer id; 20 | private String tepName; 21 | private String tepDesc; 22 | private String tepContent; 23 | private String createBy; 24 | /** 25 | * 模板类型 26 | */ 27 | private Integer vmType; 28 | /** 29 | * db类型 30 | */ 31 | private Integer dbType; 32 | private Date createTime; 33 | } 34 | -------------------------------------------------------------------------------- /mybatis-generator-web-model/src/main/java/com/github/mustfun/generator/model/result/Result.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.model.result; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author dengzhiyuan 7 | * @version 1.0 8 | * @date 2017/8/22 9 | * @since 1.0 10 | */ 11 | public class Result implements Serializable { 12 | 13 | private static final long serialVersionUID = 2120267584344923858L; 14 | 15 | private Integer status = 0; 16 | 17 | private String message = null; 18 | 19 | private T data = null; 20 | 21 | public Result(){ 22 | 23 | } 24 | 25 | public Result(Integer status, String message, T data) { 26 | this.status = status; 27 | this.message = message; 28 | this.data = data; 29 | } 30 | 31 | public static Result ok(){ 32 | Result result = new Result<>(); 33 | result.setStatus(0); 34 | result.setMessage("success"); 35 | return result; 36 | } 37 | 38 | public Result put(T t){ 39 | this.setData(t); 40 | return this; 41 | } 42 | 43 | public Integer getStatus() { 44 | return status; 45 | } 46 | 47 | public void setStatus(Integer status) { 48 | this.status = status; 49 | } 50 | 51 | public String getMessage() { 52 | return message; 53 | } 54 | 55 | public void setMessage(String message) { 56 | this.message = message; 57 | } 58 | 59 | public T getData() { 60 | return data; 61 | } 62 | 63 | public void setData(T data) { 64 | this.data = data; 65 | } 66 | 67 | @Override 68 | public String toString() { 69 | return "Result{" + 70 | "status=" + status + 71 | ", message='" + message + '\'' + 72 | ", data=" + data + 73 | '}'; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /mybatis-generator-web-service/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | mybatis-generator-web-parent 5 | com.github.mustfun 6 | 1.0.0-SNAPSHOT 7 | ../mybatis-generator-web-parent/pom.xml 8 | 9 | 4.0.0 10 | 11 | mybatis-generator-web-service 12 | jar 13 | 14 | mybatis-generator-web-service 15 | mustfun.github.io 16 | 17 | 18 | 19 | 20 | com.github.mustfun 21 | mybatis-generator-web-support 22 | 1.0.0-SNAPSHOT 23 | 24 | 25 | com.github.mustfun 26 | mybatis-generator-web-config 27 | 1.0.0-SNAPSHOT 28 | 29 | 30 | 31 | 32 | com.github.mustfun 33 | mybatis-generator-web-dao 34 | 1.0.0-SNAPSHOT 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /mybatis-generator-web-service/src/main/java/com/github/mustfun/generator/service/DbSourceService.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.service; 2 | 3 | import com.github.mustfun.generator.model.po.DbSourcePo; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by dengzhiyuan on 2017/4/6. 9 | */ 10 | public interface DbSourceService { 11 | DbSourcePo getOne(Integer id); 12 | 13 | Boolean saveDbConfig(DbSourcePo dbSourcePo); 14 | 15 | List queryList(); 16 | } 17 | -------------------------------------------------------------------------------- /mybatis-generator-web-service/src/main/java/com/github/mustfun/generator/service/ExtApiService.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.service; 2 | 3 | import com.github.mustfun.generator.model.po.DbSourcePo; 4 | import com.github.mustfun.generator.model.po.LocalTable; 5 | import com.github.mustfun.generator.model.po.Template; 6 | import com.github.mustfun.generator.support.result.BaseResult; 7 | 8 | import java.sql.Connection; 9 | import java.util.List; 10 | 11 | /** 12 | * @author dengzhiyuan 13 | * @version 1.0 14 | * @date 2018/4/13 15 | * @since 1.0 16 | */ 17 | public interface ExtApiService { 18 | BaseResult saveDbConfig(DbSourcePo dbSourcePo); 19 | 20 | List getTables(Connection connection); 21 | 22 | void initDb(DbSourcePo dbConfigPos); 23 | 24 | byte[] generateCode(List tableNames, String packageName, String address, List vmList); 25 | 26 | BaseResult saveTemplate(Template dbSourcePo); 27 | 28 | BaseResult deleteTemplate(Integer dbSourcePo); 29 | 30 | BaseResult updateTemplate(Template template); 31 | } 32 | -------------------------------------------------------------------------------- /mybatis-generator-web-service/src/main/java/com/github/mustfun/generator/service/OrderService.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.service; 2 | 3 | import com.github.mustfun.generator.model.po.Order; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by dengzhiyuan on 2017/4/6. 9 | */ 10 | public interface OrderService { 11 | Order getOne(Integer id); 12 | 13 | List selectByIdList(List ids); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /mybatis-generator-web-service/src/main/java/com/github/mustfun/generator/service/TemplateService.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.service; 2 | 3 | import com.github.mustfun.generator.model.po.DbSourcePo; 4 | import com.github.mustfun.generator.model.po.Template; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by itar on 2017/4/6. 10 | */ 11 | public interface TemplateService { 12 | Template getOne(Integer id); 13 | 14 | Boolean saveTemplate(Template dbSourcePo); 15 | 16 | List queryList(); 17 | 18 | Boolean deleteTemplate(Integer id); 19 | 20 | Boolean updateTemplate(Template template); 21 | } 22 | -------------------------------------------------------------------------------- /mybatis-generator-web-service/src/main/java/com/github/mustfun/generator/service/impl/DbSourceServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.service.impl; 2 | 3 | import com.github.mustfun.generator.dao.mapper.DbSourceMapper; 4 | import com.github.mustfun.generator.model.po.DbSourcePo; 5 | import com.github.mustfun.generator.service.DbSourceService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by dengzhiyuan on 2017/4/6. 13 | */ 14 | @Service 15 | public class DbSourceServiceImpl implements DbSourceService { 16 | 17 | @Autowired 18 | private DbSourceMapper dbSourceMapper; 19 | 20 | 21 | @Override 22 | public DbSourcePo getOne(Integer id) { 23 | return dbSourceMapper.selectByPrimaryKey(id); 24 | } 25 | 26 | @Override 27 | public Boolean saveDbConfig(DbSourcePo dbSourcePo) { 28 | return dbSourceMapper.insertSelective(dbSourcePo)==1; 29 | } 30 | 31 | @Override 32 | public List queryList() { 33 | return dbSourceMapper.queryList(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /mybatis-generator-web-service/src/main/java/com/github/mustfun/generator/service/impl/OrderServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.service.impl; 2 | 3 | import com.github.mustfun.generator.dao.mapper.OrderMapper; 4 | import com.github.mustfun.generator.model.po.Order; 5 | import com.github.mustfun.generator.service.OrderService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by dengzhiyuan on 2017/4/6. 13 | */ 14 | @Service 15 | public class OrderServiceImpl implements OrderService { 16 | 17 | @Autowired 18 | private OrderMapper orderMapper; 19 | 20 | @Override 21 | public Order getOne(Integer id) { 22 | return orderMapper.selectByPrimaryKey(id); 23 | } 24 | 25 | @Override 26 | public List selectByIdList(List ids) { 27 | return orderMapper.selectByIdList(ids); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /mybatis-generator-web-service/src/main/java/com/github/mustfun/generator/service/impl/TemplateServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.service.impl; 2 | 3 | import com.github.mustfun.generator.dao.mapper.TemplateMapper; 4 | import com.github.mustfun.generator.model.po.Template; 5 | import com.github.mustfun.generator.service.TemplateService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by itar on 2017/4/6. 13 | */ 14 | @Service 15 | public class TemplateServiceImpl implements TemplateService { 16 | 17 | @Autowired 18 | private TemplateMapper dbSourceMapper; 19 | 20 | 21 | @Override 22 | public Template getOne(Integer id) { 23 | return dbSourceMapper.selectByPrimaryKey(id); 24 | } 25 | 26 | @Override 27 | public Boolean saveTemplate(Template dbSourcePo) { 28 | return dbSourceMapper.insertSelective(dbSourcePo)==1; 29 | } 30 | 31 | @Override 32 | public List queryList() { 33 | return dbSourceMapper.queryList(); 34 | } 35 | 36 | @Override 37 | public Boolean deleteTemplate(Integer id) { 38 | return dbSourceMapper.deleteByPrimaryKey(id)==1; 39 | } 40 | 41 | @Override 42 | public Boolean updateTemplate(Template template) { 43 | return dbSourceMapper.updateByPrimaryKeySelective(template)==1; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | mybatis-generator-web-parent 5 | com.github.mustfun 6 | 1.0.0-SNAPSHOT 7 | ../mybatis-generator-web-parent/pom.xml 8 | 9 | 4.0.0 10 | 11 | mybatis-generator-web-support 12 | jar 13 | 14 | mybatis-generator-web-support 15 | mustfun.github.io 16 | 17 | 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter 22 | 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-web 27 | 28 | 29 | 30 | org.mybatis.spring.boot 31 | mybatis-spring-boot-starter 32 | 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-starter-actuator 37 | 38 | 39 | 40 | org.springframework.boot 41 | spring-boot-starter-undertow 42 | 43 | 44 | 45 | org.springframework.boot 46 | spring-boot-starter-aop 47 | 48 | 49 | org.springframework.boot 50 | spring-boot-starter-data-redis 51 | 52 | 53 | org.springframework.boot 54 | spring-boot-starter-thymeleaf 55 | 56 | 57 | org.springframework.boot 58 | spring-boot-starter-test 59 | test 60 | 61 | 62 | 63 | mysql 64 | mysql-connector-java 65 | 66 | 67 | 68 | commons-dbutils 69 | commons-dbutils 70 | 71 | 72 | 73 | commons-io 74 | commons-io 75 | 76 | 77 | com.google.guava 78 | guava 79 | 80 | 81 | org.apache.velocity 82 | velocity 83 | 84 | 85 | 86 | commons-configuration 87 | commons-configuration 88 | 89 | 90 | com.alibaba 91 | druid 92 | 93 | 94 | 95 | org.projectlombok 96 | lombok 97 | 98 | 99 | 100 | io.shardingjdbc 101 | sharding-jdbc-core 102 | 103 | 104 | 105 | 106 | org.xerial 107 | sqlite-jdbc 108 | 109 | 110 | 111 | 112 | 113 | com.alibaba 114 | fastjson 115 | 116 | 117 | 118 | org.springframework.boot 119 | spring-boot-starter-cache 120 | 121 | 122 | 123 | javax.cache 124 | cache-api 125 | 126 | 127 | 128 | org.ehcache 129 | ehcache 130 | 131 | 132 | 133 | junit 134 | junit 135 | 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/src/main/java/com/github/mustfun/generator/support/config/AbstractDataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.support.config; 2 | 3 | import com.alibaba.druid.filter.logging.Slf4jLogFilter; 4 | import com.alibaba.druid.pool.DruidDataSource; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | import java.util.Arrays; 10 | 11 | /** 12 | * Created by dengzhiyuan on 2017/4/10. 13 | */ 14 | @Configuration 15 | @EnableConfigurationProperties({DruidConfig.class,SlaveDruidConfig.class}) 16 | //这个就相当于把DruidConfig也注入了,那边没有注入 17 | public class AbstractDataSourceConfig { 18 | 19 | 20 | 21 | @Autowired 22 | private Slf4jLogFilter slf4jLogFilter; 23 | 24 | public DruidDataSource initDataBase(BaseDruidConfig druidConfig) throws Exception{ 25 | 26 | DruidDataSource datasource = new DruidDataSource(); 27 | 28 | datasource.setUrl(druidConfig.getUrl()); 29 | datasource.setUsername(druidConfig.getUsername()); 30 | datasource.setPassword(druidConfig.getPassword()); 31 | datasource.setDriverClassName(druidConfig.getDriverClassName()); 32 | datasource.setInitialSize(druidConfig.getInitialSize()); 33 | datasource.setMinIdle(druidConfig.getMinIdle()); 34 | datasource.setMaxActive(druidConfig.getMaxActive()); 35 | datasource.setMaxWait(druidConfig.getMaxWait()); 36 | datasource.setTimeBetweenEvictionRunsMillis(druidConfig.getTimeBetweenEvictionRunsMillis()); 37 | datasource.setMinEvictableIdleTimeMillis(druidConfig.getMinEvictableIdleTimeMillis()); 38 | datasource.setValidationQuery(druidConfig.getValidationQuery()); 39 | //sqllite指定 40 | datasource.setDbType("sqlserver"); 41 | /* 42 | datasource.setTestWhileIdle(druidConfig.get); 43 | datasource.setTestOnBorrow(druidConfig.gette); 44 | datasource.setTestOnReturn(testOnReturn); 45 | datasource.setPoolPreparedStatements(druidConfig.getpo); 46 | datasource.setMaxOpenPreparedStatements(druidConfig.); 47 | */ 48 | //设置druid监控 49 | datasource.setFilters(druidConfig.getFilters()); 50 | //设置druid日志 51 | datasource.setProxyFilters(Arrays.asList(slf4jLogFilter)); 52 | 53 | datasource.setMaxPoolPreparedStatementPerConnectionSize(druidConfig.getMaxPoolPreparedStatementPerConnectionSize()); 54 | datasource.setConnectionProperties(druidConfig.getConnectionProperties()); 55 | datasource.setConnectionProperties(druidConfig.getConnectionProperties()); 56 | return datasource; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/src/main/java/com/github/mustfun/generator/support/config/DruidConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.support.config; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | 7 | /** 8 | * Created by dengzhiyuan on 2017/4/5. 9 | */ 10 | @ConfigurationProperties(prefix = "database.master.druid") //这个注解只是把属性设置进去,还达不到注入要求,要么加一个@configuration,要么加个@Component 11 | public class DruidConfig extends BaseDruidConfig{ 12 | 13 | private Logger logger = LoggerFactory.getLogger(getClass()); 14 | 15 | public DruidConfig(){ 16 | logger.info("druid正在初始化中====={主写数据库}",getMaxActive()); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/src/main/java/com/github/mustfun/generator/support/config/DruidOtherConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.support.config; 2 | 3 | import com.alibaba.druid.filter.logging.Slf4jLogFilter; 4 | import com.alibaba.druid.support.http.StatViewServlet; 5 | import com.alibaba.druid.support.http.WebStatFilter; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.boot.web.servlet.FilterRegistrationBean; 8 | import org.springframework.boot.web.servlet.ServletRegistrationBean; 9 | import org.springframework.context.annotation.Bean; 10 | import org.springframework.context.annotation.Configuration; 11 | 12 | /** 13 | * Created by dengzhiyuan on 2017/4/10. 14 | */ 15 | @Configuration 16 | public class DruidOtherConfig { 17 | 18 | private transient org.slf4j.Logger resultsetLogger = LoggerFactory.getLogger("com.alibaba.druid.resultset"); 19 | private transient org.slf4j.Logger statementLogger = LoggerFactory.getLogger("com.alibaba.druid.statement"); 20 | private transient org.slf4j.Logger datasourceLogger = LoggerFactory.getLogger("com.alibaba.druid.datasource"); 21 | private transient org.slf4j.Logger connectionLogger = LoggerFactory.getLogger("com.alibaba.druid.connection"); 22 | 23 | 24 | 25 | /** 26 | * 本次日志用slf4jFilter,因为用的logback 27 | * 重新定义一下logger的名称,这样就可以在logback重新定制新的logger名称 28 | * @return 29 | */ 30 | @Bean 31 | public Slf4jLogFilter slf4jLogFilter(){ 32 | Slf4jLogFilter slf4jLogFilter=new Slf4jLogFilter(); 33 | slf4jLogFilter.setResultSetLogEnabled(true); 34 | slf4jLogFilter.setStatementLogEnabled(true); 35 | slf4jLogFilter.setConnectionLogEnabled(true); 36 | slf4jLogFilter.setDataSourceLogEnabled(true); 37 | slf4jLogFilter.setResultSetLogger(resultsetLogger); 38 | slf4jLogFilter.setDataSourceLogger(datasourceLogger); 39 | slf4jLogFilter.setStatementLogger(statementLogger); 40 | slf4jLogFilter.setConnectionLogger(connectionLogger); 41 | return slf4jLogFilter; 42 | } 43 | 44 | /** 45 | * 注册一个StatViewServlet 46 | * @return 47 | */ 48 | @Bean 49 | public ServletRegistrationBean druidStatViewServlet(){ 50 | 51 | //org.springframework.boot.context.embedded.ServletRegistrationBean提供类的进行注册. 52 | ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(),"/druid/*"); 53 | //白名单: 54 | servletRegistrationBean.addInitParameter("allow","127.0.0.1"); 55 | //IP黑名单 (存在共同时,deny优先于allow) : 如果满足deny的话提示:Sorry, you are not permitted to view this page. 56 | servletRegistrationBean.addInitParameter("deny","192.168.1.73"); 57 | //登录查看信息的账号密码. 58 | servletRegistrationBean.addInitParameter("loginUsername","admin"); 59 | servletRegistrationBean.addInitParameter("loginPassword","admin"); 60 | //是否能够重置数据. 61 | servletRegistrationBean.addInitParameter("resetEnable","false"); 62 | return servletRegistrationBean; 63 | } 64 | 65 | /** 66 | * 注册一个:filterRegistrationBean 67 | * @return 68 | */ 69 | @Bean 70 | public FilterRegistrationBean druidStatFilter(){ 71 | 72 | FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter()); 73 | //添加过滤规则. 74 | filterRegistrationBean.addUrlPatterns("/*"); 75 | //添加不需要忽略的格式信息. 76 | filterRegistrationBean.addInitParameter("exclusions","*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid2/*"); 77 | return filterRegistrationBean; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/src/main/java/com/github/mustfun/generator/support/config/MasterDataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.support.config; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.context.annotation.Primary; 10 | 11 | import javax.sql.DataSource; 12 | 13 | /** 14 | * Created by dengzhiyuan on 2017/4/6. 15 | */ 16 | @Configuration //本分支sharding-jdbc-4测试分库分表,读写分离先去除 17 | @EnableConfigurationProperties(DruidConfig.class) //这个就相当于把DruidConfig也注入了,那边没有注入 18 | public class MasterDataSourceConfig extends AbstractDataSourceConfig{ 19 | 20 | private static final Logger logger= LoggerFactory.getLogger(MasterDataSourceConfig.class); 21 | 22 | @Autowired 23 | private DruidConfig druidConfig; 24 | 25 | 26 | /** 27 | * 这个可以自己注入,也可以让spring帮助我们注入,自己可以注入多个 28 | */ 29 | @Bean(name="dataSource", initMethod = "init", destroyMethod = "close") //也可以为master 30 | @Primary //Spring优先选择被该注解所标记的数据源 //放在这里是因为在初始化的时候必须要指定一个,不然很多地方会注入失败 31 | public DataSource dataSource() throws Exception{ 32 | logger.info("master 写数据库 DataSource正在初始化........"); 33 | return initDataBase(druidConfig); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/src/main/java/com/github/mustfun/generator/support/config/MasterSlaveDataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.support.config; 2 | 3 | import io.shardingjdbc.core.api.MasterSlaveDataSourceFactory; 4 | import io.shardingjdbc.core.api.config.MasterSlaveRuleConfiguration; 5 | import org.springframework.boot.autoconfigure.AutoConfigureAfter; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | import javax.annotation.Resource; 10 | import javax.sql.DataSource; 11 | import java.sql.SQLException; 12 | import java.util.*; 13 | 14 | /** 15 | * Created by dengzhiyuan on 2017/4/25. 16 | */ 17 | @Configuration 18 | @AutoConfigureAfter(value = {MasterDataSourceConfig.class,SlaveDataSourceConfig.class}) 19 | public class MasterSlaveDataSourceConfig { 20 | 21 | /** 22 | * @return 读写分离配置,本配置不涉及到分库分表 23 | */ 24 | //@Autowired //这个注解是根据类型进行装配的,我们这类要根据名称进行装配,所以只能用@Resource 25 | @Resource 26 | private DataSource masterWriteDataSource; 27 | 28 | @Resource 29 | private DataSource slaveWriteDataSource; 30 | 31 | 32 | /** 33 | * sharding-jdbc不支持sqllite 34 | * @return 35 | *//* 36 | @Bean(name = "dataSource") 37 | public DataSource dataSource(){ 38 | 39 | // 构建读写分离数据源, 读写分离数据源实现了DataSource接口, 可直接当做数据源处理. masterDataSource, slaveDataSource0, slaveDataSource1等为使用DBCP等连接池配置的真实数据源 40 | Map dataSourceMap = new HashMap<>(); 41 | dataSourceMap.put("masterDataSource", masterWriteDataSource); 42 | dataSourceMap.put("slaveDataSource0", slaveWriteDataSource); 43 | 44 | // 构建读写分离配置 45 | MasterSlaveRuleConfiguration masterSlaveRuleConfig = new MasterSlaveRuleConfiguration(); 46 | masterSlaveRuleConfig.setName("ms_ds_config"); 47 | masterSlaveRuleConfig.setMasterDataSourceName("masterDataSource"); 48 | masterSlaveRuleConfig.getSlaveDataSourceNames().add("slaveDataSource0"); 49 | 50 | 51 | DataSource dataSource = null; 52 | try { 53 | dataSource = MasterSlaveDataSourceFactory.createDataSource(dataSourceMap, masterSlaveRuleConfig,new HashMap<>()); 54 | } catch (SQLException e) { 55 | e.printStackTrace(); 56 | } 57 | return dataSource; 58 | }*/ 59 | } 60 | 61 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/src/main/java/com/github/mustfun/generator/support/config/MybatisConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.support.config; 2 | 3 | import org.apache.ibatis.session.SqlSessionFactory; 4 | import org.mybatis.spring.SqlSessionFactoryBean; 5 | import org.mybatis.spring.annotation.MapperScan; 6 | import org.mybatis.spring.boot.autoconfigure.MybatisProperties; 7 | import org.mybatis.spring.boot.autoconfigure.SpringBootVFS; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.boot.autoconfigure.AutoConfigureAfter; 12 | import org.springframework.context.annotation.Bean; 13 | import org.springframework.context.annotation.Configuration; 14 | import org.springframework.context.annotation.ImportResource; 15 | import org.springframework.core.io.ResourceLoader; 16 | import org.springframework.util.ObjectUtils; 17 | import org.springframework.util.StringUtils; 18 | 19 | import javax.annotation.Resource; 20 | import javax.sql.DataSource; 21 | 22 | /** 23 | * Created by dengzhiyuan on 2017/4/5. 24 | */ 25 | 26 | //@ConditionalOnBean(DruidDataSource.class) //只有这个bean存在的时候才会实例化 27 | 28 | //ImportResource注解会把需要实例化的东西实例化,其实不是很需要 29 | //但是在这里面可以配置sqlSessionFactroy等,事务等 30 | @ImportResource("classpath:/mybatis/spring-mybatis.xml") 31 | 32 | //会去扫描mapper下面的文件夹,已经配置在了application.properties中,所以也不是很需要 33 | //@MapperScan(basePackages = "com.github.mustfun.mapper") 34 | 35 | 36 | @Configuration 37 | @AutoConfigureAfter(MasterSlaveDataSourceConfig.class) //读写分离的时候请打开 38 | //@AutoConfigureAfter(ShardingDataSouceConfig.class) // 分库分表的时候请打开 39 | @MapperScan("com.github.mustfun.generator.dao.mapper") 40 | public class MybatisConfig { 41 | 42 | Logger LOG= LoggerFactory.getLogger(MybatisConfig.class); 43 | 44 | //已经使用的读写分离的数据源了 45 | //@Autowired //这个注解是根据类型进行装配的,我们这类要根据名称进行装配,所以只能用@Resource 46 | @Resource 47 | private DataSource dataSource; 48 | 49 | @Autowired 50 | private MybatisProperties properties; //这个其实mybatis已经帮我们弄好了,直接拿出来 51 | 52 | 53 | /** 54 | * 55 | * 参数给mybatis指定数据源,指定地址等 56 | * @return 57 | * @throws Exception 58 | * 59 | * 事实下面写了这么多真的没啥卵用,没啥卵用,没啥卵用,因为Spring会自动把 druid dataSource给mybatis,知道吗? 60 | * 但是可以适当的做一些定制化 61 | * @see org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration 62 | */ 63 | @Bean 64 | //@ConditionalOnMissingBean //全文只需要一个sqlSessionFactory,所以只能用这个,意思是说当bean missing的时候就进行注入 65 | //@ConditionalOnBean(name = "dataSource") 66 | public SqlSessionFactory sqlSessionFactory(ResourceLoader resourceLoader) throws Exception{ 67 | LOG.info("~~~~~~~~~~使用了我重新定义的数据源sqlSessionFactory~~~~~~~~~~~~~~"); 68 | SqlSessionFactoryBean factory = new SqlSessionFactoryBean(); 69 | factory.setDataSource(dataSource); 70 | factory.setVfs(SpringBootVFS.class); 71 | 72 | if (StringUtils.hasText(this.properties.getConfigLocation())) { 73 | factory.setConfigLocation(resourceLoader.getResource(this.properties.getConfigLocation())); 74 | } 75 | 76 | factory.setConfiguration(properties.getConfiguration()); 77 | if (this.properties.getConfigurationProperties() != null) { 78 | factory.setConfigurationProperties(this.properties.getConfigurationProperties()); 79 | } 80 | if (StringUtils.hasLength(this.properties.getTypeAliasesPackage())) { 81 | factory.setTypeAliasesPackage(this.properties.getTypeAliasesPackage()); 82 | } 83 | if (StringUtils.hasLength(this.properties.getTypeHandlersPackage())) { 84 | factory.setTypeHandlersPackage(this.properties.getTypeHandlersPackage()); 85 | } 86 | if (!ObjectUtils.isEmpty(this.properties.resolveMapperLocations())) { 87 | factory.setMapperLocations(this.properties.resolveMapperLocations()); 88 | } 89 | 90 | return factory.getObject(); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/src/main/java/com/github/mustfun/generator/support/config/SlaveDataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.support.config; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.context.annotation.Primary; 10 | 11 | import javax.sql.DataSource; 12 | 13 | /** 14 | * Created by dengzhiyuan on 2017/4/10. 15 | */ 16 | //@Configuration 本分支sharding-jdbc-4测试分库分表,读写分离先去除 17 | @EnableConfigurationProperties(SlaveDruidConfig.class) 18 | public class SlaveDataSourceConfig extends AbstractDataSourceConfig{ 19 | 20 | private static final Logger logger= LoggerFactory.getLogger(SlaveDataSourceConfig.class); 21 | 22 | 23 | @Autowired 24 | private SlaveDruidConfig slaveDruidConfig; 25 | 26 | /* 27 | *//** 28 | * 这个可以自己注入,也可以让spring帮助我们注入,自己可以注入多个 29 | *//* 30 | @Bean(name="masterReadDataSource", initMethod = "init", destroyMethod = "close") //也可以为master 31 | public DataSource masterReadDataSource() throws Exception{ 32 | logger.info("master 读数据库 datasource正在初始化中..."); 33 | return initDataBase(slaveDruidConfig); 34 | } 35 | 36 | @Bean(name="slaveReadDataSource", initMethod = "init", destroyMethod = "close") //也可以为master 37 | public DataSource slaveReadDataSource() throws Exception{ 38 | logger.info("slave 读数据库 datasource正在初始化中..."); 39 | return initDataBase(slaveDruidConfig); 40 | }*/ 41 | } 42 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/src/main/java/com/github/mustfun/generator/support/config/SlaveDruidConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.support.config; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | 7 | /** 8 | * Created by dengzhiyuan on 2017/4/5. 9 | */ 10 | @ConfigurationProperties(prefix = "database.slave.druid") //这个注解只是把属性设置进去,还达不到注入要求,要么加一个@configuration,要么加个@Component 11 | public class SlaveDruidConfig extends BaseDruidConfig{ 12 | 13 | private Logger logger = LoggerFactory.getLogger(getClass()); 14 | 15 | public SlaveDruidConfig(){ 16 | logger.info("druid正在初始化中====={slave数据库}",getMaxActive()); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/src/main/java/com/github/mustfun/generator/support/handler/ConnectionHolder.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.support.handler; 2 | 3 | import org.springframework.util.DigestUtils; 4 | 5 | import java.sql.Connection; 6 | import java.util.concurrent.ConcurrentHashMap; 7 | 8 | /** 9 | * @author dengzhiyuan 10 | * @version 1.0 11 | * @date 2018/4/16 12 | * @since 1.0 13 | */ 14 | public class ConnectionHolder { 15 | 16 | private static ConcurrentHashMap connectionMap=new ConcurrentHashMap<>(4); 17 | 18 | 19 | public static void addConnection(String key,Connection connection){ 20 | String digest = DigestUtils.md5DigestAsHex(key.getBytes()); 21 | connectionMap.put(digest, connection); 22 | } 23 | 24 | public static Connection getConnection(String key){ 25 | return connectionMap.get(DigestUtils.md5DigestAsHex(key.getBytes())); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/src/main/java/com/github/mustfun/generator/support/handler/SpringContextHolder.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.support.handler; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * @author dengzhiyuan 10 | * @version 1.0 11 | * @date 2018/5/22 12 | * @since 1.0 13 | */ 14 | @Component 15 | public class SpringContextHolder implements ApplicationContextAware { 16 | private static ApplicationContext applicationContext; 17 | 18 | /** 19 | * 获取Bean 20 | * 21 | * @param beanType bean类型 22 | * @return 23 | */ 24 | public static T getBean(Class beanType) { 25 | return applicationContext.getBean(beanType); 26 | } 27 | 28 | /** 29 | * 获取Bean 30 | * 31 | * @param beanName bean名称 32 | * @param beanType bean类型 33 | * @return 34 | */ 35 | public static T getBean(String beanName, Class beanType) { 36 | return applicationContext.getBean(beanName, beanType); 37 | } 38 | 39 | 40 | /* (non-Javadoc) 41 | * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) 42 | */ 43 | @Override 44 | public void setApplicationContext(ApplicationContext ctx) throws BeansException { 45 | applicationContext = ctx; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/src/main/java/com/github/mustfun/generator/support/result/BaseResult.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.support.result; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by dengzhiyuan on 2017/4/6. 7 | */ 8 | public class BaseResult implements Serializable { 9 | 10 | private static final long serialVersionUID = 2120267584344923858L; 11 | 12 | private Integer status = 0; 13 | 14 | private String message = null; 15 | 16 | private T data = null; 17 | 18 | public BaseResult(){ 19 | 20 | } 21 | 22 | public BaseResult(Integer status, String message, T data) { 23 | this.status = status; 24 | this.message = message; 25 | this.data = data; 26 | } 27 | 28 | public Integer getStatus() { 29 | return status; 30 | } 31 | 32 | public void setStatus(Integer status) { 33 | this.status = status; 34 | } 35 | 36 | public String getMessage() { 37 | return message; 38 | } 39 | 40 | public void setMessage(String message) { 41 | this.message = message; 42 | } 43 | 44 | public T getData() { 45 | return data; 46 | } 47 | 48 | public void setData(T data) { 49 | this.data = data; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "Result{" + 55 | "status=" + status + 56 | ", message='" + message + '\'' + 57 | ", data=" + data + 58 | '}'; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/src/main/java/com/github/mustfun/generator/support/transcation/TransactionConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.support.transcation; 2 | 3 | import com.github.mustfun.generator.support.config.MasterSlaveDataSourceConfig; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.beans.factory.annotation.Qualifier; 8 | import org.springframework.boot.autoconfigure.AutoConfigureAfter; 9 | import org.springframework.context.annotation.Bean; 10 | import org.springframework.context.annotation.Configuration; 11 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; 12 | import org.springframework.transaction.PlatformTransactionManager; 13 | import org.springframework.transaction.annotation.EnableTransactionManagement; 14 | 15 | import javax.sql.DataSource; 16 | 17 | /** 18 | * Created by dengzhiyuan on 2017/4/26. 19 | * @EnableTransactionManagement 启注解事务管理,等同于xml配置方式的 20 | * {@link //docs.spring.io/spring/docs/current/javadoc-api/org/springframework/transaction/annotation/EnableTransactionManagement.html} 21 | */ 22 | @Configuration 23 | @EnableTransactionManagement 24 | //@AutoConfigureAfter(MasterSlaveDataSourceConfig.class) 25 | public class TransactionConfig { 26 | 27 | Logger LOG= LoggerFactory.getLogger(TransactionConfig.class); 28 | 29 | @Autowired 30 | @Qualifier(value = "dataSource") 31 | private DataSource dataSource; 32 | 33 | @Bean 34 | public PlatformTransactionManager txManager(){ 35 | LOG.info("启用我们自己的事务管理器"); 36 | return new DataSourceTransactionManager(dataSource); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/src/main/java/com/github/mustfun/generator/support/util/DateUtils.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.support.util; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | /** 7 | * @author dengzhiyuan 8 | * @version 1.0 9 | * @date 2018/4/13 10 | * @since 1.0 11 | */ 12 | public class DateUtils { 13 | /** 时间格式(yyyy-MM-dd) */ 14 | public final static String DATE_PATTERN = "yyyy-MM-dd"; 15 | /** 时间格式(yyyy-MM-dd HH:mm:ss) */ 16 | public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; 17 | 18 | public static String format(Date date) { 19 | return format(date, DATE_PATTERN); 20 | } 21 | 22 | public static String format(Date date, String pattern) { 23 | if(date != null){ 24 | SimpleDateFormat df = new SimpleDateFormat(pattern); 25 | return df.format(date); 26 | } 27 | return null; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/src/main/java/com/github/mustfun/generator/support/util/DbUtil.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.support.util; 2 | 3 | import java.sql.Connection; 4 | import java.sql.DriverManager; 5 | import java.sql.SQLException; 6 | import java.util.Properties; 7 | 8 | /** 9 | * @author dengzhiyuan 10 | * @version 1.0 11 | * @date 2018/4/13 12 | * @since 1.0 13 | */ 14 | public class DbUtil { 15 | private String url; 16 | private String username; 17 | private String password; 18 | 19 | public DbUtil(String url,String dbName,String userName,String password){ 20 | this.url = "jdbc:mysql://"+url+":3306/"+dbName+"?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false"; 21 | this.username = userName; 22 | this.password = password; 23 | } 24 | 25 | 26 | public Connection getConnection() { 27 | Connection conn = null; 28 | try { 29 | Class.forName("com.mysql.jdbc.Driver"); 30 | } catch (ClassNotFoundException e) { 31 | e.printStackTrace(); 32 | } 33 | Properties props =new Properties(); 34 | props.setProperty("user", username); 35 | props.setProperty("password", password); 36 | //设置可以获取remarks信息 37 | props.setProperty("remarks", "true"); 38 | //设置可以获取tables remarks信息 39 | props.setProperty("useInformationSchema", "true"); 40 | try { 41 | conn = DriverManager.getConnection(url, props); 42 | } catch (SQLException e) { 43 | e.printStackTrace(); 44 | } 45 | return conn; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /mybatis-generator-web-support/src/main/java/com/github/mustfun/generator/support/web/WebConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.support.web; 2 | 3 | import com.alibaba.fastjson.serializer.SerializerFeature; 4 | import com.alibaba.fastjson.support.config.FastJsonConfig; 5 | import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter4; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.http.converter.HttpMessageConverter; 9 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 10 | 11 | import java.nio.charset.Charset; 12 | import java.util.List; 13 | 14 | /** 15 | * @author dengzhiyuan 16 | * @version 1.0 17 | * @date 2017/4/26 18 | * @since 1.0 19 | */ 20 | @Configuration 21 | public class WebConfig extends WebMvcConfigurerAdapter {//继承了这个类有什么用? 22 | 23 | @Bean 24 | public HttpMessageConverter httpMessageConverter(){ 25 | FastJsonConfig fastJsonConfig =new FastJsonConfig(); 26 | fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteMapNullValue); 27 | FastJsonHttpMessageConverter4 fastJsonHttpMessageConverter4 = new FastJsonHttpMessageConverter4(); 28 | fastJsonHttpMessageConverter4.setFastJsonConfig(fastJsonConfig); 29 | fastJsonHttpMessageConverter4.setDefaultCharset(Charset.forName("UTF-8")); 30 | //fastJsonHttpMessageConverter4.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON_UTF8,MediaType.APPLICATION_JSON)); 31 | return fastJsonHttpMessageConverter4; 32 | } 33 | 34 | @Override 35 | public void configureMessageConverters(List> converters) { 36 | converters.add(httpMessageConverter()); 37 | super.configureMessageConverters(converters); 38 | } 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /mybatis-generator-web-test/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | mybatis-generator-web-parent 5 | com.github.mustfun 6 | 1.0.0-SNAPSHOT 7 | ../mybatis-generator-web-parent/pom.xml 8 | 9 | 4.0.0 10 | 11 | mybatis-generator-web-test 12 | jar 13 | 14 | mybatis-generator-web-test 15 | http://maven.apache.org 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | com.github.mustfun 25 | mybatis-generator-web-biz 26 | 1.0.0-SNAPSHOT 27 | 28 | 29 | 30 | org.springframework.boot 31 | spring-boot-starter-test 32 | 33 | 34 | 35 | 36 | javax.servlet 37 | javax.servlet-api 38 | 39 | 40 | 41 | 42 | junit 43 | junit 44 | compile 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /mybatis-generator-web-test/src/main/java/com/github/mustfun/generator/test/DataBaseTools.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.test; 2 | 3 | import com.alibaba.druid.filter.config.ConfigTools; 4 | import org.junit.Test; 5 | 6 | /** 7 | * @author dengzhiyuan 8 | * @version 1.0 9 | * @date 2017/8/22 10 | * @since 1.0 11 | */ 12 | public class DataBaseTools { 13 | 14 | //囧,也可以直接使用命令行 15 | // Java -cp druid-0.2.23.jar com.alibaba.druid.filter.config.ConfigTools xxxxxx 16 | @Test 17 | public void encodePwd(){ 18 | try { 19 | String root = ConfigTools.encrypt("root"); 20 | System.out.println(root); 21 | 22 | } catch (Exception e) { 23 | e.printStackTrace(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /mybatis-generator-web-test/src/main/java/com/github/mustfun/generator/test/TestDataSource.java: -------------------------------------------------------------------------------- 1 | package com.github.mustfun.generator.test; 2 | 3 | import com.alibaba.druid.pool.DruidDataSource; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | import org.springframework.context.annotation.ComponentScan; 10 | import org.springframework.test.context.junit4.SpringRunner; 11 | 12 | /** 13 | * Created by dengzhiyuan on 2017/4/6. 14 | * 没成功.. 15 | */ 16 | @RunWith(SpringRunner.class) 17 | @SpringBootTest 18 | @ComponentScan(basePackages = "com.itar.soa") 19 | @EnableAutoConfiguration 20 | public class TestDataSource { 21 | 22 | @Autowired 23 | private DruidDataSource dataSource; 24 | 25 | 26 | @Test 27 | public void source(){ 28 | System.out.println(dataSource.getName()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | com.github.mustfun 6 | mybatis-generator-web 7 | 1.0.0-SNAPSHOT 8 | pom 9 | 10 | mybatis-generator-web 11 | http://www.myorganization.org 12 | 13 | 14 | 15 | junit 16 | junit 17 | 4.12 18 | test 19 | 20 | 21 | 22 | mybatis-generator-web-parent 23 | mybatis-generator-web-biz 24 | mybatis-generator-web-business 25 | mybatis-generator-web-service 26 | mybatis-generator-web-dao 27 | mybatis-generator-web-support 28 | mybatis-generator-web-config 29 | mybatis-generator-web-facade 30 | mybatis-generator-web-model 31 | mybatis-generator-web-test 32 | 33 | --------------------------------------------------------------------------------
强大的模板管理,生成属于你需要的代码
点击左侧开始
Sorry but we couldn’t find this page :(
It seems that this page doesn’t exist.
Back Homepage 83 |
84 |
Internal server error
Something has gone seriously wrong. Please try later.
Back Homepage 82 |
83 |
Register Now!
Forgot password ?
Material Design Admin Template
Join to our community now !
Already have an account? Login