From e2dad5e69a0397f0cdb2f9082130288ae137b1a4 Mon Sep 17 00:00:00 2001 From: HanLong <404402223@qq.com> Date: Wed, 7 Jan 2026 15:34:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:[=E8=AF=95=E9=AA=8C=E7=AE=A1=E7=90=86][?= =?UTF-8?q?=E9=A5=B2=E5=85=BB=E9=97=B4]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hxhq/business/controller/PublicController.java | 14 ++- .../business/controller/StudyRoomController.java | 58 ++++++++-- .../java/com/hxhq/business/domain/Species.java | 45 -------- .../java/com/hxhq/business/domain/StudyRoom.java | 30 ++--- .../com/hxhq/business/domain/StudyRoomHistory.java | 84 ++++++++++++++ .../business/enums/study/StudyRoomStatusEnum.java | 52 +++++++++ .../hxhq/business/form/study/StudyRoomForm.java | 128 +++++++++++++++++++++ .../form/study/StudyRoomHistorySearchForm.java | 49 ++++++++ .../business/form/study/StudyRoomSearchForm.java | 82 +++++++++++++ .../com/hxhq/business/mapper/SpeciesMapper.java | 14 --- .../business/mapper/StudyRoomHistoryMapper.java | 14 +++ .../com/hxhq/business/service/ISpeciesService.java | 23 ---- .../business/service/IStudyRoomHistoryService.java | 33 ++++++ .../hxhq/business/service/IStudyRoomService.java | 23 +++- .../business/service/impl/SpeciesServiceImpl.java | 34 ------ .../service/impl/StudyRoomHistoryServiceImpl.java | 66 +++++++++++ .../service/impl/StudyRoomServiceImpl.java | 107 +++++++++++++++-- .../resources/mapper/business/SpeciesMapper.xml | 6 - .../mapper/business/StudyRoomHistoryMapper.xml | 6 + 19 files changed, 706 insertions(+), 162 deletions(-) delete mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Species.java create mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyRoomHistory.java create mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/study/StudyRoomStatusEnum.java create mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomForm.java create mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomHistorySearchForm.java create mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomSearchForm.java delete mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/SpeciesMapper.java create mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyRoomHistoryMapper.java delete mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISpeciesService.java create mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyRoomHistoryService.java delete mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SpeciesServiceImpl.java create mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyRoomHistoryServiceImpl.java delete mode 100644 hxhq-modules/hxhq-system/src/main/resources/mapper/business/SpeciesMapper.xml create mode 100644 hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyRoomHistoryMapper.xml diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java index b569dd5..b35db19 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java @@ -67,9 +67,17 @@ public class PublicController extends BaseController * @return */ @GetMapping("/animalSpeciesList") - public AjaxResult getAnimalSpeciesList() { - List list = animalSpeciesService.list(); - return success(list); + public AjaxResult getAnimalSpeciesList(String animalSpecies) { + if(StringUtils.isNotEmpty(animalSpecies)) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(AnimalSpecies::getAnimalSpecies, animalSpecies); + List list = animalSpeciesService.list(queryWrapper); + return success(list); + } else { + List list = animalSpeciesService.list(); + return success(list); + } + } /** diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyRoomController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyRoomController.java index ec66b71..303e4fe 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyRoomController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyRoomController.java @@ -3,8 +3,16 @@ package com.hxhq.business.controller; import java.util.Arrays; import java.util.List; +import com.hxhq.business.domain.StudyRoomHistory; +import com.hxhq.business.form.study.StudyRoomForm; +import com.hxhq.business.form.study.StudyRoomHistorySearchForm; +import com.hxhq.business.form.study.StudyRoomSearchForm; +import com.hxhq.business.service.IStudyRoomHistoryService; +import com.hxhq.common.core.utils.StringUtils; +import com.hxhq.common.security.utils.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import com.hxhq.business.domain.StudyRoom; import com.hxhq.business.service.IStudyRoomService; @@ -26,17 +34,29 @@ public class StudyRoomController extends BaseController @Autowired private IStudyRoomService studyRoomService; + @Autowired + private IStudyRoomHistoryService studyRoomHistoryService; + /** * 查询试验-饲养间列表 */ @GetMapping("/list") - public TableDataInfo list(StudyRoom studyRoom) + public TableDataInfo list(StudyRoomSearchForm form) + { + startPage(); + List list = studyRoomService.queryList(form); + return getDataTable(list); + } + + @GetMapping("/historyList") + public TableDataInfo historyList(StudyRoomHistorySearchForm form) { startPage(); - List list = studyRoomService.queryList(studyRoom); + List list = studyRoomHistoryService.queryList(form); return getDataTable(list); } + /** * 获取试验-饲养间详细信息 */ @@ -50,17 +70,37 @@ public class StudyRoomController extends BaseController * 新增试验-饲养间信息 */ @PostMapping("/save") - public AjaxResult save(@RequestBody StudyRoom studyRoom) + public AjaxResult save(@RequestBody @Validated StudyRoomForm form) { - return toAjax(studyRoomService.saveOrUpdate(studyRoom)); + form.setQmrId(SecurityUtils.getUserId()); + studyRoomService.add(form); + return AjaxResult.success("操作成功"); } /** - * 删除试验-饲养间信息 + * 更新笼具 + * @return */ - @PostMapping("/delete") - public AjaxResult delete(@RequestBody Long[] ids) - { - return toAjax(studyRoomService.removeByIds(Arrays.asList(ids))); + @PostMapping("/update") + public AjaxResult updateLj(@RequestBody StudyRoomForm form) { + form.setQmrId(SecurityUtils.getUserId()); + studyRoomService.updateLj(form); + return AjaxResult.success("操作成功"); } + + /** + * 结束 + * @param form + * @return + */ + @PostMapping("/js") + public AjaxResult js(@RequestBody StudyRoomForm form) { + if(StringUtils.isEmpty(form.getJssyyl())) { + return error("请输入结束使用原因"); + } + form.setQmrId(SecurityUtils.getUserId()); + studyRoomService.js(form); + return AjaxResult.success("操作成功"); + } + } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Species.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Species.java deleted file mode 100644 index 4c36144..0000000 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Species.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.hxhq.business.domain; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.hxhq.common.core.domain.MpBaseEntity; - - -/** - * 动物种属对象 t_species - * - * @author hxhq - * @date 2025-12-29 - */ -@TableName("t_species") -public class Species extends MpBaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 笼具 */ - private String lj; - - /** 动物种属 */ - private String ddzs; - - - public void setLj(String lj) - { - this.lj = lj; - } - - public String getLj() - { - return lj; - } - - public void setDdzs(String ddzs) - { - this.ddzs = ddzs; - } - - public String getDdzs() - { - return ddzs; - } - -} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyRoom.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyRoom.java index 8cbf517..0fb2735 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyRoom.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyRoom.java @@ -30,14 +30,14 @@ public class StudyRoom extends MpBaseEntity private String lj; /** 动物种属 */ - private String ddzs; + private String dwzs; /** 开始使用时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date kssj; /** 开始使用原因 */ - private String kssyyy; + private String kssyyl; /** 启用人id */ private Long qyrId; @@ -46,7 +46,7 @@ public class StudyRoom extends MpBaseEntity private String qyrMc; /** 结束使用原因 */ - private String jssyyy; + private String jssyyl; /** 结束人id */ private Long jsrId; @@ -102,14 +102,14 @@ public class StudyRoom extends MpBaseEntity return lj; } - public void setDdzs(String ddzs) + public void setDwzs(String dwzs) { - this.ddzs = ddzs; + this.dwzs = dwzs; } - public String getDdzs() + public String getDwzs() { - return ddzs; + return dwzs; } public void setKssj(Date kssj) @@ -122,14 +122,14 @@ public class StudyRoom extends MpBaseEntity return kssj; } - public void setKssyyy(String kssyyy) + public void setKssyyl(String kssyyl) { - this.kssyyy = kssyyy; + this.kssyyl = kssyyl; } - public String getKssyyy() + public String getKssyyl() { - return kssyyy; + return kssyyl; } public void setQyrId(Long qyrId) @@ -152,14 +152,14 @@ public class StudyRoom extends MpBaseEntity return qyrMc; } - public void setJssyyy(String jssyyy) + public void setJssyyl(String jssyyl) { - this.jssyyy = jssyyy; + this.jssyyl = jssyyl; } - public String getJssyyy() + public String getJssyyl() { - return jssyyy; + return jssyyl; } public void setJsrId(Long jsrId) diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyRoomHistory.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyRoomHistory.java new file mode 100644 index 0000000..984ccae --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyRoomHistory.java @@ -0,0 +1,84 @@ +package com.hxhq.business.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.hxhq.common.core.domain.MpBaseEntity; + + +/** + * 试验-饲养间更换笼具记录对象 t_study_room_history + * + * @author HanLong + * @date 2026-01-07 + */ +@TableName("t_study_room_history") +public class StudyRoomHistory extends MpBaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 饲养间id */ + private Long studyRoomId; + + /** 更换前笼具 */ + private String ljOld; + + /** 更换后笼具 */ + private String lj; + + /** 启用人id */ + private Long qyrId; + + /** 启用人名称 */ + private String qyrMc; + + + public void setStudyRoomId(Long studyRoomId) + { + this.studyRoomId = studyRoomId; + } + + public Long getStudyRoomId() + { + return studyRoomId; + } + + public void setLjOld(String ljOld) + { + this.ljOld = ljOld; + } + + public String getLjOld() + { + return ljOld; + } + + public void setLj(String lj) + { + this.lj = lj; + } + + public String getLj() + { + return lj; + } + + public void setQyrId(Long qyrId) + { + this.qyrId = qyrId; + } + + public Long getQyrId() + { + return qyrId; + } + + public void setQyrMc(String qyrMc) + { + this.qyrMc = qyrMc; + } + + public String getQyrMc() + { + return qyrMc; + } + +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/study/StudyRoomStatusEnum.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/study/StudyRoomStatusEnum.java new file mode 100644 index 0000000..58cb070 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/study/StudyRoomStatusEnum.java @@ -0,0 +1,52 @@ +package com.hxhq.business.enums.study; + +/** + * 饲养间状态 1使用中 3已结束 + * @author tanfei + */ +public enum StudyRoomStatusEnum { + + /** + * 1使用中 + */ + syz(1, "使用中"), + + /** + * 3已结束 + */ + yjs(3, "已结束"); + + + private int value; + private String text; + + StudyRoomStatusEnum(int value, String text) { + this.value = value; + this.text = text; + } + + public int getValue() { + return value; + } + + public void setValue(int value) { + this.value = value; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public static StudyRoomStatusEnum getEnumByValue(int type) { + for (StudyRoomStatusEnum bt : values()) { + if (bt.value == type) { + return bt; + } + } + return null; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomForm.java new file mode 100644 index 0000000..d866ae5 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomForm.java @@ -0,0 +1,128 @@ +package com.hxhq.business.form.study; + +import javax.validation.constraints.NotEmpty; + +/** + * 饲养间 + */ +public class StudyRoomForm { + + /** 饲养间id */ + private Long id; + + /** 所属试验 */ + private Long studyId; + + /** 饲养间号 */ + @NotEmpty(message = "请选择饲养间号") + private String syjh; + + /** 试验区域 */ + @NotEmpty(message = "请选择试验区域") + private String syqy; + + /** 笼具 */ + @NotEmpty(message = "请选择笼具") + private String lj; + + /** 动物种属 */ + @NotEmpty(message = "请选择动物种属") + private String dwzs; + + /** 开始使用原因 */ + @NotEmpty(message = "请输入开始使用原因") + private String kssyyl; + + /** + * 签名人id + */ + private Long qmrId; + + /** + * 签名密码 + */ + private String qmrmm; + + /** 结束使用原因 */ + private String jssyyl; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getStudyId() { + return studyId; + } + + public void setStudyId(Long studyId) { + this.studyId = studyId; + } + + public String getSyjh() { + return syjh; + } + + public void setSyjh(String syjh) { + this.syjh = syjh; + } + + public String getSyqy() { + return syqy; + } + + public void setSyqy(String syqy) { + this.syqy = syqy; + } + + public String getLj() { + return lj; + } + + public void setLj(String lj) { + this.lj = lj; + } + + public String getDwzs() { + return dwzs; + } + + public void setDwzs(String dwzs) { + this.dwzs = dwzs; + } + + public String getKssyyl() { + return kssyyl; + } + + public void setKssyyl(String kssyyl) { + this.kssyyl = kssyyl; + } + + public Long getQmrId() { + return qmrId; + } + + public void setQmrId(Long qmrId) { + this.qmrId = qmrId; + } + + public String getQmrmm() { + return qmrmm; + } + + public void setQmrmm(String qmrmm) { + this.qmrmm = qmrmm; + } + + public String getJssyyl() { + return jssyyl; + } + + public void setJssyyl(String jssyyl) { + this.jssyyl = jssyyl; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomHistorySearchForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomHistorySearchForm.java new file mode 100644 index 0000000..38a84bd --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomHistorySearchForm.java @@ -0,0 +1,49 @@ +package com.hxhq.business.form.study; + +/** + * 饲养间更换笼具记录列表搜索参数 + */ +public class StudyRoomHistorySearchForm { + + /** 饲养间id */ + private Long studyRoomId; + + /** 更换人名称 */ + private String qyrMc; + + private String startDate; + + private String endDate; + + public Long getStudyRoomId() { + return studyRoomId; + } + + public void setStudyRoomId(Long studyRoomId) { + this.studyRoomId = studyRoomId; + } + + public String getQyrMc() { + return qyrMc; + } + + public void setQyrMc(String qyrMc) { + this.qyrMc = qyrMc; + } + + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomSearchForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomSearchForm.java new file mode 100644 index 0000000..071806c --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomSearchForm.java @@ -0,0 +1,82 @@ +package com.hxhq.business.form.study; + +/** + * 饲养间列表搜索参数 + */ +public class StudyRoomSearchForm { + + /** 所属试验 */ + private Long studyId; + + /** 饲养间号 */ + private String syjh; + + /** 试验区域 */ + private String syqy; + + /** 启用人名称 */ + private String qyrMc; + + /** 结束人名称 */ + private String jsrMc; + + private String startDate; + + private String endDate; + + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + + public Long getStudyId() { + return studyId; + } + + public void setStudyId(Long studyId) { + this.studyId = studyId; + } + + public String getSyjh() { + return syjh; + } + + public void setSyjh(String syjh) { + this.syjh = syjh; + } + + public String getSyqy() { + return syqy; + } + + public void setSyqy(String syqy) { + this.syqy = syqy; + } + + public String getQyrMc() { + return qyrMc; + } + + public void setQyrMc(String qyrMc) { + this.qyrMc = qyrMc; + } + + public String getJsrMc() { + return jsrMc; + } + + public void setJsrMc(String jsrMc) { + this.jsrMc = jsrMc; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/SpeciesMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/SpeciesMapper.java deleted file mode 100644 index f86da9e..0000000 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/SpeciesMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.hxhq.business.mapper; - -import com.hxhq.business.domain.Species; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -/** - * 动物种属Mapper接口 - * - * @author hxhq - * @date 2025-12-29 - */ -public interface SpeciesMapper extends BaseMapper -{ - -} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyRoomHistoryMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyRoomHistoryMapper.java new file mode 100644 index 0000000..a626d9b --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyRoomHistoryMapper.java @@ -0,0 +1,14 @@ +package com.hxhq.business.mapper; + +import com.hxhq.business.domain.StudyRoomHistory; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +/** + * 试验-饲养间更换笼具记录Mapper接口 + * + * @author HanLong + * @date 2026-01-07 + */ +public interface StudyRoomHistoryMapper extends BaseMapper +{ + +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISpeciesService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISpeciesService.java deleted file mode 100644 index 34ee862..0000000 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISpeciesService.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.hxhq.business.service; - -import java.util.List; -import com.hxhq.business.domain.Species; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - * 动物种属Service接口 - * - * @author hxhq - * @date 2025-12-29 - */ -public interface ISpeciesService extends IService -{ - /** - * 查询动物种属列表 - * - * @param species 动物种属 - * @return 动物种属集合 - */ - public List queryList(Species species); - -} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyRoomHistoryService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyRoomHistoryService.java new file mode 100644 index 0000000..eff5a60 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyRoomHistoryService.java @@ -0,0 +1,33 @@ +package com.hxhq.business.service; + +import java.util.List; + +import com.hxhq.business.domain.StudyRoom; +import com.hxhq.business.domain.StudyRoomHistory; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hxhq.business.form.study.StudyRoomHistorySearchForm; +import com.hxhq.business.form.study.StudyRoomSearchForm; +import com.hxhq.system.api.domain.SysUser; + +/** + * 试验-饲养间更换笼具记录Service接口 + * + * @author HanLong + * @date 2026-01-07 + */ +public interface IStudyRoomHistoryService extends IService +{ + /** + * 查询试验-饲养间更换笼具记录列表 + * + * @param form 试验-饲养间更换笼具记录 + * @return 试验-饲养间更换笼具记录集合 + */ + public List queryList(StudyRoomHistorySearchForm form); + + /** + * 添加饲养间更换记录 + * @param studyRoom + */ + void addStudyRoomHistory(StudyRoom studyRoom, String oldLj, SysUser ghr); +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyRoomService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyRoomService.java index 6b86bc0..0222be7 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyRoomService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyRoomService.java @@ -3,6 +3,8 @@ package com.hxhq.business.service; import java.util.List; import com.hxhq.business.domain.StudyRoom; import com.baomidou.mybatisplus.extension.service.IService; +import com.hxhq.business.form.study.StudyRoomForm; +import com.hxhq.business.form.study.StudyRoomSearchForm; /** * 试验-饲养间Service接口 @@ -15,9 +17,26 @@ public interface IStudyRoomService extends IService /** * 查询试验-饲养间列表 * - * @param studyRoom 试验-饲养间 + * @param form 试验-饲养间 * @return 试验-饲养间集合 */ - public List queryList(StudyRoom studyRoom); + public List queryList(StudyRoomSearchForm form); + /** + * 启用饲养间 + * @param form + */ + public void add(StudyRoomForm form); + + /** + * 更换笼具 + * @param form + */ + void updateLj(StudyRoomForm form); + + /** + * 结束使用 + * @param form + */ + void js(StudyRoomForm form); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SpeciesServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SpeciesServiceImpl.java deleted file mode 100644 index 9ced125..0000000 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SpeciesServiceImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.hxhq.business.service.impl; - -import java.util.List; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import org.springframework.stereotype.Service; -import com.hxhq.business.mapper.SpeciesMapper; -import com.hxhq.business.domain.Species; -import com.hxhq.business.service.ISpeciesService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; - -/** - * 动物种属Service业务层处理 - * - * @author hxhq - * @date 2025-12-29 - */ -@Service -public class SpeciesServiceImpl extends ServiceImpl implements ISpeciesService -{ - /** - * 查询动物种属列表 - * - * @param species 动物种属 - * @return 动物种属 - */ - @Override - public List queryList(Species species) - { - QueryWrapper queryWrapper = Wrappers.query(); - return this.list(queryWrapper); - } - -} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyRoomHistoryServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyRoomHistoryServiceImpl.java new file mode 100644 index 0000000..3b6c748 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyRoomHistoryServiceImpl.java @@ -0,0 +1,66 @@ +package com.hxhq.business.service.impl; + +import java.util.List; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hxhq.business.domain.StudyRoom; +import com.hxhq.business.form.study.StudyRoomHistorySearchForm; +import com.hxhq.business.form.study.StudyRoomSearchForm; +import com.hxhq.common.core.domain.MpBaseEntity; +import com.hxhq.system.api.domain.SysUser; +import org.springframework.stereotype.Service; +import com.hxhq.business.mapper.StudyRoomHistoryMapper; +import com.hxhq.business.domain.StudyRoomHistory; +import com.hxhq.business.service.IStudyRoomHistoryService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * 试验-饲养间更换笼具记录Service业务层处理 + * + * @author HanLong + * @date 2026-01-07 + */ +@Service +public class StudyRoomHistoryServiceImpl extends ServiceImpl implements IStudyRoomHistoryService +{ + /** + * 查询试验-饲养间更换笼具记录列表 + * + * @param form 试验-饲养间更换笼具记录 + * @return 试验-饲养间更换笼具记录 + */ + @Override + public List queryList(StudyRoomHistorySearchForm form) + { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + if(StringUtils.isNotEmpty(form.getQyrMc())) { + queryWrapper.like(StudyRoomHistory::getQyrMc, form.getQyrMc()); + } + if(form.getStudyRoomId() != null) { + queryWrapper.eq(StudyRoomHistory::getStudyRoomId, form.getStudyRoomId()); + } + if(StringUtils.isNotEmpty(form.getStartDate())) { + queryWrapper.ge(MpBaseEntity::getCreateTime, form.getStartDate()); + } + if(StringUtils.isNotEmpty(form.getEndDate())) { + queryWrapper.le(MpBaseEntity::getCreateTime, form.getEndDate()); + } + queryWrapper.orderByDesc(MpBaseEntity::getId); + return this.list(queryWrapper); + } + + @Override + public void addStudyRoomHistory(StudyRoom studyRoom, String oldLj, SysUser ghr) { + StudyRoomHistory studyRoomHistory = new StudyRoomHistory(); + studyRoomHistory.setStudyRoomId(studyRoom.getId()); + studyRoomHistory.setLj(studyRoom.getLj()); + studyRoomHistory.setLjOld(oldLj); + studyRoomHistory.setQyrId(ghr.getUserId()); + studyRoomHistory.setQyrMc(ghr.getNickName()); + this.save(studyRoomHistory); + } + +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyRoomServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyRoomServiceImpl.java index f0be970..a8e7332 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyRoomServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyRoomServiceImpl.java @@ -1,8 +1,19 @@ package com.hxhq.business.service.impl; +import java.util.Date; import java.util.List; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.hxhq.business.enums.study.StudyRoomStatusEnum; +import com.hxhq.business.form.study.StudyRoomForm; +import com.hxhq.business.form.study.StudyRoomSearchForm; +import com.hxhq.business.service.IStudyRoomHistoryService; +import com.hxhq.common.core.exception.ServiceException; +import com.hxhq.system.api.domain.SysUser; +import com.hxhq.system.service.ISysUserService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.hxhq.business.mapper.StudyRoomMapper; import com.hxhq.business.domain.StudyRoom; @@ -18,17 +29,91 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @Service public class StudyRoomServiceImpl extends ServiceImpl implements IStudyRoomService { - /** - * 查询试验-饲养间列表 - * - * @param studyRoom 试验-饲养间 - * @return 试验-饲养间 - */ + + @Autowired + private IStudyRoomHistoryService studyRoomHistoryService; + + @Autowired + private ISysUserService sysUserService; + + @Override - public List queryList(StudyRoom studyRoom) - { - QueryWrapper queryWrapper = Wrappers.query(); + public List queryList(StudyRoomSearchForm form) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(StudyRoom::getStudyId, form.getStudyId()); + if(StringUtils.isNotEmpty(form.getSyjh())) { + queryWrapper.eq(StudyRoom::getSyjh, form.getSyjh()); + } + if(StringUtils.isNotEmpty(form.getSyqy())) { + queryWrapper.eq(StudyRoom::getSyqy, form.getSyqy()); + } + if(StringUtils.isNotEmpty(form.getQyrMc())) { + queryWrapper.like(StudyRoom::getQyrMc, form.getQyrMc()); + } + if(StringUtils.isNotEmpty(form.getJsrMc())) { + queryWrapper.like(StudyRoom::getJsrMc, form.getJsrMc()); + } + if(StringUtils.isNotEmpty(form.getStartDate())) { + queryWrapper.ge(StudyRoom::getKssj, form.getStartDate()); + } + if(StringUtils.isNotEmpty(form.getEndDate())) { + queryWrapper.le(StudyRoom::getKssj, form.getEndDate()); + } + queryWrapper.orderByDesc(StudyRoom::getKssj); return this.list(queryWrapper); } + @Override + public void add(StudyRoomForm form) { + SysUser qmr = sysUserService.selectUserById(form.getQmrId()); + // TODO + StudyRoom studyRoom = new StudyRoom(); + BeanUtils.copyProperties(form, studyRoom); + studyRoom.setKssj(new Date()); + studyRoom.setQyrId(qmr.getUserId()); + studyRoom.setQyrMc(qmr.getNickName()); + studyRoom.setZt(StudyRoomStatusEnum.syz.getValue()); + this.save(studyRoom); + + studyRoomHistoryService.addStudyRoomHistory(studyRoom, null, qmr); + } + + @Override + public void updateLj(StudyRoomForm form) { + SysUser qmr = sysUserService.selectUserById(form.getQmrId()); + // TODO + StudyRoom studyRoom = this.getById(form.getId()); + if(studyRoom == null) { + throw new ServiceException("饲养间不存在或已删除"); + } + if(studyRoom.getZt() != StudyRoomStatusEnum.syz.getValue()) { + throw new ServiceException("饲养间【" + studyRoom.getSyjh() + "】处于已结束状态,无法更换笼具"); + } + String ljOld = studyRoom.getLj(); + studyRoom.setLj(form.getLj()); + this.updateById(studyRoom); + + studyRoomHistoryService.addStudyRoomHistory(studyRoom, ljOld, qmr); + + } + + @Override + public void js(StudyRoomForm form) { + SysUser qmr = sysUserService.selectUserById(form.getQmrId()); + // TODO + StudyRoom studyRoom = this.getById(form.getId()); + if(studyRoom == null) { + throw new ServiceException("饲养间不存在或已删除"); + } + if(studyRoom.getZt() != StudyRoomStatusEnum.syz.getValue()) { + throw new ServiceException("饲养间【" + studyRoom.getSyjh() + "】处于已结束状态,无法重复操作"); + } + studyRoom.setZt(StudyRoomStatusEnum.yjs.getValue()); + studyRoom.setJssyyl(form.getJssyyl()); + studyRoom.setJsrId(qmr.getUserId()); + studyRoom.setJsrMc(qmr.getNickName()); + studyRoom.setJssj(new Date()); + this.updateById(studyRoom); + } + } diff --git a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/SpeciesMapper.xml b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/SpeciesMapper.xml deleted file mode 100644 index fef255a..0000000 --- a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/SpeciesMapper.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyRoomHistoryMapper.xml b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyRoomHistoryMapper.xml new file mode 100644 index 0000000..8b0790a --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyRoomHistoryMapper.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file