病友圈所属科室

master
王堂东 2023-11-03 08:39:55 +08:00
parent b5e3477c60
commit ff6ea9ec0e
6 changed files with 136 additions and 0 deletions

View File

@ -0,0 +1,46 @@
package com.february.patient.domain;
/**
* @program: february-patient-circle
* @description:
* @author: Mr.Wang
* @create: 2023-11-02 21:49
**/
/**
*
*/
public class Department {
/**
* id
*/
private Integer departmentId;
/**
*
*/
private String departmentName;
@Override
public String toString() {
return "Department{" +
"departmentId=" + departmentId +
", departmentName='" + departmentName + '\'' +
'}';
}
public Integer getDepartmentId() {
return departmentId;
}
public void setDepartmentId(Integer departmentId) {
this.departmentId = departmentId;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
}

View File

@ -0,0 +1,26 @@
package com.february.patient.controller;
import com.february.patient.domain.Department;
import com.february.patient.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @program: february-patient-circle
* @description:
* @author: Mr.Wang
* @create: 2023-11-02 21:53
**/
@RestController
@RequestMapping("/department")
public class DepartmentController {
@Autowired
private DepartmentService departmentService;
@PostMapping("/findById")
public Department findById(@RequestParam Integer departmentId){
return departmentService.findById(departmentId);
}
}

View File

@ -0,0 +1,14 @@
package com.february.patient.mapper;
import com.february.patient.domain.Department;
import org.apache.ibatis.annotations.Param;
/**
* @program: february-patient-circle
* @description:
* @author: Mr.Wang
* @create: 2023-11-02 21:53
**/
public interface DepartmentMapper {
Department findById(@Param("departmentId") Integer departmentId);
}

View File

@ -0,0 +1,13 @@
package com.february.patient.service;
import com.february.patient.domain.Department;
/**
* @program: february-patient-circle
* @description:
* @author: Mr.Wang
* @create: 2023-11-02 21:54
**/
public interface DepartmentService {
Department findById(Integer departmentId);
}

View File

@ -0,0 +1,23 @@
package com.february.patient.service.impl;
import com.february.patient.domain.Department;
import com.february.patient.mapper.DepartmentMapper;
import com.february.patient.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @program: february-patient-circle
* @description:
* @author: Mr.Wang
* @create: 2023-11-02 21:54
**/
@Service
public class DepartmentServiceImpl implements DepartmentService {
@Autowired
private DepartmentMapper departmentMapper;
@Override
public Department findById(Integer departmentId) {
return departmentMapper.findById(departmentId);
}
}

View File

@ -0,0 +1,14 @@
<?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.february.patient.mapper.DepartmentMapper">
<resultMap id="Department" type="com.february.patient.domain.Department">
<id property="departmentId" column="department_id" />
<result property="departmentName" column="department_name" />
</resultMap>
<select id="findById" resultMap="Department">
select department_id,department_name from t_department where department_id=#{departmentId}
</select>
</mapper>