@ -0,0 +1,44 @@
|
|||||||
|
<?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.dao.IDepartmentDao">
|
||||||
|
<!--查询所有部门信息-->
|
||||||
|
<select id="findAllDepartment" resultType="com.entity.Department">
|
||||||
|
select * from t_dept;
|
||||||
|
</select>
|
||||||
|
<!--根据id查找部门-->
|
||||||
|
<select id="findDeptById" resultType="com.entity.Department" parameterType="int">
|
||||||
|
select * from t_dept where id = #{id};
|
||||||
|
</select>
|
||||||
|
<!--按页数查找部门信息-->
|
||||||
|
<select id="listDept" resultType="com.entity.Department">
|
||||||
|
select * from t_dept
|
||||||
|
<if test="start!=null and count!=null">
|
||||||
|
limit #{start},#{count}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<!--添加部门-->
|
||||||
|
<insert id="insertDept" parameterType="com.entity.Department">
|
||||||
|
insert into t_dept(deptId, deptName) values(#{deptId}, #{deptName});
|
||||||
|
</insert>
|
||||||
|
<!--修改部门信息-->
|
||||||
|
<update id="modifyDept" parameterType="com.entity.Department">
|
||||||
|
update t_dept set deptId = #{deptId}, deptName = #{deptName} where id = #{id}
|
||||||
|
</update>
|
||||||
|
<!--根据名称查找部门-->
|
||||||
|
<select id="searchByName" parameterType="Map" resultType="com.entity.Department">
|
||||||
|
select * from t_dept where deptName like #{deptName}
|
||||||
|
<if test="page.start!=null and page.count!=null">
|
||||||
|
limit #{page.start},#{page.count}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<!--获取记录总数-->
|
||||||
|
<select id="getDeptTotal" resultType="int">
|
||||||
|
select count(*) from t_dept;
|
||||||
|
</select>
|
||||||
|
<!--根据id查找部门信息-->
|
||||||
|
<delete id="deleteDept" parameterType="int">
|
||||||
|
delete from t_dept where id = #{id}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
@ -0,0 +1,53 @@
|
|||||||
|
<?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.dao.IEmployeeDao">
|
||||||
|
<!--查询所有员工信息-->
|
||||||
|
<select id="findAllEmp" resultType="com.entity.Employee">
|
||||||
|
select * from t_emp;
|
||||||
|
</select>
|
||||||
|
<!--按页数查找员工信息-->
|
||||||
|
<select id="listEmp" resultType="com.entity.Employee">
|
||||||
|
select * from t_emp
|
||||||
|
<if test="start!=null and count!=null">
|
||||||
|
limit #{start},#{count}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<!--根据条件查找员工信息-->
|
||||||
|
<select id="searchEmp" parameterType="Map" resultType="com.entity.Employee">
|
||||||
|
select * from t_emp where 1=1
|
||||||
|
<if test="name!=null">
|
||||||
|
and name like #{name}
|
||||||
|
</if>
|
||||||
|
<if test="email!=null">
|
||||||
|
and email = #{email}
|
||||||
|
</if>
|
||||||
|
<if test="empId!=null">
|
||||||
|
and empId = #{empId}
|
||||||
|
</if>
|
||||||
|
<if test="page.start!=null and page.count!=null">
|
||||||
|
limit #{page.start},#{page.count}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<!--添加员工-->
|
||||||
|
<insert id="addEmp" parameterType="com.entity.Employee">
|
||||||
|
insert into t_emp(empId, name, gender, email, birth, deptId) values(#{empId}, #{name}, #{gender}, #{email}, #{birth}, #{deptId});
|
||||||
|
</insert>
|
||||||
|
<!--修改员工信息-->
|
||||||
|
<update id="modifyEmp" parameterType="com.entity.Employee">
|
||||||
|
update t_emp set empId = #{empId}, name = #{name}, gender = #{gender}, email = #{email}, birth = #{birth}, deptId = #{deptId} where id = #{id}
|
||||||
|
</update>
|
||||||
|
<!--获取记录总数-->
|
||||||
|
<select id="getEmpTotal" resultType="int">
|
||||||
|
select count(*) from t_emp;
|
||||||
|
</select>
|
||||||
|
<!--根据id查找员工-->
|
||||||
|
<select id="selectEmpById" resultType="com.entity.Employee">
|
||||||
|
select * from t_emp where id = #{id};
|
||||||
|
</select>
|
||||||
|
<!--删除员工-->
|
||||||
|
<delete id="deleteEmp" parameterType="int">
|
||||||
|
delete from t_emp where id = #{id}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
@ -0,0 +1,20 @@
|
|||||||
|
<?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">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 设置为IUserDao接口方法提供sql语句配置 -->
|
||||||
|
<mapper namespace="com.dao.ITestDao">
|
||||||
|
|
||||||
|
<select id="findAll" resultType="com.entity.TestEntity">
|
||||||
|
select * from t_test;
|
||||||
|
</select>
|
||||||
|
<select id="list" resultType="com.entity.TestEntity">
|
||||||
|
select * from t_test
|
||||||
|
<if test="start!=null and count!=null">
|
||||||
|
limit #{start},#{count}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<select id="total" resultType="int">
|
||||||
|
select count(*) from t_test;
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -1,6 +1,27 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
|
||||||
|
|
||||||
</beans>
|
|
||||||
|
<!-- 设置为IUserDao接口方法提供sql语句配置 -->
|
||||||
|
<mapper namespace="com.dao.IUserDao">
|
||||||
|
<!--根据id查找用户-->
|
||||||
|
<select id="findById" resultType="com.entity.User" parameterType="Integer">
|
||||||
|
select * from t_user where id = #{id};
|
||||||
|
</select>
|
||||||
|
<!--根据用户名和密码查找用户-->
|
||||||
|
<select id="findByNameAndPwd" resultType="com.entity.User" parameterType="Map">
|
||||||
|
select * from t_user where name = #{name} and password = #{password};
|
||||||
|
</select>
|
||||||
|
<!--添加用户-->
|
||||||
|
<insert id="insertUser" parameterType="com.entity.User">
|
||||||
|
insert into t_user(name, password, identity, telNumber, idCard, email) values(#{name}, #{password}, #{identity}, #{telNumber}, #{idCard}, #{email});
|
||||||
|
</insert>
|
||||||
|
<!--修改用户-->
|
||||||
|
<update id="modifyUser" parameterType="com.entity.User">
|
||||||
|
update t_user set name = #{name}, identity = #{identity}, telNumber = #{telNumber}, idCard = #{idCard}, email = #{email} where id = #{id}
|
||||||
|
</update>
|
||||||
|
<!--修改用户密码-->
|
||||||
|
<update id="modifyPwd" parameterType="Map">
|
||||||
|
update t_user set password = #{password} where id = #{id}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
@ -0,0 +1,29 @@
|
|||||||
|
<?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.dao.IVisitorDao">
|
||||||
|
<!--按页数查找访客信息-->
|
||||||
|
<select id="listVisitor" resultType="com.entity.Visitor">
|
||||||
|
select * from t_visitor
|
||||||
|
<if test="start!=null and count!=null">
|
||||||
|
limit #{start},#{count}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--获取记录总数-->
|
||||||
|
<select id="getVisitorTotal" resultType="int">
|
||||||
|
select count(*) from t_visitor;
|
||||||
|
</select>
|
||||||
|
<insert id="addVisitor" parameterType="com.entity.Visitor">
|
||||||
|
insert into t_visitor(name, identity, telPhone, email, visitTime) values(#{name}, #{identity}, #{telPhone}, #{email}, #{visitTime});
|
||||||
|
</insert>
|
||||||
|
<!--根据名称查找访客信息-->
|
||||||
|
<select id="searchByName" parameterType="Map" resultType="com.entity.Visitor">
|
||||||
|
select * from t_visitor where name like #{name}
|
||||||
|
<if test="page.start!=null and page.count!=null">
|
||||||
|
limit #{page.start},#{page.count}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in new issue