srpingboot接口 流程

srpingboot接口 流程

Controller => Service => Impl => Dao => xml

  • TestEntity
@Data
public class TestEntity {
	private String testId;
	private String testName;
}
  • Controller 接口类
@RestController
@RequestMapping(value = "test")
public class TestController {
    @Resource
    private TestService testService;
    
    @RequestMapping(value = "get")
    public List<TestEntity> test() { 
        return testService.testFindAll();
    }
}
  • testService
public interface testService {
     List<TestEntity> testFindAll();
}
  • Impl
@Service
public class testServiceImpl implements testService {
    @Autowired
    private TestDao testDao;

    @Override
    public List<TestEntity> testFindAll() {
        return testDao.testFindAll();
    }
}
  • Dao
@Mapper
public interface testDao{
   List<TestEntity> testFindAll();
}
  • xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="Dao路径  testDao">
    <!-- 通用查询映射结果 -->
    <resultMap id="testResultMap" type="。。。。TestEntity">
        <result column="test_id" property="testId"/>
        <result column="test_name" property="testName"/>
        <result column="keyword_status" property="keywordStatus"/>
        <result column="create_time" property="createTime"/>
    </resultMap>

    <select id="testFindAll" resultMap="testResultMap">
        select * from test
    </select>
</mapper>
  • test 数据库表格式
/*
 Navicat Premium Data Transfer

 Source Server         : localhost_3306
 Source Server Type    : MySQL
 Source Server Version : 100137
 Source Host           : localhost:3306
 Source Schema         : blog

 Target Server Type    : MySQL
 Target Server Version : 100137
 File Encoding         : 65001

 Date: 13/10/2020 16:47:48
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for test
-- ----------------------------
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test`  (
  `test_id` int(11) NOT NULL,
  `test_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  PRIMARY KEY (`test_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

SET FOREIGN_KEY_CHECKS = 1;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
hsweb 企业后台管理基础框架业务功能现在:权限管理: 权限资源-角色-用户.配置管理: kv结构,自定义配置.可通过此功能配置数据字典.脚本管理: 动态脚本,支持javascript,groovy,java动态编译执行.表单管理: 动态表单,可视化设计表单,自动生成数据库以及系统权限.无需重启直接生效.模块设置: 配合动态表单实现表格页,查询条件自定义.数据库维护: 在线维护数据库,修改表结构,执行sql.数据源管理: 配置多数据源.代码生成器: 在线生成代码,打包下载.可自定义模板.定时任务: 配置定时任务,使用动态脚本编写任务内容.系统监控: 监控系统资源使用情况.缓存监控: 监控缓存情况.访问日志: 记录用户每次操作情况未来:组织架构管理: 地区-机构-部门-职务-人员.工作流管理: activiti工作流,在线配置流程,配合动态表单实现自定义流程.邮件代收: 代收指定邮箱的邮件框架功能全局restful json,前后分离.通用dao,service,controller类,增删改查直接继承即可.通用mybatis配置文件,支持多种条件查询自动生成,支持自动生成insert,update,delete语句,支持和查询相同的各种条件.实现用户,权限管理;基于aop,注解,精确到按钮的权限控制.动态表单功能,可在前端设计表单,动态生成数据库表,提供统一的增删改查接口.在线代码生成器,可自定义模板.动态多数据源,支持数据源热加载,热切换,支持分布式事务.数据库支持 mysql,oracle,h2.websocket支持.定时调度支持,可在页面配置定时任务,编写任务脚本执行。演示示例:demo.hsweb.me测试用户:test (test2,test3,test4....) 密码:123456演示项目源码:hsweb-demo技术选型第三方:MVC:spring-boot. 开箱即用,学习成本低,部署方便(main方法运行).ORM:mybatis. 配置灵活,简单方便.JTA:atomikos. 分布式事务,多数据源事务全靠他.Cache:spring-cache. 统一接口,注解使用,simple,redis... 自动切换.Scheduler:quartz. 开源稳定,支持集群.自家:hsweb-commons :通用工具类hsweb-easy-orm :为动态表单设计的orm框架hsweb-expands-compress :文件压缩,解压操作hsweb-expands-office :office文档操作( excel读写,模板导出,word模板导出)hsweb-expands-request: 请求模拟(http,ftp)hsweb-expands-script:动态脚本,动态编译执行java,groovy,javascript,spel,ognl....hsweb-expands-shell:shell执行hsweb-expands-template:各种模板引擎 标签:hsweb
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

狗_都不做前端

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值