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注解使用的更多相关文章

  1. spring注解开发中常用注解以及简单配置

    一.spring注解开发中常用注解以及简单配置 1.为什么要用注解开发:spring的核心是Ioc容器和Aop,对于传统的Ioc编程来说我们需要在spring的配置文件中邪大量的bean来向sprin ...

  2. Spring注解开发-全面解析常用注解使用方法之生命周期

    本文github位置:https://github.com/WillVi/Spring-Annotation/ 往期文章:Spring注解开发-全面解析常用注解使用方法之组件注册 bean生命周期 ​ ...

  3. spring @Validated 注解开发中使用group分组校验

    之前知道spring支持JSR校验,在自己定义的bean中加入@NotNull,@NotBlank,@Length等之类的校验用于处理前台传递过来的request请求,避免在写多余的代码去处理. 但是 ...

  4. Mybatis开发中前端控制器注解@Controller 引用的类错误

    import org.springframework.web.portlet.ModelAndView; 错误 import org.springframework.web.servlet.Model ...

  5. Spring注解开发-全面解析常用注解使用方法之组件注册

    目录 1. @Configuration 2. @ComponentScan excludeFilters includeFilters 使用自定义TypeFilter 3. @Bean @Scope ...

  6. Annotation(三)——Spring注解开发

    Spring框架的核心功能IoC(Inversion of Control),也就是通过Spring容器进行对象的管理,以及对象之间组合关系的映射.通常情况下我们会在xml配置文件中进行action, ...

  7. Spring+SpringMVC+MyBatis深入学习及搭建(十六)——SpringMVC注解开发(高级篇)

    转载请注明出处:http://www.cnblogs.com/Joanna-Yan/p/7085268.html 前面讲到:Spring+SpringMVC+MyBatis深入学习及搭建(十五)——S ...

  8. Spring _day02_IoC注解开发入门

    1.Spring IoC注解开发入门 1.1 注解开发案例: 创建项目所需要的jar,四个基本的包(beans core context expression ),以及两个日志记录的包,还要AOP的包 ...

  9. Spring_IoC注解开发和AOP的XML开发(学习笔记2)

    一:IoC注解开发 1,在applicationContext.xml中需要引入context约束 <beans xmlns="http://www.springframework.o ...

随机推荐

  1. Mac Python相关配置操作汇总

    以下总结一下我在安装pytorch时用到的一些命令及操作,方便以后回顾 一.Which xxxx 直接查找到xxxx所在的路径.如下: which python python: aliased to ...

  2. 使用 @Transactional 时常犯的N种错误

    @Transactional是我们在用Spring时候几乎逃不掉的一个注解,该注解主要用来声明事务.它的实现原理是通过Spring AOP在注解修饰方法的前后织入事务管理的实现语句,所以开发者只需要通 ...

  3. 设计模式学习-使用go实现享元模式

    享元模式 定义 优点 缺点 适用场景 代码实现 享元模式和单例模式的区别 参考 享元模式 定义 享元模式(Flyweight),运用共享技术有效的支持大量细粒度的对象. 享元模式的意图是复用对象,节省 ...

  4. Python 随机数,数学

    数学相关的库        import math        向上取整:            print(math.ceil(18.9))        向下取整:            pri ...

  5. kibana解决Kibana server is not ready yet问题

    找到kbn的config中的xml配置 将es的ip改成真正的ip

  6. P5509 派遣

    题面传送门. 数论小杂烩( 由题意,对于每个士兵 \(i\),要么选,对答案产生 \(a_i(\frac{x}{i-x})\) 倍的贡献,要么不选,对答案产生 \(1\) 倍的贡献. 由此可知每个士兵 ...

  7. [Linux] Miniconda安装及其使用

    集群环境下安装conda进行软件管理.Miniconda是Anaconda的简化版,对于一般需求而言就够用了.因此,我这里安装Minconda3进行软件安装管理. 安装 Miniconda下载地址,版 ...

  8. R包xlsx安装与使用

     1. Rstudio安装xlsx报错 xlsx包加载依赖Java环境,我之前就安装过Java,但安装xlsx成功后,加载xlsx时一直报错: Error : loadNamespace()里算'rJ ...

  9. 【GS文献】全基因组选择模型研究进展及展望

    目录 1. GS概况 2. GS模型 1)直接法 GBLUP 直接法的模型改进 ①单随机效应 ②多随机效应 2)间接法 间接法模型 基于间接法的模型改进 3. GS模型比较 模型比较结论 4.问题及展 ...

  10. 10 — springboot整合mybatis — 更新完毕

    1.xml版 -- 复杂sql使用xml,简单sql使用注解 1).导入依赖 <!-- mybatis-spring-boot-starter是第三方( mybatis )jar包,不是spri ...