{"id":13840960,"url":"https://github.com/micyo202/yan-demo","last_synced_at":"2025-10-29T21:30:37.943Z","repository":{"id":91464638,"uuid":"103365245","full_name":"micyo202/yan-demo","owner":"micyo202","description":"本项目是基于 SpringMVC+Spring+MyBatis （SSM） 架构的高效率便捷开发框架","archived":false,"fork":false,"pushed_at":"2018-10-19T00:58:01.000Z","size":17074,"stargazers_count":71,"open_issues_count":0,"forks_count":35,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-02-02T04:41:16.374Z","etag":null,"topics":["ajax","aspectj","bootstrap","dom4j","jackson","jquery","mybatis","mybatis-generator","pagehelper","shiro","spring","springframework","springmvc","yan","yan-frame"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/micyo202.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-13T07:01:40.000Z","updated_at":"2024-11-13T15:23:51.000Z","dependencies_parsed_at":"2023-07-17T03:00:12.890Z","dependency_job_id":null,"html_url":"https://github.com/micyo202/yan-demo","commit_stats":{"total_commits":127,"total_committers":2,"mean_commits":63.5,"dds":0.2362204724409449,"last_synced_commit":"6bf8f8a3ff349fc534625a538c3101193d5769ba"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micyo202%2Fyan-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micyo202%2Fyan-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micyo202%2Fyan-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micyo202%2Fyan-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micyo202","download_url":"https://codeload.github.com/micyo202/yan-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238892197,"owners_count":19548148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ajax","aspectj","bootstrap","dom4j","jackson","jquery","mybatis","mybatis-generator","pagehelper","shiro","spring","springframework","springmvc","yan","yan-frame"],"created_at":"2024-08-04T17:01:00.327Z","updated_at":"2025-10-29T21:30:30.970Z","avatar_url":"https://github.com/micyo202.png","language":"HTML","funding_links":[],"categories":["HTML","HTML (177)"],"sub_categories":[],"readme":"# Yan Demo 项目简介（Instruction）\n\n### [English](https://github.com/micyo202/yan-demo/blob/master/README_EN.md) [中文文档](https://github.com/micyo202/yan-demo/blob/master/README.md)\n\n\u003cp align=\"center\" \u003e\n  \u003cimg src=\"https://github.com/micyo202/yan-demo/raw/master/src/main/webapp/resources/images/logo.png\" alt=\"Yan Demo\" title=\"Yan Demo\"\u003e\n\u003c/p\u003e\n\n[![Beta](https://img.shields.io/badge/beta-0.2.6-brightgreen.svg)](https://github.com/micyo202/yan-demo)\n[![Downloads](https://img.shields.io/badge/downloads-4.3MB-yellow.svg)](https://github.com/micyo202/yan-demo/archive/master.zip)\n[![Since](https://img.shields.io/badge/since-2017-blue.svg)](https://github.com/micyo202/yan-demo)\n[![License MIT](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://github.com/micyo202/yan-demo/blob/master/LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/micyo202/yan-demo.svg?style=social\u0026label=Stars)](https://github.com/micyo202/yan-demo)\n[![GitHub forks](https://img.shields.io/github/forks/micyo202/yan-demo.svg?style=social\u0026label=Fork)](https://github.com/micyo202/yan-demo)\n\n### 注：该项目已经重构，结构化更清晰，请移步至：[https://github.com/micyo202/yan](https://github.com/micyo202/yan)查看详情\u003cbr\u003e\n本项目是一个整合 **SpringMVC+Spring+MyBatis（SSM）** 框架的 **Demo**。\u003cbr\u003e\n拥有高效率便捷开发模式，使开发人员更专注于业务，达到面向业务开发。\u003cbr\u003e\n项目使用 **Maven** 构建，便于项目管理，支持 **Oracle、MySql** 等主流数据库。\u003cbr\u003e\n前端展示界面采用基于 **Boostrap** 实现的响应式布局，并集成了一系列的动画效果插件，整体界面简洁、美观大方并可优雅的与后台完成交互操作。\u003cbr\u003e\n项目封装了一系列常用方法、部署运行简单，便于个人或企业进行高效开发。\n\n### 为了方便大家更好的学习，特别提供了该项目的部署教程视频，请前往[http://v.youku.com/v_show/id_XMzI2MDg4Njk4NA==.html?spm=a2h3j.8428770.3416059.1](http://v.youku.com/v_show/id_XMzI2MDg4Njk4NA==.html?spm=a2h3j.8428770.3416059.1)进行观看，更多详细配置说明还请参考本文档中 ------ *六、配置说明（Properties）*\n\n## 一、项目开发环境\u0026工具（Environment\u0026Tools）\n* MacOS Sierra / Windows 7\n* MySql 5.7\n* JDK 1.8\n* CentOS 7\n* IntelliJ IDEA 2017.2.5 / Eclipse 4.6.1\n* Navicat Premium 11.1.12\n* Maven 3.3.9\n* Jetty 9.4.6.v20170531 / Tomcat 9.0.1\n\n## 二、技术选型（Technology）\n#### 1.服务端技术（Server）\n名称 | 版本号 | 网址\n--- | --- | ---\nSpring Framework | 4.3.13.RELEASE  | [http://projects.spring.io/spring-framework/](http://projects.spring.io/spring-framework/)\nShiro | 1.4.0 | [http://shiro.apache.org](http://shiro.apache.org)\nAspectJ | 1.8.13 | [http://www.eclipse.org/aspectj/](http://www.eclipse.org/aspectj/)\nMyBatis | 3.4.5 | [http://www.mybatis.org/mybatis-3/zh/index.html](http://www.mybatis.org/mybatis-3/zh/index.html)\nMyBatis Generator | 1.3.6 | [http://www.mybatis.org/generator/index.html](http://www.mybatis.org/generator/index.html)\nPageHelper | 5.1.2 | [http://git.oschina.net/free/Mybatis_PageHelper](http://git.oschina.net/free/Mybatis_PageHelper)\nDruid | 1.1.6 | [https://github.com/alibaba/druid](https://github.com/alibaba/druid)\nJackson | 2.9.3 | [https://github.com/FasterXML/jackson](https://github.com/FasterXML/jackson)\nDom4j | 1.6.1 | [http://www.dom4j.org](http://www.dom4j.org)\nEhcache | 2.6.11| [http://www.ehcache.org/](http://www.ehcache.org/)\nLogback | 1.2.3 | [https://logback.qos.ch](https://logback.qos.ch)\nMaven | 3.3.9 | [http://maven.apache.org/](http://maven.apache.org/)\n#### 2.前端技术（Web）\n名称 | 版本号 | 网址\n--- | --- | ---\nangular | - | [https://angularjs.org](https://angularjs.org)\nawesome-bootstrap-checkbox | - | [https://github.com/flatlogic/awesome-bootstrap-checkbox](https://github.com/flatlogic/awesome-bootstrap-checkbox)\nbootstrap | 3.3.7 | [http://www.bootcss.com](http://www.bootcss.com)\nbootstrap-datetimepicker | - | [http://www.bootcss.com/p/bootstrap-datetimepicker/](http://www.bootcss.com/p/bootstrap-datetimepicker/)\nbootstrap-select | 1.12.4 | [http://silviomoreto.github.io/bootstrap-select/](http://silviomoreto.github.io/bootstrap-select/)\nbootstrap-table | 1.11.1 | [http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/](http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/)\nbootstrapvalidator | 0.5.3 | [https://github.com/nghuuphuoc/bootstrapvalidator/](https://github.com/nghuuphuoc/bootstrapvalidator/)\nfont-awesome | 4.7.0 | [http://fontawesome.io/icons/](http://fontawesome.io/icons/)\nfontIconPicker | 2.0.0 | [https://codeb.it/fonticonpicker/](https://codeb.it/fonticonpicker/)\nfullPage | - | [https://alvarotrigo.com/fullPage/](https://alvarotrigo.com/fullPage/)\njquery-confirm | 3.3.0 | [https://github.com/craftpip/jquery-confirm](https://github.com/craftpip/jquery-confirm)\nmalihu-custom-scrollbar-plugin | - | [https://github.com/videoMonkey/malihu-custom-scrollbar-plugin](https://github.com/videoMonkey/malihu-custom-scrollbar-plugin)\nmaterial-design-iconic-font | 2.2.0 | [https://github.com/zavoloklom/material-design-iconic-font](https://github.com/zavoloklom/material-design-iconic-font)\nwaves | 0.7.5 | [https://github.com/fians/Waves](https://github.com/fians/Waves)\nzTree_v3 | 3.5.26 | [http://www.treejs.cn/v3/main.php#_zTreeInfo](http://www.treejs.cn/v3/main.php#_zTreeInfo)\nBootstrapMenu | - | [https://mobirise.com/bootstrap-menu](https://mobirise.com/bootstrap-menu)\ndevice | - | [https://github.com/matthewhudson/device.js](https://github.com/matthewhudson/device.js)\njquery | 3.2.1 | [http://jquery.com](http://jquery.com)\njquery-cookie | - | [https://github.com/carhartl/jquery-cookie](https://github.com/carhartl/jquery-cookie)\n\n\n## 三、组织树（Tree）\n```lua\nyan-demo -- 项目\n├── src -- 源文件路径\n|    ├── main -- 主模块路径\n|    |    ├── java -- java类路径\n|    |    |    ├── com.yan.common -- 通用功能模块\n|    |    |    ├── com.yan.core -- 框架核心模块\n|    |    |    ├── com.yan.demo -- 业务模块\n|    |    ├── resources -- 资源配置路径\n|    |    |    ├── database -- 数据库sql文件\n|    |    |    ├── mybatis -- mapper映射文件\n|    |    |    ├── properties -- 配置文件\n|    |    |    ├── spring -- spring的配置文件\n|    |    ├── webapp -- web应用根路径\n|    |    |    ├── common -- 公共路径\n|    |    |    ├── resources -- 静态资源路径\n|    |    |    ├── views -- 视图路径\n|    ├── test -- 测试模块路径\n|    |    ├── com.yan.junit -- 撰写单元测试类\n```\n\n## 四、项目结构（Construction）\n\u003e * com.yan.common：通用功能模块（包含：用户登录、菜单、后台管理等...）\n\u003e * com.yan.core：框架核心模块（包括基础的控制器、过滤器、拦截器、类加载器、注入器、注解、以及框架封装的核心方法部分）\n\u003e * com.yan.demo：业务模块（根据实际项目名称换掉demo名称，所有业务模块均在该路径下）\n\u003e * com.yan.**.controller：控制器路径，存放自己编写业务处理的控制器（继承BaseController）\n\u003e * com.yan.**.mapper：持久层映射接口类路径（mbg生成mybatis对应的Mapper映射接口类）\n\u003e * com.yan.**.model：模型类路径（mbg生成的模型以及自定义模型）\n\u003e * com.yan.junit：单元测试模块（便于撰写单元测试代码）\n\u003e * resources/database：数据库sql文件（数据库表结构的*.sql文件，包含Yan Frame框架所需的基本系统数据表，如：用户表、权限表、菜单表等...）\n\u003e * resources/mybatis：mapper映射文件（所有mybatis的sql模板*.xml文件）\n\u003e * resources/properties：配置文件（如：系统基本配置、数据库配置、日志配置、MyBatis generator配置）\n\u003e * resources/spring：spring的配置文件（命名规范：spring-*.xml）\n\u003e * webapp/common：公共路径（前台框架的通用*.jsp头文件，页面仅需引入这里面对应的jsp即可）\n\u003e * webapp/resources：静态资源路径（包含了js、css、images、doc、plugins等）\n\u003e * webapp/views：视图路径（所有业务功能的*.jsp页面）\n\n## 五、项目入门（Introduction）\n\u003e 1. 使用 **Maven** 构建项目\n\u003e 2. 创建数据库并执行 **resources/database** 路径下的 **.sql** 文件，创建框架必要的表（如：用户表、资源表、日志记录表等...）\n\u003e 3. 修改 **resources/properties** 路径下的 **.properties** 配置文件（具体修改方法，详见 - 六、配置说明）\n\u003e 4. 完成以上步骤就可以正常部署启动服务了（使用 **jetty / tomcat** 均可），接下来进入开发阶段\n\u003e 5. 根据实际业务需求，在对应的数据库中创建业务表，表命名规范：“模块名_表名” 如：**SYS_RESOURCE**（系统模块资源表）\n\u003e 6. 修改 **resources** 路径下的 **generatorConfig.xml** 中的 *targetPackage* 包名及 *tableName* 表名，使用 **MyBatis generator** 插件生成对应的持久层模块代码（Maven 执行命令：**mvn mybatis-generator:generate**），具体配置请参考[MyBatis GeneratorXML Configuration](http://www.mybatis.org/generator/configreference/xmlconfig.html)\n\u003e 7. 在业务模块包下创建对应的 **controller** 包，并在包中创建控制器类，控制器类命名规范以 **Controller** 结尾，并继承于 **BaseController** 类\n\u003e 8. 编写控制器业务处理代码，具体使用参考 - 八、示例代码\n\u003e 9. 创建对应jsp页面，并编写前端页面展示代码\n\n## 六、配置说明（Properties）\n| 名称（Key值）| 描述 |\n| --- | :--- |\n| **setting.upload** | 文件上传路径（绝对路径） |\n| --- | :--- |\n| log.name | 日志文件名称（绝对路径） |\n| **log.dir** | 日志文件输出路径（绝对路径） |\n| log.maxHistory | 日志文件保存最大天数 |\n| log.maxSize | 日志文件大小 |\n|- |- |\n| **mbg.jar** | mgb插件链接数据库所需的jar包（绝对路径） |\n| **mbg.path** | 生成代码的路径（绝对路径） |\n| **mbg.username** | 数据库连接用户名 |\n| **mbg.password** | 数据库链接密码 |\n| **mbg.driverClassName** | 数据库连接驱动 |\n| **mbg.url** | 数据库连接url |\n|- |- |\n| **default.db.username** | 默认数据库用户名 |\n| **default.db.password** | 默认数据库密码 |\n| **default.db.driverClassName** | 默认数据库驱动类 |\n| **default.db.url** | 默认数据库链接地址 |\n|- |- |\n| **dextend.db.username** | 扩展数据库用户名（用于多数据源切换） |\n| **dextend.db.password** | 扩展数据库密码（用于多数据源切换） |\n| **dextend.db.driverClassName** | 扩展数据库驱动类（用于多数据源切换） |\n| **dextend.db.url** | 扩展数据库链接地址（用于多数据源切换） |\n|- |- |\n| db.initialSize | 初始化时建立物理连接的个数 |\n| db.minIdle | 最小连接池数量 |\n| db.maxActive | 最大连接池数量 |\n| db.maxWait | 获取连接时最大等待时间，单位毫秒 |\n| db.timeBetweenEvictionRunsMillis | 配置间隔多久才进行一次检测，检测需要关闭的空闲连接，单位是毫秒 |\n| db.minEvictableIdleTimeMillis | 配置一个连接在池中最小生存的时间，单位是毫秒 |\n| db.validationQuery | 用来检测连接是否有效的sql |\n| db.testWhileIdle | 建议配置为true，不影响性能，并且保证安全性 |\n| db.testOnBorrow | 申请连接时执行validationQuery检测连接是否有效，做了这个配置会降低性能。 |\n| db.testOnReturn | 归还连接时执行validationQuery检测连接是否有效，做了这个配置会降低性能 |\n| db.poolPreparedStatements | 是否缓存preparedStatement，也就是PSCache |\n| db.maxPoolPreparedStatementPerConnectionSize | 每个连接上PSCache的大小 |\n| db.filters | 属性类型是字符串，通过别名的方式配置扩展插件，常用的插件有：监控统计用的filter:stat日志用的filter:log4j防御sql注入的filter:wall |\n\n## 七、常用方法（Methods）\n##### *方法均在继承于BaseController的controller类中使用this.metodName或直接使用methodName来进行调用（注：methodName代表需要调用的方法名称，方法名称见下表）*\n\n| 方法名 | 参数 | 返回值 | 描述 |\n| --- | :--- | :--- | :--- |\n| getSession | 无 | HttpSession 服务器会话 | 获取服务器会话 session 对象 |\n| setSession | session 服务器会话 | 无 | 设置服务器会话 session 对象 |\n| getRequest | 无 | HttpServletRequest 用户请求 | 获取用户请求 request 对象 |\n| setRequest | request 用户请求 | 无 | 设置用户请求 request 对象 |\n| getResponse | 无 | HttpServletResponse 服务器响应结果 | 获取服务器响应结果 response 对象 |\n| setResponse | response 服务器响应结果 | 无 | 设置服务器响应结果 response 对象 |\n| **getSessionUser** | 无 | TbSysUser 用户对象 | 获取登录成功后 session 中的存储的用户信息 |\n| **getMapper** | type 生成的 Mapper 接口对象类型 | T 泛型，传入参数对象的类型Mapper | 获取 mapper 对象 |\n| **getMapper** | 无 | DelegateMapper 通用 mapper，查看自定义 sqlMap 的代理 mapper 对象 | 获取 delegateMapper 对象 |\n| **setDataSource** | dataSource 数据源名称（必须是spring配置中包含的名称） | 无 | 动态切换数据源方法，设置数据源名称 |\n| **clearDataSource** | 无 | 无 | 清除数据源，在切换完数据源后，进行清理，将数据源还原为默认数据源 |\n| **offsetPage** | offset 起始数量；limit 限制条数 | 无 | 分页查询范围，参数均由 bootstrapTable 分页插件进行传入，无需人工控制，只需调用方法即可 |\n| **resultPage** | list 查询到的分页结果，为 Page 对象 | PageModel\u003cT\u003e 自定义的分页模型，T 为查询的对象 | 分页结果集对象 |\n| **resultMsg** | status 状态值（可根据需求任意设置，无强制标准）；msg 消息内容；res 返回的对象 | MsgModel 自定义消息模型 | 消息返回对象 |\n| **fileUpLoad** | request 上传方法中传递的 request 对象，并非父类中的 request 对象 | List\u003cString\u003e 上传文件成功后的新文件名称，以集合形式返回 | 文件上传方法，支持多个文件上传 |\n| **fileDownLoad** | fileName 需要下载的文件名称 | ResponseEntity\u003cbyte[]\u003e 下载的文件，在浏览器会进行下载 | 文件下载方法 |\n| isNull | obj 需要进行判断的对象 | boolean 为null或空返回 true，否则返回 false | 判断对象是否为null，或空 |\n| obj2Str | obj 需要转换的对象 | String 对象的值（为null则返回\"\"） | 对象转换为 String，通常用于获取 Map 集合中的对象时使用 |\n| getUUID | 无 | String 32位主键字符串 | 生成 uuid 主键，长度为32位，且为大写模式 |\n| base64Encoder | str 需要进行编码的字符串 | String 进行编码后的结果字符串 | 对字符串进行 base64 编码 |\n| base64Decoder | str 已进行 base64 编码的编码字符串 | String 解码后的原字符串 | 对字符串进行 base64 解码 |\n| md5 | str 需要进行 md5 加密的字符串 | String 加密后的结果 | 对字符串进行 md5 加密算法 |\n| currentDate | pattern 获取系统时间的格式，如：yyyy-MM-dd HH:mm:ss | String 返回格式化后的当前时间 | 获取系统当前时间 |\n| timeStamp2Date | timestamp 需要进行转换的时间戳；pattern 转换后的格式 | String 格式化后的日期 | 时间戳转换成日期 |\n| date2TimeStamp | dateStr 需要进行转换的日期字符串；pattern 日期的格式 | String 转换后的时间戳 | 日期转换为时间戳 |\n| readFromFile | filePath 文件路径（绝对路径） | String 读取的文件内容 | 从指定文件中读取文件内容 |\n| writeToFile | content 需要写入文件中的内容 | filePath 文件路径（绝对路径） | 将内容写入到指定文件中（写入会覆盖文件原有内容，建议先读取，再写入，将读取的内容与需要写入的内容并在一起进行写入） |\n| generatePath | path 文件夹路径（绝对路径） | 无 | 生成指定路径文件夹，先进行判断文件夹是否存在，若不存在则创建对应目录的文件夹，若存在则不进行任何操作 |\n| generateFile | path 文件路径（绝对路径） | 无 | 生成指定路径的文件，先进行判断文件是否存在，若不存在则进行创建文件，若存在则不进行任何操作 |\n| propertiesValue | key 资源文件中的 key 值 | String 读取到的 key 对应的 value 值 | 读取 properties 文件中的值，读取 classpath 下 /properties/setting.properties 配置文件 |\n| propertiesValue | resource 资源文件路径（对应 classpath 中的路径）；key 资源文件中的 key 值 | String 读取到的 key 对应的 value 值 | 读取指定路径 properties 文件中的值，会从 classpath 路径下进行查找资源文件 |\n\n## 八、示例代码（Codes）\n##### 创建一个继承与BaseController的控制器\n```java\n@Controller\npublic class XxxController extends BaseController {\n\t...\n}\n```\n##### 获取日志日志记录Logger对象\n\n```java\n// 使用注解获取\n@LogInject\nprivate static Logger log;\n\n// 使用工厂方法获取\nprivate static Logger log = LoggerFactory.getLogger(XxxController.class);\n```\n\n##### 获取mapper对象\n\n```java\n// 注解方式获取delegateMapper\n@MapperInject\nprivate DelegateMapper delegateMapper;\n// 注解方式获取对象对应的mapper\n@MapperInject(XxxMapper.class)\nprivate XxxMapper mapper;\n\n// 获取delegateMapper\nthis.getMapper();\n// 获取对象对应的mapper\nthis.getMapper(XxxMapper.class);\n```\n\n##### 动态切换数据源\n\n```java\n// 注解切换数据源，默认切换扩展数据源\n@DynamicDataSource\npublic String init(){\n\t...\n}\n\n// 注解切换数据源，传入ENUM类型的数据源名称\n@DynamicDataSource(DataSourceName.EXTEND)\npublic String init(){\n\t...\n}\n\n// 调用父类方法执行切换数据源（参数名称建议使用框架中已经定义好的，DataSourceName.DEFAULT/EXTEND.getName()）\nthis.setDataSource(\"extendDataSource\");\n\t...\nthis.clearDataSource();\n```\n\n##### 分页查询后台代码\n\n```java\n@RequestMapping(\"/list\")\n@ResponseBody\npublic PageModel\u003cXxx\u003e list(int offset, int limit) {\n\t// 调用父类方法传入分页参数\n\tthis.offsetPage(offset, limit);\n\tList\u003cXxx\u003e list = mapper.selectByExample(null); // 调用查询方法\n\treturn this.resultPage(list);\n}\n```\n\n##### 分页查询前台代码\n\n```javascript\n\u003ctable id=\"table\"\u003e\u003ctable\u003e\n\n$('#table').bsTable({\n\t\turl: '${pageContext.request.contextPath}/xxx/list',\n\t\tidField: 'id',\n\t\tcolumns: [\n\t\t\t{field: 'state', checkbox: true},\n\t\t\t{field: 'id', title: 'id', align: 'center'},\n\t\t\t...\n\t\t\t]\n\t});\n```\n\n##### 文件上传\n\n```java\n@RequestMapping(\"/upload\")\npublic String upload(HttpServletRequest request) {\n\t// 调用父类的上传方法，在jsp中必须指定form为enctype=\"multipart/form-data\"\n\tList\u003cString\u003e fileNames = this.fileUpLoad(request);\n\treturn \"success\";\n}\n```\n\n##### 文件下载（在jsp页面使用通用的下载方法，使用restful风格）\n\n```html\n\u003ca href=\"${pageContext.request.contextPath}/文件名称/download\"\u003e文件下载\u003c/a\u003e\n```\n\n##### 自定义文件下载后台方法\n\n```java\n@RequestMapping(\"/download\")\npublic ResponseEntity\u003cbyte[]\u003e download(String fileName) {\n\t// 调用父类文件下载方法\n\treturn this.fileDownLoad(fileName);\n}\n```\n##### 常用DelegateMapper及对象Mapper方法\n\n```java\n// 使用自定义sql模板查询单个对象\nDemo demo = delegateMapper.selectOne(statement);\nDemo demo = delegateMapper.selectOne(statement, parameter);\n\t\t\n// 使用自定义sql模板查询对象集合\nList\u003cDemo\u003e list = delegateMapper.selectList(statement);\nList\u003cDemo\u003e list = delegateMapper.selectList(statement, parameter);\n\n// 使用自定义sql模板有范围的查询，（每次返回指定的对象条数集合）\nList\u003cDemo\u003e list = delegateMapper.selectList(statement, parameter, rowBounds);\n\n// 使用自定义sql模板进行分页查询\nPageModel\u003cDemo\u003e page = delegateMapper.selectPagination(statement, offset, limit);\nPageModel\u003cDemo\u003e page = delegateMapper.selectPagination(statement, parameter, offset, limit);\n\n// 使用自定义sql模板保存\nint res = delegateMapper.insert(statement);\nint res = delegateMapper.insert(statement, parameter);\n\n// 使用自定义sql模板修改\nint res = delegateMapper.update(statement);\nint res = delegateMapper.update(statement, parameter);\n\n// 使用自定义sql模板删除\nint res = delegateMapper.delete(statement);\nint res = delegateMapper.delete(statement, parameter);\n\n// 使用对象方法根据主键查询\nDemo demo = mapper.selectByPrimaryKey(id);\n\n// 使用对象方法根据criteria查询\nList\u003cDemo\u003e list = mapper.selectByExample(example);\n\n// 使用对象方法根据criteria分页查询\nthis.offsetPage(offset, limit);\nList\u003cDemo\u003e list = mapper.selectByExample(example);\nthis.resultPage(list); // 返回的结果集\n\n// 使用对象方法添加\nint res = mapper.insert(record);\nint res = mapper.insertSelective(record);\n\n// 使用对象方法根据主键修改\nint res = mapper.updateByPrimaryKey(record);\nint res = mapper.updateByPrimaryKeySelective(record);\n\n// 使用对象方法根据criteria修改\nint res = mapper.updateByExample(record, example);\nint res = mapper.updateByExampleSelective(record, example);\n\n// 使用对象方法根据主键删除\nint res = mapper.deleteByPrimaryKey(productCode);\n\n// 使用对象方法删除根据criteria删除\nint res = mapper.deleteByExample(example);\n```\n\n*更多方法使用请参考项目中API文档或demo模块下的代码*\n\n## 九、效果预览（Preview）\n\u003cimg src=\"https://github.com/micyo202/yan-demo/raw/master/src/main/webapp/resources/images/login_preview.png\" alt=\"login\" title=\"login\"\u003e\n\u003cimg src=\"https://github.com/micyo202/yan-demo/raw/master/src/main/webapp/resources/images/web_preview.png\" alt=\"web\" title=\"web\"\u003e\n\u003cimg src=\"https://github.com/micyo202/yan-demo/raw/master/src/main/webapp/resources/images/mobile_preview.png\" alt=\"mobile\" title=\"mobile\"\u003e\n\n## 十、许可证（License）\n[MIT License](https://github.com/micyo202/yan-demo/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicyo202%2Fyan-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicyo202%2Fyan-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicyo202%2Fyan-demo/lists"}