diff --git a/pom.xml b/pom.xml index b1e9417..0a6121e 100644 --- a/pom.xml +++ b/pom.xml @@ -175,6 +175,12 @@ jjwt ${jwt.version} + + + org.springframework.boot + spring-boot-devtools + true + @@ -249,6 +255,7 @@ ${project.build.sourceEncoding} + diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/SwDiseaseController.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/SwDiseaseController.java new file mode 100644 index 0000000..d049ae6 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/SwDiseaseController.java @@ -0,0 +1,103 @@ +package com.zhyc.module.biosafety.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.zhyc.module.biosafety.domain.SwDisease; +import com.zhyc.module.biosafety.service.ISwDiseaseService; +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.zhyc.common.annotation.Log; +import com.zhyc.common.core.controller.BaseController; +import com.zhyc.common.core.domain.AjaxResult; +import com.zhyc.common.enums.BusinessType; +import com.zhyc.common.utils.poi.ExcelUtil; + +/** + * 疾病Controller + * + * @author ruoyi + * @date 2025-07-09 + */ +@RestController +@RequestMapping("/biosafety/disease") +public class SwDiseaseController extends BaseController +{ + @Autowired + private ISwDiseaseService swDiseaseService; + + /** + * 查询疾病列表 + */ + @PreAuthorize("@ss.hasPermi('disease:disease:list')") + @GetMapping("/list") + public AjaxResult list(SwDisease swDisease) + { + List list = swDiseaseService.selectSwDiseaseList(swDisease); + return success(list); + } + + /** + * 导出疾病列表 + */ + @PreAuthorize("@ss.hasPermi('disease:disease:export')") + @Log(title = "疾病", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SwDisease swDisease) + { + List list = swDiseaseService.selectSwDiseaseList(swDisease); + ExcelUtil util = new ExcelUtil(SwDisease.class); + util.exportExcel(response, list, "疾病数据"); + } + + /** + * 获取疾病详细信息 + */ + @PreAuthorize("@ss.hasPermi('disease:disease:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(swDiseaseService.selectSwDiseaseById(id)); + } + + /** + * 新增疾病 + */ + @PreAuthorize("@ss.hasPermi('disease:disease:add')") + @Log(title = "疾病", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SwDisease swDisease) + { + return toAjax(swDiseaseService.insertSwDisease(swDisease)); + } + + /** + * 修改疾病 + */ + @PreAuthorize("@ss.hasPermi('disease:disease:edit')") + @Log(title = "疾病", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SwDisease swDisease) + { + return toAjax(swDiseaseService.updateSwDisease(swDisease)); + } + + /** + * 删除疾病 + */ + @PreAuthorize("@ss.hasPermi('disease:disease:remove')") + @Log(title = "疾病", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(swDiseaseService.deleteSwDiseaseByIds(ids)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwDisease.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwDisease.java new file mode 100644 index 0000000..5cb14ab --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwDisease.java @@ -0,0 +1,82 @@ +package com.zhyc.module.biosafety.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.zhyc.common.annotation.Excel; +import com.zhyc.common.core.domain.TreeEntity; + +/** + * 疾病对象 sw_disease + * + * @author ruoyi + * @date 2025-07-09 + */ +public class SwDisease extends TreeEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long id; + + /** 名称 */ + @Excel(name = "名称") + private String name; + + /** 描述 */ + @Excel(name = "描述") + private String comment; + + /** */ + @Excel(name = "") + private Long pid; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + + public void setComment(String comment) + { + this.comment = comment; + } + + public String getComment() + { + return comment; + } + + public void setPid(Long pid) + { + this.pid = pid; + } + + public Long getPid() + { + return pid; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("name", getName()) + .append("comment", getComment()) + .append("pid", getPid()) + .toString(); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwDiseaseMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwDiseaseMapper.java new file mode 100644 index 0000000..55f3351 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwDiseaseMapper.java @@ -0,0 +1,61 @@ +package com.zhyc.module.biosafety.mapper; + +import java.util.List; +import com.zhyc.module.biosafety.domain.SwDisease; + +/** + * 疾病Mapper接口 + * + * @author ruoyi + * @date 2025-07-09 + */ +public interface SwDiseaseMapper +{ + /** + * 查询疾病 + * + * @param id 疾病主键 + * @return 疾病 + */ + public SwDisease selectSwDiseaseById(Long id); + + /** + * 查询疾病列表 + * + * @param swDisease 疾病 + * @return 疾病集合 + */ + public List selectSwDiseaseList(SwDisease swDisease); + + /** + * 新增疾病 + * + * @param swDisease 疾病 + * @return 结果 + */ + public int insertSwDisease(SwDisease swDisease); + + /** + * 修改疾病 + * + * @param swDisease 疾病 + * @return 结果 + */ + public int updateSwDisease(SwDisease swDisease); + + /** + * 删除疾病 + * + * @param id 疾病主键 + * @return 结果 + */ + public int deleteSwDiseaseById(Long id); + + /** + * 批量删除疾病 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSwDiseaseByIds(Long[] ids); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ISwDiseaseService.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ISwDiseaseService.java new file mode 100644 index 0000000..94dcb7b --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ISwDiseaseService.java @@ -0,0 +1,61 @@ +package com.zhyc.module.biosafety.service; + +import java.util.List; +import com.zhyc.module.biosafety.domain.SwDisease; + +/** + * 疾病Service接口 + * + * @author ruoyi + * @date 2025-07-09 + */ +public interface ISwDiseaseService +{ + /** + * 查询疾病 + * + * @param id 疾病主键 + * @return 疾病 + */ + public SwDisease selectSwDiseaseById(Long id); + + /** + * 查询疾病列表 + * + * @param swDisease 疾病 + * @return 疾病集合 + */ + public List selectSwDiseaseList(SwDisease swDisease); + + /** + * 新增疾病 + * + * @param swDisease 疾病 + * @return 结果 + */ + public int insertSwDisease(SwDisease swDisease); + + /** + * 修改疾病 + * + * @param swDisease 疾病 + * @return 结果 + */ + public int updateSwDisease(SwDisease swDisease); + + /** + * 批量删除疾病 + * + * @param ids 需要删除的疾病主键集合 + * @return 结果 + */ + public int deleteSwDiseaseByIds(Long[] ids); + + /** + * 删除疾病信息 + * + * @param id 疾病主键 + * @return 结果 + */ + public int deleteSwDiseaseById(Long id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwDiseaseServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwDiseaseServiceImpl.java new file mode 100644 index 0000000..8945257 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwDiseaseServiceImpl.java @@ -0,0 +1,94 @@ +package com.zhyc.module.biosafety.service.impl; + +import java.util.List; + +import com.zhyc.module.biosafety.domain.SwDisease; +import com.zhyc.module.biosafety.mapper.SwDiseaseMapper; +import com.zhyc.module.biosafety.service.ISwDiseaseService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 疾病Service业务层处理 + * + * @author ruoyi + * @date 2025-07-09 + */ +@Service +public class SwDiseaseServiceImpl implements ISwDiseaseService +{ + @Autowired + private SwDiseaseMapper swDiseaseMapper; + + /** + * 查询疾病 + * + * @param id 疾病主键 + * @return 疾病 + */ + @Override + public SwDisease selectSwDiseaseById(Long id) + { + return swDiseaseMapper.selectSwDiseaseById(id); + } + + /** + * 查询疾病列表 + * + * @param swDisease 疾病 + * @return 疾病 + */ + @Override + public List selectSwDiseaseList(SwDisease swDisease) + { + return swDiseaseMapper.selectSwDiseaseList(swDisease); + } + + /** + * 新增疾病 + * + * @param swDisease 疾病 + * @return 结果 + */ + @Override + public int insertSwDisease(SwDisease swDisease) + { + return swDiseaseMapper.insertSwDisease(swDisease); + } + + /** + * 修改疾病 + * + * @param swDisease 疾病 + * @return 结果 + */ + @Override + public int updateSwDisease(SwDisease swDisease) + { + return swDiseaseMapper.updateSwDisease(swDisease); + } + + /** + * 批量删除疾病 + * + * @param ids 需要删除的疾病主键 + * @return 结果 + */ + @Override + public int deleteSwDiseaseByIds(Long[] ids) + { + return swDiseaseMapper.deleteSwDiseaseByIds(ids); + } + + /** + * 删除疾病信息 + * + * @param id 疾病主键 + * @return 结果 + */ + @Override + public int deleteSwDiseaseById(Long id) + { + return swDiseaseMapper.deleteSwDiseaseById(id); + } +} diff --git a/zhyc-module/src/main/resources/mapper/disease/SwDiseaseMapper.xml b/zhyc-module/src/main/resources/mapper/disease/SwDiseaseMapper.xml new file mode 100644 index 0000000..89f0f8d --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/disease/SwDiseaseMapper.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + select id, name, comment, pid from sw_disease + + + + + + + + insert into sw_disease + + name, + comment, + pid, + + + #{name}, + #{comment}, + #{pid}, + + + + + update sw_disease + + name = #{name}, + comment = #{comment}, + pid = #{pid}, + + where id = #{id} + + + + delete from sw_disease where id = #{id} + + + + delete from sw_disease where id in + + #{id} + + + \ No newline at end of file