作业十三

在这里插入图片描述
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>

你可能感兴趣的:(实践)