| @ -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<Study> 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))); | |||||
| } | |||||
| } | |||||
| @ -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; | |||||
| } | |||||
| } | |||||
| @ -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<Study> | |||||
| { | |||||
| } | |||||
| @ -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<Study> | |||||
| { | |||||
| /** | |||||
| * 查询试验列表 | |||||
| * | |||||
| * @param study 试验 | |||||
| * @return 试验集合 | |||||
| */ | |||||
| public List<Study> queryList(Study study); | |||||
| } | |||||
| @ -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<StudyMapper, Study> implements IStudyService | |||||
| { | |||||
| /** | |||||
| * 查询试验列表 | |||||
| * | |||||
| * @param study 试验 | |||||
| * @return 试验 | |||||
| */ | |||||
| @Override | |||||
| public List<Study> queryList(Study study) | |||||
| { | |||||
| QueryWrapper<Study> queryWrapper = Wrappers.query(); | |||||
| return this.list(queryWrapper); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,6 @@ | |||||
| <?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.hxhq.business.mapper.StudyMapper"> | |||||
| </mapper> | |||||