60 lines
1.4 KiB
Java
60 lines
1.4 KiB
Java
package com.baiyun.dao;
|
|
|
|
import java.util.List;
|
|
|
|
import org.apache.ibatis.annotations.Delete;
|
|
import org.apache.ibatis.annotations.Insert;
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
import org.apache.ibatis.annotations.Select;
|
|
import org.apache.ibatis.annotations.Update;
|
|
import org.springframework.stereotype.Repository;
|
|
|
|
import com.baiyun.enity.Departments;
|
|
|
|
/**
|
|
* @Description: TODO
|
|
* @author: bilibili
|
|
* @Date: 2021年6月16日
|
|
*/
|
|
|
|
@Mapper
|
|
@Repository
|
|
public interface DepartmentDao {
|
|
|
|
/*
|
|
* 列出所有的科室
|
|
*/
|
|
@Select("select * from departments")
|
|
List<Departments> listAllDepartments();
|
|
|
|
/*
|
|
* 添加科室
|
|
*/
|
|
@Insert("insert into departments(`id`,departmentName,`describe`) values(#{id},#{departmentName},#{describe})")
|
|
int addDepartment(Departments department);
|
|
|
|
/*
|
|
* 修改科室
|
|
*/
|
|
@Update("update departments set departmentName=#{departmentName},`describe`=#{describe} where id=#{id}")
|
|
int updateDepartment(Departments departments);
|
|
|
|
/*
|
|
* 根据id查找科室
|
|
*/
|
|
@Select("select * from departments where id=#{id}")
|
|
Departments findDepartmentById(int id);
|
|
|
|
/*
|
|
* 根据科室名查找科室
|
|
*/
|
|
@Select("select * from departments where departmentName=#{departmentName}")
|
|
List<Departments> findDepartmentByName(String name);
|
|
|
|
/*
|
|
* 根据id删除科室
|
|
*/
|
|
@Delete("delete from departments where id=#{id}")
|
|
int deleteDepartmentById(int id);
|
|
}
|