You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.4 KiB

<?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="comxyp.mapper.DeptMapper">
<select id="findAll" resultType="comxyp.pojo.Dept">
select * from dept_table
<where>
<if test="deptname!=null and deptname!=''">
and deptname like concat('%',#{deptname},'%')
</if>
</where>
</select>
<!--部门添加-->
<insert id="addDept" parameterType="comxyp.pojo.Dept">
insert into dept_table(deptname,address,remark) values (#{deptname},#{address},#{remark})
</insert>
<!--部门修改-->
<update id="updateDept" parameterType="comxyp.pojo.Dept">
update dept_table
<set>
<if test="deptname!=null and deptname!=''">
deptname = #{deptname},
</if>
<if test="address!=null and address!=''">
address = #{address},
</if>
<if test="remark!=null and remark!=''">
remark = #{remark}
</if>
</set>
where id=#{id}
</update>
<delete id="deleteById">
delete from dept_table where id=#{id}
</delete>
<select id="selectDeptName" parameterType="comxyp.pojo.Dept" resultType="comxyp.pojo.Dept">
select * from dept_table;
</select>
</mapper>