diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java new file mode 100644 index 0000000..89a56c6 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java @@ -0,0 +1,65 @@ +package com.hxhq.business.controller; + +import java.util.Arrays; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.hxhq.business.domain.Study; +import com.hxhq.business.service.IStudyService; +import com.hxhq.common.core.web.controller.BaseController; +import com.hxhq.common.core.web.domain.AjaxResult; +import com.hxhq.common.core.web.page.TableDataInfo; + + +/** + * 试验Controller + * + * @author hxhq + * @date 2025-12-24 + */ +@RestController +@RequestMapping("/business/study") +public class StudyController extends BaseController +{ + @Autowired + private IStudyService studyService; + + /** + * 查询试验列表 + */ + @GetMapping("/list") + public TableDataInfo list(Study study) + { + startPage(); + List list = studyService.queryList(study); + return getDataTable(list); + } + + /** + * 获取试验详细信息 + */ + @GetMapping(value = "/info") + public AjaxResult getInfo(Long id) + { + return AjaxResult.success(studyService.getById(id)); + } + + /** + * 新增试验信息 + */ + @PostMapping("/save") + public AjaxResult save(@RequestBody Study study) + { + return toAjax(studyService.saveOrUpdate(study)); + } + + /** + * 删除试验信息 + */ + @PostMapping("/delete") + public AjaxResult delete(@RequestBody Long[] ids) + { + return toAjax(studyService.removeByIds(Arrays.asList(ids))); + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/TemplateController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/TemplateController.java index cdda0c9..25ef518 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/TemplateController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/TemplateController.java @@ -1,6 +1,5 @@ package com.hxhq.business.controller; -import java.util.Arrays; import java.util.List; import com.hxhq.common.security.annotation.RequiresPermissions; @@ -47,4 +46,22 @@ public class TemplateController extends BaseController { return AjaxResult.success(templateService.getById(id)); } + + /** + * 新增测试信息 todo:后期删除 + */ + @PostMapping("/save") + public AjaxResult save(@RequestBody Template template) + { + return toAjax(templateService.saveOrUpdate(template)); + } + + /** + * 删除测试信息 todo:后期删除 + */ + @PostMapping("/delete") + public AjaxResult delete(@RequestBody Template template) + { + return toAjax(templateService.removeById(template.getId())); + } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Study.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Study.java new file mode 100644 index 0000000..287fd87 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Study.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 + * + * @author hxhq + * @date 2025-12-24 + */ +@TableName("t_study") +public class Study extends MpBaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 试验编号 */ + private String sn; + + /** 试验名称 */ + private String name; + + /** 负责人id */ + private Long leader; + + /** 试验状态1草稿,3试验中,5已锁定,7待归档,9归档,10待结档 */ + private Integer status; + + /** 借阅状态1未借阅,5待借阅,10借阅中 */ + private Integer borrowStatus; + + + public void setSn(String sn) + { + this.sn = sn; + } + + public String getSn() + { + return sn; + } + + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + + public void setLeader(Long leader) + { + this.leader = leader; + } + + public Long getLeader() + { + return leader; + } + + public void setStatus(Integer status) + { + this.status = status; + } + + public Integer getStatus() + { + return status; + } + + public void setBorrowStatus(Integer borrowStatus) + { + this.borrowStatus = borrowStatus; + } + + public Integer getBorrowStatus() + { + return borrowStatus; + } + +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/NormalEnum.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/NormalEnum.java index 18ea530..7247a6b 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/NormalEnum.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/NormalEnum.java @@ -1,7 +1,7 @@ package com.hxhq.business.enums; /** - * 状态类型:1禁用,3启用 + * 状态类型:1禁用,10启用 * @author tanfei */ public enum NormalEnum { @@ -9,12 +9,12 @@ public enum NormalEnum { /** * 1禁用 */ - no(1, "部门"), + no(1, "禁用"), /** - * 3启用 + * 10启用 */ - yes(3, "学科"); + yes(10, "启用"); private int value; private String text; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMapper.java new file mode 100644 index 0000000..bf4ade4 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMapper.java @@ -0,0 +1,14 @@ +package com.hxhq.business.mapper; + +import com.hxhq.business.domain.Study; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +/** + * 试验Mapper接口 + * + * @author hxhq + * @date 2025-12-24 + */ +public interface StudyMapper extends BaseMapper +{ + +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java new file mode 100644 index 0000000..4abad25 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java @@ -0,0 +1,23 @@ +package com.hxhq.business.service; + +import java.util.List; +import com.hxhq.business.domain.Study; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * 试验Service接口 + * + * @author hxhq + * @date 2025-12-24 + */ +public interface IStudyService extends IService +{ + /** + * 查询试验列表 + * + * @param study 试验 + * @return 试验集合 + */ + public List queryList(Study study); + +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java new file mode 100644 index 0000000..16dac8b --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java @@ -0,0 +1,34 @@ +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.StudyMapper; +import com.hxhq.business.domain.Study; +import com.hxhq.business.service.IStudyService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * 试验Service业务层处理 + * + * @author hxhq + * @date 2025-12-24 + */ +@Service +public class StudyServiceImpl extends ServiceImpl implements IStudyService +{ + /** + * 查询试验列表 + * + * @param study 试验 + * @return 试验 + */ + @Override + public List queryList(Study study) + { + QueryWrapper queryWrapper = Wrappers.query(); + return this.list(queryWrapper); + } + +} diff --git a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMapper.xml b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMapper.xml new file mode 100644 index 0000000..88233d6 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMapper.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file