1 Star 0 Fork 0

DeanNode / springBootTemplate

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

redsv_java

介绍

java后台

软件架构

软件架构说明

安装教程

  1. 执行 com.weimi.Application 的 main 方法
  2. 访问 API例子:http://localhost:8081/api/user/987654321
    API例子:http://localhost:8081/api/test/all
    API文档:http://localhost:8081/api/swagger-ui.html

使用说明

  1. com.weimi.test 是例子
  2. com.weimi.logic 是tb开头的表的处理,包含 controller, service 和 mapper
  3. com.weimi.sys 是sys 开头的表的处理 包含 controller, service 和 mapper
  4. com.weimi.user 是 user 表的处理 负责登录等处理
  5. 各个表的代码结构已创建,根据业务填充相应的 controller , service 和 mapper。

代码说明

  1. 修改Controller 的路由注解 @RequestMapping("/test") ,添加方法。
    @PostMapping("/add")
    public R add(@RequestBody @Validated HobbyTest data) {
        // 使用SpringValidation校验数据
        return R.ok(service.addData(data));
    }

controller中调用相应的 service

    @Autowired
    private IHobbyServiceTest service;

方法注解: @GetMapping("/xxxx") //get方法 @PostMapping("/xxxx") //post方法 @RequestMapping("/add") //不限方法

  1. 添加 service 的方法。

controller 如果自定义sql语句,需要调用 mapper

    @Autowired
    private HobbyMapperTest mapper;

简单的增删改查分页等,都可以直接调用 serivce(或者是Mapper) 的 CRUD 接口方法,不需要写sql。
详细方法参照:
https://mp.baomidou.com/guide/crud-interface.html#service-crud-%E6%8E%A5%E5%8F%A3
https://mp.baomidou.com/guide/crud-interface.html#mapper-crud-%E6%8E%A5%E5%8F%A3

  1. 复杂语句(如:多表join)可定义在mapper的xml里面,通过mapper接口返回调用,参照例子和 Mybatis文档 :
    http://www.mybatis.org/mybatis-3/zh/sqlmap-xml.html

API文档说明

  1. 访问API页面:http://localhost:8081/api/swagger-ui.html

输入图片说明

点击某个API,可看到返回说明 ,点击 Try it out 可输入参数测试 输入图片说明

输入参数,执行,API返回结果如下 输入图片说明

写完的api后,可以在项目目录下执行 mvn clean package -Dmaven.test.skip=true

,完成之后会在target生成redsv-1.0.0.jar , 把 redsv-1.0.0.jar 上传到 服务器根目录(/root) ,运行 ./start.sh 就可以运行了

MIT License Copyright (c) 2018 Li Jinhui Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
Java
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/DeanNode/springBootTemplate.git
git@gitee.com:DeanNode/springBootTemplate.git
DeanNode
springBootTemplate
springBootTemplate
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891