diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyMethodController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyMethodController.java index 7d395d2..c786e8a 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyMethodController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyMethodController.java @@ -3,8 +3,11 @@ package com.hxhq.business.controller; import java.util.Arrays; import java.util.List; +import com.hxhq.business.form.study.StudyMethodForm; +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.StudyMethod; import com.hxhq.business.service.IStudyMethodService; @@ -21,8 +24,7 @@ import com.hxhq.common.core.web.page.TableDataInfo; */ @RestController @RequestMapping("/business/studyMethod") -public class StudyMethodController extends BaseController -{ +public class StudyMethodController extends BaseController { @Autowired private IStudyMethodService studyMethodService; @@ -30,10 +32,9 @@ public class StudyMethodController extends BaseController * 查询试验-试验方法列表 */ @GetMapping("/list") - public TableDataInfo list(StudyMethod studyMethod) - { + public TableDataInfo list(StudyMethodForm form) { startPage(); - List list = studyMethodService.queryList(studyMethod); + List list = studyMethodService.queryList(form); return getDataTable(list); } @@ -41,8 +42,7 @@ public class StudyMethodController extends BaseController * 获取试验-试验方法详细信息 */ @GetMapping(value = "/info") - public AjaxResult getInfo(Long id) - { + public AjaxResult getInfo(Long id) { return AjaxResult.success(studyMethodService.getById(id)); } @@ -50,17 +50,10 @@ public class StudyMethodController extends BaseController * 新增试验-试验方法信息 */ @PostMapping("/save") - public AjaxResult save(@RequestBody StudyMethod studyMethod) - { - return toAjax(studyMethodService.saveOrUpdate(studyMethod)); + public AjaxResult save(@RequestBody @Validated StudyMethodForm form) { + form.setQmrId(SecurityUtils.getUserId()); + studyMethodService.save(form); + return AjaxResult.success(); } - /** - * 删除试验-试验方法信息 - */ - @PostMapping("/delete") - public AjaxResult delete(@RequestBody Long[] ids) - { - return toAjax(studyMethodService.removeByIds(Arrays.asList(ids))); - } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyMethod.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyMethod.java index 131fd89..91a056a 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyMethod.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyMethod.java @@ -18,6 +18,9 @@ public class StudyMethod extends MpBaseEntity /** 所属试验id */ private Long studyId; + /** 所属试验-学科id */ + private Long studySubjectId; + /** 方法名称 */ private String ffmc; @@ -81,4 +84,11 @@ public class StudyMethod extends MpBaseEntity return userMc; } + public Long getStudySubjectId() { + return studySubjectId; + } + + public void setStudySubjectId(Long studySubjectId) { + this.studySubjectId = studySubjectId; + } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodForm.java new file mode 100644 index 0000000..d6c9f1b --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodForm.java @@ -0,0 +1,91 @@ +package com.hxhq.business.form.study; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * 试验-试验方法对象 + */ +public class StudyMethodForm { + + /** 所属试验id */ + @NotNull(message = "请选择所属试验") + private Long studyId; + + /** 所属试验-学科id */ + @NotNull(message = "请选择所属学科") + private Long studySubjectId; + + /** 方法名称 */ + @NotEmpty(message = "请输入方法名称") + private String ffmc; + + /** 方法文件地址 */ + @NotEmpty(message = "请上传文件") + private String url; + + /** 签名人密码 */ + @NotEmpty(message = "请输入签名人密码") + private String qmrmm; + + private Long qmrId; + + /** 备注 */ + private String remark; + + public Long getStudyId() { + return studyId; + } + + public void setStudyId(Long studyId) { + this.studyId = studyId; + } + + public Long getStudySubjectId() { + return studySubjectId; + } + + public void setStudySubjectId(Long studySubjectId) { + this.studySubjectId = studySubjectId; + } + + public String getFfmc() { + return ffmc; + } + + public void setFfmc(String ffmc) { + this.ffmc = ffmc; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getQmrmm() { + return qmrmm; + } + + public void setQmrmm(String qmrmm) { + this.qmrmm = qmrmm; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public Long getQmrId() { + return qmrId; + } + + public void setQmrId(Long qmrId) { + this.qmrId = qmrId; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java new file mode 100644 index 0000000..82c5703 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java @@ -0,0 +1,68 @@ +package com.hxhq.business.form.study; + +public class StudyMethodSearchForm { + + /** 所属试验-学科id */ + private Long studySubjectId; + + /** 方法名称 */ + private String ffmc; + + /** 创建人 */ + private String createUser; + + private String startDate; + + private String endDate; + + /** 是否已读 0-未读 1-已读 */ + private Integer read; + + public Long getStudySubjectId() { + return studySubjectId; + } + + public void setStudySubjectId(Long studySubjectId) { + this.studySubjectId = studySubjectId; + } + + public String getFfmc() { + return ffmc; + } + + public void setFfmc(String ffmc) { + this.ffmc = ffmc; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + 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 Integer getRead() { + return read; + } + + public void setRead(Integer read) { + this.read = read; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java index e4e59af..0f4be4a 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java @@ -3,6 +3,7 @@ package com.hxhq.business.service; import java.util.List; import com.hxhq.business.domain.StudyMethod; import com.baomidou.mybatisplus.extension.service.IService; +import com.hxhq.business.form.study.StudyMethodForm; /** * 试验-试验方法Service接口 @@ -15,9 +16,14 @@ public interface IStudyMethodService extends IService /** * 查询试验-试验方法列表 * - * @param studyMethod 试验-试验方法 + * @param form 试验-试验方法 * @return 试验-试验方法集合 */ - public List queryList(StudyMethod studyMethod); + public List queryList(StudyMethodForm form); + /** + * 上传试验方法 + * @param form + */ + void save(StudyMethodForm form); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java index 273056b..a965128 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java @@ -3,6 +3,11 @@ 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 com.hxhq.business.form.study.StudyMethodForm; +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.StudyMethodMapper; import com.hxhq.business.domain.StudyMethod; @@ -18,17 +23,28 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @Service public class StudyMethodServiceImpl extends ServiceImpl implements IStudyMethodService { + + @Autowired + private ISysUserService sysUserService; + /** * 查询试验-试验方法列表 * - * @param studyMethod 试验-试验方法 + * @param form 试验-试验方法 * @return 试验-试验方法 */ @Override - public List queryList(StudyMethod studyMethod) - { - QueryWrapper queryWrapper = Wrappers.query(); - return this.list(queryWrapper); + public List queryList(StudyMethodForm form) { + return null; + } + + @Override + public void save(StudyMethodForm form) { + SysUser qmr = sysUserService.selectUserById(form.getQmrId()); + // TODO + StudyMethod studyMethod = new StudyMethod(); + BeanUtils.copyProperties(form, studyMethod); + this.save(studyMethod); } }