This commit is contained in:
parent
54aa865d1a
commit
2d395ff48c
|
@ -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<Doctor> 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<Doctor> list = doctorService.selectDoctorList(doctor);
|
||||
ExcelUtil<Doctor> util = new ExcelUtil<Doctor>(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));
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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<Doctor> 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);
|
||||
}
|
|
@ -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<Doctor> 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);
|
||||
}
|
|
@ -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<Doctor> 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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
<?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.ruoyi.system.mapper.DoctorMapper">
|
||||
|
||||
<resultMap type="Doctor" id="DoctorResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="doctor" column="doctor" />
|
||||
<result property="expert" column="expert" />
|
||||
<result property="cost" column="cost" />
|
||||
<result property="picture" column="picture" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDoctorVo">
|
||||
select id, doctor, expert, cost, picture from doctor
|
||||
</sql>
|
||||
|
||||
<select id="selectDoctorList" parameterType="Doctor" resultMap="DoctorResult">
|
||||
<include refid="selectDoctorVo"/>
|
||||
<where>
|
||||
<if test="doctor != null and doctor != ''"> and doctor = #{doctor}</if>
|
||||
<if test="expert != null and expert != ''"> and expert = #{expert}</if>
|
||||
<if test="cost != null and cost != ''"> and cost = #{cost}</if>
|
||||
<if test="picture != null and picture != ''"> and picture = #{picture}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDoctorById" parameterType="Long" resultMap="DoctorResult">
|
||||
<include refid="selectDoctorVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDoctor" parameterType="Doctor" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into doctor
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="doctor != null">doctor,</if>
|
||||
<if test="expert != null">expert,</if>
|
||||
<if test="cost != null">cost,</if>
|
||||
<if test="picture != null">picture,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="doctor != null">#{doctor},</if>
|
||||
<if test="expert != null">#{expert},</if>
|
||||
<if test="cost != null">#{cost},</if>
|
||||
<if test="picture != null">#{picture},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDoctor" parameterType="Doctor">
|
||||
update doctor
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="doctor != null">doctor = #{doctor},</if>
|
||||
<if test="expert != null">expert = #{expert},</if>
|
||||
<if test="cost != null">cost = #{cost},</if>
|
||||
<if test="picture != null">picture = #{picture},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDoctorById" parameterType="Long">
|
||||
delete from doctor where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDoctorByIds" parameterType="String">
|
||||
delete from doctor where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue