From 2d395ff48cc17a0e957f9a1da7ad6067cb535825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A5=B6=E7=A7=8B=E9=9C=96?= <3435598628@qq.com> Date: Sat, 7 Dec 2024 18:27:59 +0800 Subject: [PATCH] e --- .../system/controller/DoctorController.java | 104 ++++++++++++++++++ java/com/ruoyi/system/domain/Doctor.java | 93 ++++++++++++++++ .../com/ruoyi/system/mapper/DoctorMapper.java | 61 ++++++++++ .../ruoyi/system/service/IDoctorService.java | 61 ++++++++++ .../service/impl/DoctorServiceImpl.java | 93 ++++++++++++++++ resources/mapper/system/DoctorMapper.xml | 71 ++++++++++++ 6 files changed, 483 insertions(+) create mode 100644 java/com/ruoyi/system/controller/DoctorController.java create mode 100644 java/com/ruoyi/system/domain/Doctor.java create mode 100644 java/com/ruoyi/system/mapper/DoctorMapper.java create mode 100644 java/com/ruoyi/system/service/IDoctorService.java create mode 100644 java/com/ruoyi/system/service/impl/DoctorServiceImpl.java create mode 100644 resources/mapper/system/DoctorMapper.xml diff --git a/java/com/ruoyi/system/controller/DoctorController.java b/java/com/ruoyi/system/controller/DoctorController.java new file mode 100644 index 0000000..15de11b --- /dev/null +++ b/java/com/ruoyi/system/controller/DoctorController.java @@ -0,0 +1,104 @@ +package com.ruoyi.system.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.Doctor; +import com.ruoyi.system.service.IDoctorService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 医生Controller + * + * @author 饶秋霖 + * @date 2024-12-06 + */ +@RestController +@RequestMapping("/system/doctor") +public class DoctorController extends BaseController +{ + @Autowired + private IDoctorService doctorService; + + /** + * 查询医生列表 + */ + @PreAuthorize("@ss.hasPermi('system:doctor:list')") + @GetMapping("/list") + public TableDataInfo list(Doctor doctor) + { + startPage(); + List list = doctorService.selectDoctorList(doctor); + return getDataTable(list); + } + + /** + * 导出医生列表 + */ + @PreAuthorize("@ss.hasPermi('system:doctor:export')") + @Log(title = "医生", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, Doctor doctor) + { + List list = doctorService.selectDoctorList(doctor); + ExcelUtil util = new ExcelUtil(Doctor.class); + util.exportExcel(response, list, "医生数据"); + } + + /** + * 获取医生详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:doctor:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(doctorService.selectDoctorById(id)); + } + + /** + * 新增医生 + */ + @PreAuthorize("@ss.hasPermi('system:doctor:add')") + @Log(title = "医生", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody Doctor doctor) + { + return toAjax(doctorService.insertDoctor(doctor)); + } + + /** + * 修改医生 + */ + @PreAuthorize("@ss.hasPermi('system:doctor:edit')") + @Log(title = "医生", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody Doctor doctor) + { + return toAjax(doctorService.updateDoctor(doctor)); + } + + /** + * 删除医生 + */ + @PreAuthorize("@ss.hasPermi('system:doctor:remove')") + @Log(title = "医生", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(doctorService.deleteDoctorByIds(ids)); + } +} diff --git a/java/com/ruoyi/system/domain/Doctor.java b/java/com/ruoyi/system/domain/Doctor.java new file mode 100644 index 0000000..1c586c5 --- /dev/null +++ b/java/com/ruoyi/system/domain/Doctor.java @@ -0,0 +1,93 @@ +package com.ruoyi.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 医生对象 doctor + * + * @author 饶秋霖 + * @date 2024-12-06 + */ +public class Doctor extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long id; + + /** 医生 */ + @Excel(name = "医生") + private String doctor; + + /** 评价 */ + @Excel(name = "评价") + private String expert; + + /** 费用 */ + @Excel(name = "费用") + private String cost; + + /** 图片 */ + @Excel(name = "图片") + private String picture; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setDoctor(String doctor) + { + this.doctor = doctor; + } + + public String getDoctor() + { + return doctor; + } + public void setExpert(String expert) + { + this.expert = expert; + } + + public String getExpert() + { + return expert; + } + public void setCost(String cost) + { + this.cost = cost; + } + + public String getCost() + { + return cost; + } + public void setPicture(String picture) + { + this.picture = picture; + } + + public String getPicture() + { + return picture; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("doctor", getDoctor()) + .append("expert", getExpert()) + .append("cost", getCost()) + .append("picture", getPicture()) + .toString(); + } +} diff --git a/java/com/ruoyi/system/mapper/DoctorMapper.java b/java/com/ruoyi/system/mapper/DoctorMapper.java new file mode 100644 index 0000000..1b68736 --- /dev/null +++ b/java/com/ruoyi/system/mapper/DoctorMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.Doctor; + +/** + * 医生Mapper接口 + * + * @author 饶秋霖 + * @date 2024-12-06 + */ +public interface DoctorMapper +{ + /** + * 查询医生 + * + * @param id 医生主键 + * @return 医生 + */ + public Doctor selectDoctorById(Long id); + + /** + * 查询医生列表 + * + * @param doctor 医生 + * @return 医生集合 + */ + public List selectDoctorList(Doctor doctor); + + /** + * 新增医生 + * + * @param doctor 医生 + * @return 结果 + */ + public int insertDoctor(Doctor doctor); + + /** + * 修改医生 + * + * @param doctor 医生 + * @return 结果 + */ + public int updateDoctor(Doctor doctor); + + /** + * 删除医生 + * + * @param id 医生主键 + * @return 结果 + */ + public int deleteDoctorById(Long id); + + /** + * 批量删除医生 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDoctorByIds(Long[] ids); +} diff --git a/java/com/ruoyi/system/service/IDoctorService.java b/java/com/ruoyi/system/service/IDoctorService.java new file mode 100644 index 0000000..c63b8dd --- /dev/null +++ b/java/com/ruoyi/system/service/IDoctorService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.Doctor; + +/** + * 医生Service接口 + * + * @author 饶秋霖 + * @date 2024-12-06 + */ +public interface IDoctorService +{ + /** + * 查询医生 + * + * @param id 医生主键 + * @return 医生 + */ + public Doctor selectDoctorById(Long id); + + /** + * 查询医生列表 + * + * @param doctor 医生 + * @return 医生集合 + */ + public List selectDoctorList(Doctor doctor); + + /** + * 新增医生 + * + * @param doctor 医生 + * @return 结果 + */ + public int insertDoctor(Doctor doctor); + + /** + * 修改医生 + * + * @param doctor 医生 + * @return 结果 + */ + public int updateDoctor(Doctor doctor); + + /** + * 批量删除医生 + * + * @param ids 需要删除的医生主键集合 + * @return 结果 + */ + public int deleteDoctorByIds(Long[] ids); + + /** + * 删除医生信息 + * + * @param id 医生主键 + * @return 结果 + */ + public int deleteDoctorById(Long id); +} diff --git a/java/com/ruoyi/system/service/impl/DoctorServiceImpl.java b/java/com/ruoyi/system/service/impl/DoctorServiceImpl.java new file mode 100644 index 0000000..b8fb1ac --- /dev/null +++ b/java/com/ruoyi/system/service/impl/DoctorServiceImpl.java @@ -0,0 +1,93 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.DoctorMapper; +import com.ruoyi.system.domain.Doctor; +import com.ruoyi.system.service.IDoctorService; + +/** + * 医生Service业务层处理 + * + * @author 饶秋霖 + * @date 2024-12-06 + */ +@Service +public class DoctorServiceImpl implements IDoctorService +{ + @Autowired + private DoctorMapper doctorMapper; + + /** + * 查询医生 + * + * @param id 医生主键 + * @return 医生 + */ + @Override + public Doctor selectDoctorById(Long id) + { + return doctorMapper.selectDoctorById(id); + } + + /** + * 查询医生列表 + * + * @param doctor 医生 + * @return 医生 + */ + @Override + public List selectDoctorList(Doctor doctor) + { + return doctorMapper.selectDoctorList(doctor); + } + + /** + * 新增医生 + * + * @param doctor 医生 + * @return 结果 + */ + @Override + public int insertDoctor(Doctor doctor) + { + return doctorMapper.insertDoctor(doctor); + } + + /** + * 修改医生 + * + * @param doctor 医生 + * @return 结果 + */ + @Override + public int updateDoctor(Doctor doctor) + { + return doctorMapper.updateDoctor(doctor); + } + + /** + * 批量删除医生 + * + * @param ids 需要删除的医生主键 + * @return 结果 + */ + @Override + public int deleteDoctorByIds(Long[] ids) + { + return doctorMapper.deleteDoctorByIds(ids); + } + + /** + * 删除医生信息 + * + * @param id 医生主键 + * @return 结果 + */ + @Override + public int deleteDoctorById(Long id) + { + return doctorMapper.deleteDoctorById(id); + } +} diff --git a/resources/mapper/system/DoctorMapper.xml b/resources/mapper/system/DoctorMapper.xml new file mode 100644 index 0000000..7e7a328 --- /dev/null +++ b/resources/mapper/system/DoctorMapper.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + select id, doctor, expert, cost, picture from doctor + + + + + + + + insert into doctor + + doctor, + expert, + cost, + picture, + + + #{doctor}, + #{expert}, + #{cost}, + #{picture}, + + + + + update doctor + + doctor = #{doctor}, + expert = #{expert}, + cost = #{cost}, + picture = #{picture}, + + where id = #{id} + + + + delete from doctor where id = #{id} + + + + delete from doctor where id in + + #{id} + + + \ No newline at end of file