https://www.yuque.com/docs/share/fe42dbdb-7d33-4ea9-9021-48bfcb67411b?# 《数据库》
目录
3.3.6.6、多表查询时字段名与属性名不一致(一对一|多对一)
3.3.6、接口绑定方案
以下实现接口时默认已经以javabean规范创建了与表对应的实体类
接口的命名与映射文件一致 (表名Mapper.java | 表名Mapper.xml)
实体类命名与对应表名一致 (表名.java)
Dept类
public class Dept {
private int id;
private String name;
private String loc;
public Dept() {
}
public Dept(int id, String name, String loc) {
this.id = id;
this.name = name;
this.loc = loc;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLoc() {
return loc;
}
public void setLoc(String loc) {
this.loc = loc;
}
@Override
public String toString() {
return "Dept{" +
"id=" + id +
", name='" + name + '\'' +
", loc='" + loc + '\'' +
'}';
}
}Emp类
public class Emp {
private int empno;
private String ename;
private double sal;
private String job;
private double comm;
private int mgr;
private Date hiredate;
private int deptno;
//属性: javabean : 员工对象所在的部门信息
private Dept pddDept;
public Emp() {
}
public Emp(int empno, String ename, double sal, String job, double comm, int mgr, Date hiredate, int deptno) {
this.empno = empno;
this.ename = ename;
this.sal = sal;
this.job = job;
this.comm = comm;
this.mgr = mgr;
this.hiredate = hiredate;
this.deptno = deptno;
}
public Dept getPddDept() {
return pddDept;
}
public void setPddDept(Dept pddDept) {
this.pddDept = pddDept;
}
public int getEmpno() {
return empno;
}
public void setEmpno(int empno) {
this.empno = empno;
}
public String getEname() {
return ename;
}
public void setEname(String ename) {
this.ename = ename;
}
public double getSal() {
return sal;
}
public void setSal(double sal) {
this.sal = sal;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}
public double getComm() {
return comm;
}
public void setComm(double comm) {
this.comm = comm;
}
public int getMgr() {
return mgr;
}
public void setMgr(int mgr) {
this.mgr = mgr;
}
public Date getHiredate() {
return hiredate;
}
public void setHiredate(Date hiredate) {
this.hiredate = hiredate;
}
public int getDeptno() {
return deptno;
}
public void setDeptno(int deptno) {
this.deptno = deptno;
}
@Override
public String toString() {
return "Emp{" +
"empno=" + empno +
", ename='" + ename + '\'' +
", sal=" + sal +
", job='" + job + '\'' +
", comm=" + comm +
", mgr=" + mgr +
", hiredate=" + hiredate +
", deptno=" + deptno +
", pddDept=" + pddDept +
'}';
}
}3.3.6.1、实现方式
1)同名接口
/*
接口绑定方案下的接口 :
*/
public interface DeptMapper {
// 查询所有的部门信息
public List<Dept> queryAll();
}2)同名sql映射文件
<?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">
<!--
1.接口与SQL映射文件名字要保持一致,并放在同一个包下
2.SQL映射文件的命名空间namespace定义为与之绑定的接口的包名.类名
3.SQL标签的id属性值与接口中所对应的抽象方法的方法名保持一致
4.SQL语句的参数与返回值要求与对应的抽象方法的参数与返回值保持一致
-->
<mapper namespace="com.yjxxt.mappers.DeptMapper">
<!--查询所有的部门信息-->
<select id="queryAll" resultType="Dept">
select * from dept
</select>
</mapper>3)mybatis添加项
<!--扫描接口 : 接口绑定方案-->
<mappers>
<!--<mapper class="com.yjxxt.mappers.DeptMapper"/>
<mapper class="com.yjxxt.mappers.EmpMapper"/>-->
<package name="com.yjxxt.mappers"/> <!--包扫描-->
</mappers>4)接口测试类
/*
测试接口绑定方案
步骤 :
1.定义接口,定义抽象功能
2.定义与接口绑定的SQL文件,定义SQL语句,按照要求进行定义
3.核心配置文件中通过Mapper扫描接口
4.在java代码中通过获取接口实现类对象调用功能
*/
public class Class001_InterfaceBind {
public static void main(String[] args) {
//1.获取会话
SqlSession session = SessionUtils.getSession();
//2.获取接口实现类对象--> 指定哪一个接口
DeptMapper mapper = session.getMapper(DeptMapper.class); //(接口名.class)
//3.调用方法
List<Dept> list = mapper.queryAll();
list.forEach(System.out::println);
//4.关闭会话
session.close();
}
}3.3.6.2、测试有参查询
1)同名接口
//测试带有参数的查询
public interface EmpMapper {
//根据员工编号查询员工信息
Emp queryEmpById(int empno);
//根据薪资与部门一起查询
List<Emp> queryEmpBySalDeptno(@Param("sal") double sal,@Param("dno") int deptno);
}2)同名sql映射文件
<?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="com.yjxxt.mappers.EmpMapper">
<!--根据员工编号查询员工信息-->
<select id="queryEmpById" resultType="emp" parameterType="int">
select * from emp where empno = #{empno}
</select>
<!--根据薪资与部门一起查询-->
<select id="queryEmpBySalDeptno" resultType="Emp">
<!--sql中如果出现多参数传递,可以实现,默认占位符的名字为 : [arg0,arg1|param1,param2]-->
<!--select * from emp where sal > #{arg0} and deptno = #{arg1}-->
<!--select * from emp where sal > #{param1} and deptno = #{param2}-->
select * from emp where sal > #{sal} and deptno = #{dno}
</select>
</mapper>3)mybatis添加项
采用包扫描时同包下的文件都会录入,无需修改
4)接口测试类
/*
测试有参数的查询
*/
public class Class002_Param {
public static void main(String[] args) {
//1.获取会话
SqlSession session = SessionUtils.getSession();
//2.获取接口实现类对象--> 指定哪一个接口
EmpMapper mapper = session.getMapper(EmpMapper.class);
//3.调用方法
//1个参数
Emp emp = mapper.queryEmpById(7369);
System.out.println(emp);
System.out.println("-----------------------");
//多个参数
List<Emp> list = mapper.queryEmpBySalDeptno(1500,30);
list.forEach(System.out::println);
//4.关闭会话
session.close();
}
}
3.3.6.3、测试接口下实现CRUD
1)同名接口
/*
接口绑定方案下实现CRUD :
*/
public interface DeptMapper2 {
//插入一个新的部门信息
int insertDept(Dept dept);
//根据部门编号修改部门名称
int updateDept(@Param("deptno") int deptno, @Param("dname") String dname);
//根据部门编号删除
int deleteDept(int deptno);
}2)同名sql映射文件
<?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">
<!--
接口绑定方案下实现CRUD
-->
<mapper namespace="com.yjxxt.mappers.DeptMapper2">
<!--插入一个新的部门信息-->
<insert id="insertDept" parameterType="dept">
insert into dept values(#{deptno},#{dname},#{loc})
</insert>
<!--根据部门编号修改部门名称-->
<update id="updateDept">
update dept set dname = #{dname} where deptno = #{deptno}
</update>
<!--根据部门编号删除-->
<delete id="deleteDept" parameterType="int">
delete from dept where deptno = #{deptno}
</delete>
</mapper>3)mybatis添加项
采用包扫描时同包下的文件都会录入,无需修改
4)接口测试类
/*
接口绑定方案下实现CRUD
*/
public class Class002_Update {
public static void main(String[] args) {
//1.获取会话
SqlSession session = SessionUtils.getSession();
//2.获取接口实现类对象--> 指定哪一个接口
DeptMapper2 mapper = session.getMapper(DeptMapper2.class);
//3.调用方法
//1个参数
//int rows = mapper.insertDept(new Dept(66,"六部","上海"));
//int rows = mapper.updateDept(66,"六六六部");
int rows = mapper.deleteDept(66);
System.out.println(rows>0?"操作成功":"失败");
//4.关闭会话
session.close();
}
}3.3.6.4、测试接口下实现动态Sql
1)同名接口
/*
测试动态SQL
*/
public interface EmpMapper {
/*
两个参数的实参都无效,查询所有员工信息
如果员工姓名参数有效,部门编号无效,根据员工姓名查询员工信息
如果员工姓名参数无效,部门编号有效,根据员工部门编号查询员工信息
如果两个参数有效,根据员工姓名以及部门编号一起查询员工信息
参数无效 : =null | =''|=0
*/
List<Emp> queryEmp(@Param("ename") String ename,@Param("deptno") int deptno);
/*
两个参数都无效,查询所有的员工信息
如果员工编号有效,无论员工姓名是否否有效,都只根据员工编号查询
如果员工编号无效,员工姓名有效,根究员工姓名查询
*/
List<Emp> queryEmpByIdName(@Param("empno") int empno,@Param("ename") String ename);
//根据员工编号修改员工姓名,如果存在有效的员工薪资,修改姓名与薪资
int updateEmp(Emp emp);
//根据员工姓名模糊查询员工信息
List<Emp> queryEmpByNameLike(String ename);
//根据多个员工编号查询员工信息
List<Emp> queryEmpByIdSome(List<Integer> list);
}
2)同名sql映射文件
<?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="com.yjxxt.mappers.EmpMapper">
<!--封装-->
<sql id="empField">
empno,ename,hiredate,job,sal,comm,deptno
</sql>
<!--if..while-->
<select id="queryEmp" resultType="emp">
select * from emp <!--where 1=1-->
<!--
where : 代替恒等式 where 1=1
在有条件的时候回自动在当前select语句中拼接where关键字
在没有条件的时候,不会拼接where关键字
-->
<where>
<!--
if 标签用户做条件判断
test : 用于设置判断条件,类似if语句的()
会自动帮助把第一个满足条件的if标签中的and关键字去掉
-->
<if test="ename!=null and ename!=''">
and ename=#{ename}
</if>
<if test="deptno!=0">
and deptno=#{deptno}
</if>
</where>
</select>
<!--choose...when...otherwise-->
<select id="queryEmpByIdName" resultType="emp">
select * from emp
<where>
<choose> <!--相当于switch-->
<when test="empno!=0"> <!--case-->
and empno = #{empno}
</when>
<when test="ename!=null and ename!=''"> <!--case-->
and ename=#{ename}
</when>
</choose>
</where>
</select>
<!--set-->
<!--<update id="updateEmp" parameterType="Emp">
update emp
<!–
set :用户维护epdate语句的set自语句,与where标签类似
如果满足条件,自动添加set关键字
如果不满足,不拼接set
如果最后一个自语句存在多余的,会自动去掉多余的逗号,
–>
<set>
ename = #{ename},
<if test="sal!=0">
sal=#{sal}
</if>
</set>
where empno = #{empno}
</update>-->
<!--trim-->
<update id="updateEmp" parameterType="Emp">
update emp
<!--
trim
1. prefix, 在前面添加内容
2. prefixOverrides, 从前面去除内容
3. suffix, 向后面添加内容
4. suffixOverrides, 从后面去除内容
-->
<trim prefix="set" suffixOverrides=",">
ename = #{ename},
<if test="sal!=0">
sal=#{sal}
</if>
</trim>
where empno = #{empno}
</update>
<!--bind-->
<select id="queryEmpByNameLike" parameterType="string" resultType="emp">
<bind name="ename" value="'%'+ename+'%'"/>
select empno,ename,hiredate,job,sal,comm,deptno from emp where ename like #{ename}
</select>
<!--foreach-->
<select id="queryEmpByIdSome" resultType="emp">
select <include refid="empField"/> from emp where empno in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</select>
</mapper>3)mybatis添加项
采用包扫描时同包下的文件都会录入,无需修改
<!--扫描接口 : 接口绑定方案-->
<mappers>
<package name="com.yjxxt.mappers"/> <!--包扫描-->
</mappers>
4)接口测试类
/*
测试动态SQL
*/
public class Class001_IfWhile {
public static void main(String[] args) {
//1.获取会话
SqlSession session = SessionUtils.getSession();
//2.获取接口实现类对象--> 指定哪一个接口
EmpMapper mapper = session.getMapper(EmpMapper.class);
//3.调用方法
//List<Emp> list = mapper.queryEmp("",0);
//List<Emp> list = mapper.queryEmpByIdName(0,"");
//list.forEach(System.out::println);
/*Emp emp = new Emp();
emp.setEmpno(9999);
emp.setEname("SMITH");
mapper.updateEmp(emp);*/
/*List<Emp> list = mapper.queryEmpByNameLike("A");
list.forEach(System.out::println);*/
List<Emp> list = mapper.queryEmpByIdSome(List.of(7369,7499));
list.forEach(System.out::println);
//4.关闭会话
session.close();
}
}3.3.6.5、单表查询时字段名与属性名不一致
1)同名接口
/*
测试字段名与属性名不一致情况
*/
public interface DeptMapper {
List<Dept> queryAll();
}2)同名sql映射文件
<?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">
<!--
测试字段名与属性名不一致情况
如果查询时使用 resultType 属性, 表示采用 MyBatis 的Auto-Mapping(自动映射)机制, 即相同的列名(结果集中的字段名)和属性名会自动匹配.
1)通过resultMap标签自定义表与javabean类型的映射情况
不同名的字段必须手动设置映射关系
同名的字段可以不设置,默认会根据自动映射机制找同名
2)为字段起别名
要求字段的别名与类型对应的属性名保持一致
-->
<mapper namespace="com.yjxxt.mappers.DeptMapper">
<!--方法一、自定义结果的映射关系-->
<resultMap id="deptMap" type="Dept">
<!--id : 定义主键字段与属性的映射关系-->
<id column="deptno" property="id"/>
<!--id : 定义非主键字段与属性的映射关系-->
<result column="dname" property="name" />
<!--<result column="loc" property="loc" />-->
</resultMap>
<!--resultMap-->
<!--<select id="queryAll" resultMap="deptMap">
select * from dept
</select>-->
<!--方法二、别名实现-->
<select id="queryAll" resultType="dept">
select deptno id,dname name,loc from dept
</select>
</mapper>3)核心配置文件
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<!--根元素-->
<configuration>
<!-- 加载外部的properties文件 -->
<properties resource="db.properties" />
<!--为类型定义别名-->
<typeAliases>
<package name="com.yjxxt.pojo"/>
</typeAliases>
<environments default="dev">
<environment id="dev">
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<!--定义数据库的连接参数-->
<property name="driver" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
</dataSource>
</environment>
</environments>
<!--扫描接口绑定方案-->
<mappers>
<!--扫描一个指定的接口-->
<!--<mapper class="com.yjxxt.mappers.DeptMapper"/>-->
<!--扫描一个包下的所有接口-->
<package name="com.yjxxt.mappers"/>
</mappers>
</configuration>4)接口测试类
/*
测试字段名与属性名不一致情况
*/
public class Class001_Test {
public static void main(String[] args) throws IOException {
//获取回话
SqlSession session = SessionUtils.getSession();
//获取接口的实现类对象
DeptMapper mapper = session.getMapper(DeptMapper.class);
//通过实现类对象调用重写后的方法
List<Dept> list = mapper.queryAll();
//关闭回话
session.close();
}
}3.3.6.6、多表查询时字段名与属性名不一致(一对一|多对一)
第一步:对一个实体类的私有属性设置为javabean类型
public class Emp {
private int empno;
private String ename;
private double sal;
private String job;
private double comm;
private int mgr;
private Date hiredate;
private int deptno;
//属性: javabean : 员工对象所在的部门信息
private Dept pddDept;第二步:对sql映射文件<resultMap>标签中
设置<association>标签定义javabean类型属性与字段的映射关系
实现多表连接查询
<!--自定义结果集中的字段与javabean类中属性的映射关系-->
<resultMap id="EmpDept" type="Emp">
<!--主键字段与属性的映射关系-->
<id column="empno" property="empno"></id>
<!--非主键字段与属性的映射关系-->
<result column="ename" property="ename"></result>
<result column="job" property="job"></result>
<result column="mgr" property="mgr"></result>
<result column="hiredate" property="hiredate"></result>
<result column="sal" property="sal"></result>
<result column="comm" property="comm"></result>
<result column="deptno" property="deptno"></result>
<!--association : 定义javabean类型属性与字段的映射关系-->
<association property="pddDept" javaType="Dept">
<id property="id" column="deptno" />
<result property="name" column="dname" />
<result property="loc" column="loc" />
</association>
</resultMap>1)同名接口
/*
resultMap 的关联方式实现多表查询(一对一|多对一)
*/
public interface EmpMapper {
//查询每一个员工信息以及员工所在的部门信息
List<Emp> queryEmpDept();
}2)同名sql映射文件
<?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">
<!--
关系映射查询
resultMap 的关联方式实现多表查询(一对一|多对一)
-->
<mapper namespace="com.yjxxt.mappers.EmpMapper">
<!--自定义结果集中的字段与javabean类中属性的映射关系-->
<resultMap id="EmpDept" type="Emp">
<!--主键字段与属性的映射关系-->
<id column="empno" property="empno"></id>
<!--非主键字段与属性的映射关系-->
<result column="ename" property="ename"></result>
<result column="job" property="job"></result>
<result column="mgr" property="mgr"></result>
<result column="hiredate" property="hiredate"></result>
<result column="sal" property="sal"></result>
<result column="comm" property="comm"></result>
<result column="deptno" property="deptno"></result>
<!--association : 定义javabean类型属性与字段的映射关系-->
<association property="pddDept" javaType="Dept">
<id property="id" column="deptno" />
<result property="name" column="dname" />
<result property="loc" column="loc" />
</association>
</resultMap>
<select id="queryEmpDept" resultMap="EmpDept">
select empno,ename,job,mgr,hiredate,sal,comm,emp.deptno,dname,loc from emp join dept on emp.deptno = dept.deptno
</select>
</mapper>3)核心配置文件
采用包扫描时同包下的文件都会录入,无需修改
4)接口测试类
/*
测试字段名与属性名不一致情况
*/
public class Class002_EmpDeptTest {
public static void main(String[] args) throws IOException {
//获取回话
SqlSession session = SessionUtils.getSession();
//获取接口的实现类对象
EmpMapper mapper = session.getMapper(EmpMapper.class);
//通过实现类对象调用重写后的方法
List<Emp> list = mapper.queryEmpDept();
list.forEach(System.out::println);
//关闭回话
session.close();
}
}
3.3.6.7、多表查询时字段名与属性名不一致(一对多)
1)同名接口
/*
resultMap 的关联方式实现多表查询(一对 多)
部门与员工 : 一对多
*/
public interface DeptMapper {
//查询所有部门信息以及每个部门所在的员工
List<Dept> queryAll();
}2)同名sql映射文件
<?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="com.yjxxt.mappers.DeptMapper">
<!--自定义结果的映射关系-->
<resultMap id="deptMap" type="Dept">
<!--id : 定义主键字段与属性的映射关系-->
<id column="deptno" property="id"/>
<!--id : 定义非主键字段与属性的映射关系-->
<result column="dname" property="name" />
<result column="loc" property="loc" />
<!--属性为List集合,使用collection标签定义 ofType:集合中数据的类型-->
<collection property="empList" javaType="List"
ofType="Emp">
<id property="empno" column="empno" />
<result property="ename" column="ename" />
<result property="job" column="job" />
<result property="mgr" column="mgr" />
<result property="hiredate" column="hiredate" />
<result property="sal" column="sal" />
<result property="comm" column="comm" />
<result property="deptno" column="deptno" />
</collection>
</resultMap>
<select id="queryAll" resultMap="deptMap">
select dept.deptno,dname,loc,empno,ename,job,mgr,hiredate,sal,comm from dept left join emp on emp.deptno = dept.deptno
</select>
</mapper>3)核心配置文件
采用包扫描时同包下的文件都会录入,无需修改
<!--扫描接口绑定方案-->
<mappers>
<!--扫描一个指定的接口-->
<!--<mapper class="com.yjxxt.mappers.DeptMapper"/>-->
<!--扫描一个包下的所有接口-->
<package name="com.yjxxt.mappers"/>
</mappers>
4)接口测试类
/*
测试多表查询(一对多)
*/
public class Class001_Test {
public static void main(String[] args) throws IOException {
//获取回话
SqlSession session = SessionUtils.getSession();
//获取接口的实现类对象
DeptMapper mapper = session.getMapper(DeptMapper.class);
//通过实现类对象调用重写后的方法
List<Dept> list = mapper.queryAll();
list.forEach(System.out::println);
//关闭回话
session.close();
}
}3.3.6.8、接口注解开发
1)同名接口
/*
接口注解开发
*/
public interface DeptMapper {
// 查询所有的部门信息
@Select("select * from dept")
public List<Dept> queryAll();
//插入一个新的部门信息
int insertDept(Dept dept);
//根据部门编号修改部门名称
int updateDept(@Param("deptno") int deptno, @Param("dname") String dname);
//根据部门编号删除
int deleteDept(int deptno);
}2)同名sql映射文件
简单无参sql语句可以直接用注解编写无需创建该文件
<?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="com.yjxxt.mappers.DeptMapper">
<!--查询所有的部门信息-->
<!--<select id="queryAll" resultType="Dept">
select * from dept
</select>-->
<!--插入一个新的部门信息-->
<insert id="insertDept" parameterType="dept">
insert into dept values(#{deptno},#{dname},#{loc})
</insert>
<!--根据部门编号修改部门名称-->
<update id="updateDept">
update dept set dname = #{dname} where deptno = #{deptno}
</update>
<!--根据部门编号删除-->
<delete id="deleteDept" parameterType="int">
delete from dept where deptno = #{deptno}
</delete>
</mapper>3)核心配置文件
采用包扫描时同包下的文件都会录入,无需修改
<!--扫描接口 : 接口绑定方案-->
<mappers>
<package name="com.yjxxt.mappers"/> <!--包扫描-->
</mappers>
4)接口测试类
/*
测试注解开发
*/
public class Class001_Anno {
public static void main(String[] args) {
//1.获取会话
SqlSession session = SessionUtils.getSession();
//2.获取接口实现类对象--> 指定哪一个接口
DeptMapper mapper = session.getMapper(DeptMapper.class);
//3.调用方法
List<Dept> list = mapper.queryAll();
list.forEach(System.out::println);
mapper.deleteDept(70);
//4.关闭会话
session.close();
}
}