注解开发中的@Results注解使用
package com.hope.dao;
import com.hope.domain.User;
import com.sun.xml.internal.bind.v2.model.core.ID;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
* @author newcityman
* @date 2019/11/15 - 22:59
*/
public interface IUserDao {
/**
* 查询所有用户的信息
* @return
*/
@Select(value = "select * from user")
@Results(id = "userMap",value = {
@Result(id = true,column ="id" ,property ="userId" ),
@Result(column = "username" ,property = "userName"),
@Result(column = "sex",property = "userSex"),
@Result(column = "address",property = "userAddress"),
@Result(column = "birthday",property = "userBirthday")
})
public List<User> findAll();
/**
* 根据用户的id,查询用户
* @param id
* @return
*/
@Select("select * from user where id=#{id}")
@ResultMap(value ={"userMap"} )
User findOne(Integer id);
/**
* 根据用户名模糊查询
* @param username
* @return
*/
@Select("select * from user where username like #{username}")
@ResultMap("userMap")
List<User> findByName(String username);
}
注解开发中的@Results注解使用的更多相关文章
- spring注解开发中常用注解以及简单配置
一.spring注解开发中常用注解以及简单配置 1.为什么要用注解开发:spring的核心是Ioc容器和Aop,对于传统的Ioc编程来说我们需要在spring的配置文件中邪大量的bean来向sprin ...
- Spring注解开发-全面解析常用注解使用方法之生命周期
本文github位置:https://github.com/WillVi/Spring-Annotation/ 往期文章:Spring注解开发-全面解析常用注解使用方法之组件注册 bean生命周期 ...
- spring @Validated 注解开发中使用group分组校验
之前知道spring支持JSR校验,在自己定义的bean中加入@NotNull,@NotBlank,@Length等之类的校验用于处理前台传递过来的request请求,避免在写多余的代码去处理. 但是 ...
- Mybatis开发中前端控制器注解@Controller 引用的类错误
import org.springframework.web.portlet.ModelAndView; 错误 import org.springframework.web.servlet.Model ...
- Spring注解开发-全面解析常用注解使用方法之组件注册
目录 1. @Configuration 2. @ComponentScan excludeFilters includeFilters 使用自定义TypeFilter 3. @Bean @Scope ...
- Annotation(三)——Spring注解开发
Spring框架的核心功能IoC(Inversion of Control),也就是通过Spring容器进行对象的管理,以及对象之间组合关系的映射.通常情况下我们会在xml配置文件中进行action, ...
- Spring+SpringMVC+MyBatis深入学习及搭建(十六)——SpringMVC注解开发(高级篇)
转载请注明出处:http://www.cnblogs.com/Joanna-Yan/p/7085268.html 前面讲到:Spring+SpringMVC+MyBatis深入学习及搭建(十五)——S ...
- Spring _day02_IoC注解开发入门
1.Spring IoC注解开发入门 1.1 注解开发案例: 创建项目所需要的jar,四个基本的包(beans core context expression ),以及两个日志记录的包,还要AOP的包 ...
- Spring_IoC注解开发和AOP的XML开发(学习笔记2)
一:IoC注解开发 1,在applicationContext.xml中需要引入context约束 <beans xmlns="http://www.springframework.o ...
随机推荐
- MAC VMware fusion 12.1.0 Centos7 网络配置
虚拟机选择NAT模式 获取mac机器中vmnet8的gateway地址 找到 # NAT gateway address这一行,下面的ip就是gateway地址 cat /Library/Prefer ...
- Json数据使用及学习方法
以前对json的了解并不是很清楚,因为使用很少,所以也没有特意的研究.只知道json是轻量级的数据交换格式,可以被多种语言方便的处理,也是大型门户站接口使用的主要数据格式. 而最近做了个项目,涉及到j ...
- [ARC117E]Zero-Sum Ranges 2
令$sum_{i}=\sum_{j=1}^{i}a_{j}$,即要求其满足: 1.$sum_{0}=sum_{2n}=0$且$\forall 1\le i\le 2n,|sum_{i}-sum_{i- ...
- [atARC109E]1D Reversi Builder
归纳每一次操作后必然是两个颜色相同的连续段(即ww...bb...或bb...ww...),对操作的位置分类讨论不难证明正确性 当$c_{1}=c_{n}$,由于端点颜色不会修改,再根据该结论,可以得 ...
- [源码解析] PyTorch 分布式(10)------DistributedDataParallel 之 Reducer静态架构
[源码解析] PyTorch 分布式(10)------DistributedDataParallel之Reducer静态架构 目录 [源码解析] PyTorch 分布式(10)------Distr ...
- 测试平台系列(81) 编写在线执行Redis功能
大家好~我是米洛! 我正在从0到1打造一个开源的接口测试平台, 也在编写一套与之对应的完整教程,希望大家多多支持. 欢迎关注我的公众号测试开发坑货,获取最新文章教程! 回顾 上一节我们牛刀小试,编写了 ...
- docker详细
镜像(image) 容器(container) 启动,删除,停止 仓库(repository) docker images
- AtCoder Beginner Contest 188题解
A 题意 问\(x,y\)相差是否小于\(3\) #include<iostream> #include<cstdio> #include<cmath> #defi ...
- Codeforces 429E - Points and Segments(欧拉回路)
Codeforces 题面传送门 & 洛谷题面传送门 果然我不具备融会贯通的能力/ll 看到这样的设问我们可以很自然地联想到这道题,具体来说我们可以通过某种方式建出一张图,然后根据" ...
- CF1493E Enormous XOR
题目传送门. 题意简述:给出长度为 \(n\) 的二进制数 \(l,r\),求 \(\max_{l\leq x\leq y\leq r}\oplus_{i=x}^yi\). 非常搞笑的题目,感觉难度远 ...