Mysql 多表连查 xml写法 非注解形式
1.xml写法
<!-- 联查用户users表 -->
<resultMap type="nanh.entity.Tasks" id="selectTasksAllLeftUsers">
<id column="id" property="id"/>
<result column="tasknumber" jdbcType="VARCHAR" property="tasknumber" />
<result column="taskstarttime" jdbcType="VARCHAR" property="taskstarttime" />
<result column="taskendtime" jdbcType="VARCHAR" property="taskendtime" />
<result column="taskclass" jdbcType="VARCHAR" property="taskclass" />
<result column="taskinfo" jdbcType="VARCHAR" property="taskinfo" />
<result column="taskstatus" jdbcType="VARCHAR" property="taskstatus" />
<result column="uid" jdbcType="INTEGER" property="uid" />
<result column="executiontime" jdbcType="VARCHAR" property="executiontime" />
<association property="users" javaType="nanh.entity.Users">
<result column="numbers" jdbcType="VARCHAR" property="numbers" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="positionid" jdbcType="INTEGER" property="positionid" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="jurisdiction" jdbcType="VARCHAR" property="jurisdiction" />
<result column="deptid" jdbcType="INTEGER" property="deptid" />
<result column="currenttask" jdbcType="VARCHAR" property="currenttask" />
<result column="state" jdbcType="VARCHAR" property="state" />
<association property="dept" javaType="nanh.entity.Dept">
<result column="deptnumber" property="deptnumber" jdbcType="VARCHAR" />
<result column="deptname" property="deptname" jdbcType="VARCHAR" />
</association>
<association property="position" javaType="nanh.entity.Position">
<result column="positionname" property="positionname" jdbcType="VARCHAR" />
<result column="positionnumber" property="positionnumber" jdbcType="VARCHAR" />
</association>
</association>
</resultMap>
<select id="selectByPrimaryKeyAll" resultMap="selectTasksAllLeftUsers" parameterType="java.lang.Integer" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
t.id, t.tasknumber, t.taskstarttime, t.taskendtime, t.taskclass, t.taskinfo, t.taskstatus, t.uid, t.executiontime,
u.numbers, u.name, u.positionid, u.phone, u.status, u.jurisdiction, u.deptid, u.currenttask, u.state,
d.deptnumber, d.deptname, p.positionname, p.positionnumber
from tasks t left join users u on t.uid = u.id
left join dept d on u.deptid = d.id
left join position p on u.positionid = p.positionid
</select>
2.实体类写法
package nanh.entity;
import java.io.Serializable;
public class Tasks implements Serializable{
private Users Users;
public Users getUsers() {
return Users;
}
public void setUsers(Users users) {
Users = users;
}
@Override
public String toString() {
return "Tasks [Users=" + Users + ", id=" + id + ", tasknumber=" + tasknumber + ", taskstarttime="
+ taskstarttime + ", taskendtime=" + taskendtime + ", taskclass=" + taskclass + ", taskinfo=" + taskinfo
+ ", taskstatus=" + taskstatus + ", uid=" + uid + ", executiontime=" + executiontime + "]";
}
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column tasks.id
*
* @mbggenerated
*/
private Integer id;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column tasks.tasknumber
*
* @mbggenerated
*/
private String tasknumber;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column tasks.taskstarttime
*
* @mbggenerated
*/
private String taskstarttime;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column tasks.taskendtime
*
* @mbggenerated
*/
private String taskendtime;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column tasks.taskclass
*
* @mbggenerated
*/
private String taskclass;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column tasks.taskinfo
*
* @mbggenerated
*/
private String taskinfo;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column tasks.taskstatus
*
* @mbggenerated
*/
private String taskstatus;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column tasks.uid
*
* @mbggenerated
*/
private Integer uid;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column tasks.executiontime
*
* @mbggenerated
*/
private String executiontime;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column tasks.id
*
* @return the value of tasks.id
*
* @mbggenerated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column tasks.id
*
* @param id the value for tasks.id
*
* @mbggenerated
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column tasks.tasknumber
*
* @return the value of tasks.tasknumber
*
* @mbggenerated
*/
public String getTasknumber() {
return tasknumber;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column tasks.tasknumber
*
* @param tasknumber the value for tasks.tasknumber
*
* @mbggenerated
*/
public void setTasknumber(String tasknumber) {
this.tasknumber = tasknumber == null ? null : tasknumber.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column tasks.taskstarttime
*
* @return the value of tasks.taskstarttime
*
* @mbggenerated
*/
public String getTaskstarttime() {
return taskstarttime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column tasks.taskstarttime
*
* @param taskstarttime the value for tasks.taskstarttime
*
* @mbggenerated
*/
public void setTaskstarttime(String taskstarttime) {
this.taskstarttime = taskstarttime == null ? null : taskstarttime.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column tasks.taskendtime
*
* @return the value of tasks.taskendtime
*
* @mbggenerated
*/
public String getTaskendtime() {
return taskendtime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column tasks.taskendtime
*
* @param taskendtime the value for tasks.taskendtime
*
* @mbggenerated
*/
public void setTaskendtime(String taskendtime) {
this.taskendtime = taskendtime == null ? null : taskendtime.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column tasks.taskclass
*
* @return the value of tasks.taskclass
*
* @mbggenerated
*/
public String getTaskclass() {
return taskclass;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column tasks.taskclass
*
* @param taskclass the value for tasks.taskclass
*
* @mbggenerated
*/
public void setTaskclass(String taskclass) {
this.taskclass = taskclass == null ? null : taskclass.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column tasks.taskinfo
*
* @return the value of tasks.taskinfo
*
* @mbggenerated
*/
public String getTaskinfo() {
return taskinfo;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column tasks.taskinfo
*
* @param taskinfo the value for tasks.taskinfo
*
* @mbggenerated
*/
public void setTaskinfo(String taskinfo) {
this.taskinfo = taskinfo == null ? null : taskinfo.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column tasks.taskstatus
*
* @return the value of tasks.taskstatus
*
* @mbggenerated
*/
public String getTaskstatus() {
return taskstatus;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column tasks.taskstatus
*
* @param taskstatus the value for tasks.taskstatus
*
* @mbggenerated
*/
public void setTaskstatus(String taskstatus) {
this.taskstatus = taskstatus == null ? null : taskstatus.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column tasks.uid
*
* @return the value of tasks.uid
*
* @mbggenerated
*/
public Integer getUid() {
return uid;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column tasks.uid
*
* @param uid the value for tasks.uid
*
* @mbggenerated
*/
public void setUid(Integer uid) {
this.uid = uid;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column tasks.executiontime
*
* @return the value of tasks.executiontime
*
* @mbggenerated
*/
public String getExecutiontime() {
return executiontime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column tasks.executiontime
*
* @param executiontime the value for tasks.executiontime
*
* @mbggenerated
*/
public void setExecutiontime(String executiontime) {
this.executiontime = executiontime == null ? null : executiontime.trim();
}
}
Mysql 多表连查 xml写法 非注解形式的更多相关文章
- spring mvc 非注解形式
目录(?)[+] webxml配置文件 注如果使用注解可以加上-- servlet上下文配置文件 test-servletxml 实体类Empjava StartController控制器 控制器Em ...
- SpringAOP的xml实例、注解形式实例、概念理解 以及execution表达式实例与概念说明
(1)Spring AOP的简单应用: -->AOP:(Aspect Orinted Programming)面向切面编程,用于具有横切逻辑的场合,如:访问控制,事务管理,性能检测,由切入点和增 ...
- mysql 建表、查表、查表结构
进入数据库: mysql> use sunshine_blog;输出: Database changed 查数据库表: mysql> show tables;输出: +---------- ...
- MySql获取表的字段名称、字段注解、字段类型、字段长度
SELECT COLUMN_NAME as '列名',COLUMN_COMMENT,DATA_TYPE as '字段类型' ,COLUMN_TYPE as '长度加类型' FROM informat ...
- Mysql建表通用写法
Mysql建表通用写法 CREATE TABLE IF NOT EXISTS stu( id ) PRIMARY KEY AUTO_INCREMENT,//主键 自增 stuname ) NOT NU ...
- mysql 数据表的增删改查 目录
mysql 表的增删改查 mysql 表的增删改查 修改表结构 mysql 复制表 mysql 删除表
- Mysql数据表的增删改查
---恢复内容开始--- Mysql数据表的增删改查 1.创建表 语法:CREATE TABLE 表名(字段1,字段2,字段3.......) CREATE TABLE `users` ( `us ...
- mysql 关于表与字段的增删改查操作
1.mysql 命令登陆 形式: mysql -u用户名 -p密码 mysql -uroot -proot 2.mysql 显示数据库 形式: show databases; 3.mysql 进入某一 ...
- mysql数据表增删改查
http://www.runoob.com/mysql/mysql-tutorial.html 一.MySQL 创建数据表 创建MySQL数据表需要以下信息: 表名 表字段名 定义每个表字段 语法 以 ...
随机推荐
- 虚拟化技术之kvm管理工具virsh常用基础命令(一)
在上一篇博客中,我们了解了KVM基础架构和部署以及图形管理工具virt-manager安装虚拟机的过程,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/13499 ...
- 【异常检测】孤立森林(Isolation Forest)算法简介
简介 工作的过程中经常会遇到这样一个问题,在构建模型训练数据时,我们很难保证训练数据的纯净度,数据中往往会参杂很多被错误标记噪声数据,而数据的质量决定了最终模型性能的好坏.如果进行人工二次标记,成本会 ...
- PAT 2-08. 用扑克牌计算24点(25):
题目链接:http://www.patest.cn/contests/ds/2-08 解题思路:思路参考24点游戏技巧http://www.24game.com.cn/articles/points2 ...
- oracle 分页的两种方式
实例:查询5-8名学生的姓名与成绩 --oracle的分页1 between 方式(分三次查询,第一次只作排序,第二次给表加上rownum序列,第三次为查询结果) select s.scorenumb ...
- golang IPv6 转 十进制
IPv4 互换: package main import ( "fmt" "math/big" "net" ) func InetNtoA( ...
- 操作系统-存储管理(6)buffer/cache/swap
为了提高文件系统性能,内核利用一部分物理内存分配出缓冲区,用于缓存系统操作和数据文件,当内核收到读写的请求时,内核先去缓存区找是否有请求的数据,有就直接返回,如果没有则通过驱动程序直接操作磁盘. 缓存 ...
- Java 8新特性(四):新的时间和日期API
Java 8另一个新增的重要特性就是引入了新的时间和日期API,它们被包含在java.time包中.借助新的时间和日期API可以以更简洁的方法处理时间和日期. 在介绍本篇文章内容之前,我们先来讨论Ja ...
- java23种设计模式—— 二、单例模式
源码在我的github和gitee中获取 介绍 单例模式(Singleton Pattern)是 Java 中最简单的设计模式之一.这种类型的设计模式属于创建型模式,它提供了一种创建对象的最佳方式. ...
- mybatis逆向工程介绍
项目的model一旦多了起来,复杂了起来,我们很自然的想到使用mybatis的逆向工程来生成相应的pojo和mapper,能节省很多精力. MyBatis Generator(MBG)是 MyBati ...
- cookies、sessionStorage和localStorage
浏览器的缓存机制提供了可以将用户数据存储在客户端上的方式,可以利用cookie,session等跟服务端进行数据交互.浏览器查看方式: HTML4的本地存储 cookie 一.cookie和sess ...