
PersonalManagerMapper
package com.ping.systemManagement.personnelManager.mapper;
import com.ping.pojo.Post;
import com.ping.pojo.Staff;
import org.springframework.stereotype.Repository;
@Repository
public interface PersonnelManagerMapper {
// 添加人员信息
public Boolean addStaff(Staff staff);
// 修改人员信息
public Boolean updateStaff(Staff staff);
// 删除人员信息
public Boolean deleteStaff(int staffId);
// 查询人员基本信息
public Post getStaffInfo(String postName);
}
PersonalManagerMapper.xml
<?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.ping.systemManagement.personnelManager.mapper.PersonnelManagerMapper">
<!-- 添加人员信息-->
<insert id="addStaff">
insert into staffinfo(staffId,hospitalId,postId,departmentId,staffName,staffSex,staffAge,staffBirth,staffAddress,staffPhone)values (#{staffId},#{hospitalId},#{postId},#{departmentId},#{staffName},#{staffSex},#{staffAge},#{staffBirth},#{staffAddress},#{staffPhone})
</insert>
<!-- 修改人员信息-->
<update id="updateStaff">
update staffinfo set staffId=#{staffId},hospitalId=#{hospitalId},postId=#{postId},departmentId=#{departmentId},staffName=#{staffName},staffSex=#{staffSex},staffAge=#{staffAge},staffBirth=#{staffBirth},staffAddress=#{staffAddress},staffPhone=#{staffPhone}
</update>
<!-- 删除人员信息-->
<update id="deleteStaff">
delete into staffinfo(#{staffId},#{hospitalId},#{postId},#{departmentId},#{staffName},#{staffSex},#{staffAge},#{staffBirth},#{staffAddress},#{staffPhone}) where staffId=#{staffId}
</update>
<!-- 查询人员基本信息-->
<select id="getStaffInfo">
select staffId,hospitalId,postId,departmentId,staffName,staffSex,staffAge,staffBirth,staffAddress,staffPhone from staffinfo
<where>
<if test="postName!=null">
postName like concat('%',#{postName},'%')
</if>
</where>
</select>
</mapper>
本文介绍了一款人事管理系统的Mapper接口实现,通过MyBatis进行人员信息的增删改查操作。包括添加、修改、删除及查询人员基本信息。
1903

被折叠的 条评论
为什么被折叠?



