diff --git a/hxhq-modules/hxhq-file/src/main/java/com/hxhq/file/service/LocalSysFileServiceImpl.java b/hxhq-modules/hxhq-file/src/main/java/com/hxhq/file/service/LocalSysFileServiceImpl.java index 2955d4c..47474b5 100644 --- a/hxhq-modules/hxhq-file/src/main/java/com/hxhq/file/service/LocalSysFileServiceImpl.java +++ b/hxhq-modules/hxhq-file/src/main/java/com/hxhq/file/service/LocalSysFileServiceImpl.java @@ -46,7 +46,8 @@ public class LocalSysFileServiceImpl implements ISysFileService public String uploadFile(MultipartFile file) throws Exception { String name = FileUploadUtils.upload(localFilePath, file); - String url = domain + localFilePrefix + name; +// String url = domain + localFilePrefix + name; + String url = localFilePrefix + name; return url; } 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 c786e8a..6716985 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 @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.List; import com.hxhq.business.form.study.StudyMethodForm; +import com.hxhq.business.form.study.StudyMethodSearchForm; import com.hxhq.common.security.utils.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -32,7 +33,7 @@ public class StudyMethodController extends BaseController { * 查询试验-试验方法列表 */ @GetMapping("/list") - public TableDataInfo list(StudyMethodForm form) { + public TableDataInfo list(StudyMethodSearchForm form) { startPage(); List list = studyMethodService.queryList(form); return getDataTable(list); 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 91a056a..2a5a9e0 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 @@ -1,5 +1,6 @@ package com.hxhq.business.domain; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.hxhq.common.core.domain.MpBaseEntity; @@ -25,7 +26,9 @@ public class StudyMethod extends MpBaseEntity private String ffmc; /** 方法文件地址 */ - private String url; + private String fileUrl; + + private String fileName; /** 方法归属人id */ private Long userId; @@ -33,6 +36,17 @@ public class StudyMethod extends MpBaseEntity /** 方法归属人名称 */ private String userMc; + /** 状态 */ + @TableField(exist = false) + private Integer zt; + + public Integer getZt() { + return zt; + } + + public void setZt(Integer zt) { + this.zt = zt; + } public void setStudyId(Long studyId) { @@ -54,14 +68,14 @@ public class StudyMethod extends MpBaseEntity return ffmc; } - public void setUrl(String url) + public void setFileUrl(String fileUrl) { - this.url = url; + this.fileUrl = fileUrl; } - public String getUrl() + public String getFileUrl() { - return url; + return fileUrl; } public void setUserId(Long userId) @@ -91,4 +105,12 @@ public class StudyMethod extends MpBaseEntity public void setStudySubjectId(Long studySubjectId) { this.studySubjectId = studySubjectId; } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyMethodRead.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyMethodRead.java new file mode 100644 index 0000000..b4b1b72 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyMethodRead.java @@ -0,0 +1,81 @@ +package com.hxhq.business.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.hxhq.common.core.domain.MpBaseEntity; + + +/** + * 试验-试验方法已读记录 t_study_method_read + * + * @author hxhq + * @date 2025-12-29 + */ +@TableName("t_study_method_read") +public class StudyMethodRead extends MpBaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 所属试验id */ + private Long studyId; + + /** 所属试验-学科id */ + private Long studySubjectId; + + /** 所属试验方法id */ + private Long studyMethodId; + + private Long qmrId; + + private String qmrMc; + + private String qmyy; + + public Long getStudyMethodId() { + return studyMethodId; + } + + public void setStudyMethodId(Long studyMethodId) { + this.studyMethodId = studyMethodId; + } + + public Long getQmrId() { + return qmrId; + } + + public void setQmrId(Long qmrId) { + this.qmrId = qmrId; + } + + public String getQmrMc() { + return qmrMc; + } + + public void setQmrMc(String qmrMc) { + this.qmrMc = qmrMc; + } + + public String getQmyy() { + return qmyy; + } + + public void setQmyy(String qmyy) { + this.qmyy = qmyy; + } + + 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; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/study/StudyMethodStatusEnum.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/study/StudyMethodStatusEnum.java new file mode 100644 index 0000000..8428229 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/study/StudyMethodStatusEnum.java @@ -0,0 +1,52 @@ +package com.hxhq.business.enums.study; + +/** + * 试验方法已读/未读状态 1 已读 0未读 + * @author tanfei + */ +public enum StudyMethodStatusEnum { + + /** + * 1已读 + */ + yd(1, "已读"), + + /** + * 0未读 + */ + wd(0, "未读"); + + + private int value; + private String text; + + StudyMethodStatusEnum(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 StudyMethodStatusEnum getEnumByValue(int type) { + for (StudyMethodStatusEnum 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/StudyMethodForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodForm.java index d6c9f1b..c8edf6f 100644 --- 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 @@ -22,7 +22,9 @@ public class StudyMethodForm { /** 方法文件地址 */ @NotEmpty(message = "请上传文件") - private String url; + private String fileUrl; + + private String fileName; /** 签名人密码 */ @NotEmpty(message = "请输入签名人密码") @@ -57,12 +59,12 @@ public class StudyMethodForm { this.ffmc = ffmc; } - public String getUrl() { - return url; + public String getFileUrl() { + return fileUrl; } - public void setUrl(String url) { - this.url = url; + public void setFileUrl(String fileUrl) { + this.fileUrl = fileUrl; } public String getQmrmm() { @@ -88,4 +90,12 @@ public class StudyMethodForm { public void setQmrId(Long qmrId) { this.qmrId = qmrId; } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } } 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 index 82c5703..c36cec6 100644 --- 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 @@ -16,7 +16,7 @@ public class StudyMethodSearchForm { private String endDate; /** 是否已读 0-未读 1-已读 */ - private Integer read; + private Integer zt; public Long getStudySubjectId() { return studySubjectId; @@ -58,11 +58,11 @@ public class StudyMethodSearchForm { this.endDate = endDate; } - public Integer getRead() { - return read; + public Integer getZt() { + return zt; } - public void setRead(Integer read) { - this.read = read; + public void setZt(Integer zt) { + this.zt = zt; } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMethodMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMethodMapper.java index 2a04155..3932a92 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMethodMapper.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMethodMapper.java @@ -1,7 +1,14 @@ package com.hxhq.business.mapper; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.hxhq.business.domain.Mjy; import com.hxhq.business.domain.StudyMethod; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + /** * 试验-试验方法Mapper接口 * @@ -11,4 +18,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; public interface StudyMethodMapper extends BaseMapper { + List queryList(@Param("ew") Wrapper queryWrapper, @Param("qmrId") Long qmrId); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMethodReadMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMethodReadMapper.java new file mode 100644 index 0000000..37ea4e4 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMethodReadMapper.java @@ -0,0 +1,16 @@ +package com.hxhq.business.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hxhq.business.domain.StudyMethod; +import com.hxhq.business.domain.StudyMethodRead; + +/** + * 试验-试验方法已读Mapper接口 + * + * @author hxhq + * @date 2025-12-29 + */ +public interface StudyMethodReadMapper extends BaseMapper +{ + +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodReadService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodReadService.java new file mode 100644 index 0000000..1207e02 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodReadService.java @@ -0,0 +1,18 @@ +package com.hxhq.business.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hxhq.business.domain.StudyMethod; +import com.hxhq.business.domain.StudyMethodRead; +import com.hxhq.business.form.study.StudyMethodForm; + +import java.util.List; + +/** + * 试验-试验方法Service接口 + * + * @author hxhq + * @date 2025-12-29 + */ +public interface IStudyMethodReadService extends IService +{ +} 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 0f4be4a..670755b 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 @@ -4,6 +4,7 @@ import java.util.List; import com.hxhq.business.domain.StudyMethod; import com.baomidou.mybatisplus.extension.service.IService; import com.hxhq.business.form.study.StudyMethodForm; +import com.hxhq.business.form.study.StudyMethodSearchForm; /** * 试验-试验方法Service接口 @@ -19,7 +20,7 @@ public interface IStudyMethodService extends IService * @param form 试验-试验方法 * @return 试验-试验方法集合 */ - public List queryList(StudyMethodForm form); + public List queryList(StudyMethodSearchForm form); /** * 上传试验方法 diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodReadServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodReadServiceImpl.java new file mode 100644 index 0000000..2814323 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodReadServiceImpl.java @@ -0,0 +1,31 @@ +package com.hxhq.business.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hxhq.business.domain.StudyMethod; +import com.hxhq.business.domain.StudyMethodRead; +import com.hxhq.business.form.study.StudyMethodForm; +import com.hxhq.business.mapper.StudyMethodMapper; +import com.hxhq.business.mapper.StudyMethodReadMapper; +import com.hxhq.business.service.IStudyMethodReadService; +import com.hxhq.business.service.IStudyMethodService; +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 java.util.List; + +/** + * 试验-试验方法已读Service业务层处理 + * + * @author hxhq + * @date 2025-12-29 + */ +@Service +public class StudyMethodReadServiceImpl extends ServiceImpl implements IStudyMethodReadService +{ + + +} 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 a965128..a7143f8 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 @@ -2,10 +2,15 @@ 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.domain.StudyMethodRead; +import com.hxhq.business.enums.study.StudyMethodStatusEnum; import com.hxhq.business.form.study.StudyMethodForm; +import com.hxhq.business.form.study.StudyMethodSearchForm; +import com.hxhq.business.service.IStudyMethodReadService; +import com.hxhq.common.security.utils.SecurityUtils; import com.hxhq.system.api.domain.SysUser; import com.hxhq.system.service.ISysUserService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -27,6 +32,9 @@ public class StudyMethodServiceImpl extends ServiceImpl queryList(StudyMethodForm form) { - return null; + public List queryList(StudyMethodSearchForm form) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("m.del_flag", 0); + if(form.getStudySubjectId() != null) { + queryWrapper.eq("m.study_subject_id", form.getStudySubjectId()); + } + if(StringUtils.isNotEmpty(form.getFfmc())) { + queryWrapper.like("m.ffmc", form.getFfmc()); + } + if(StringUtils.isNotEmpty(form.getCreateUser())) { + queryWrapper.like("m.user_mc", form.getCreateUser()); + } + if(StringUtils.isNotEmpty(form.getStartDate())) { + queryWrapper.ge("m.create_time", form.getStartDate()); + } + if(StringUtils.isNotEmpty(form.getEndDate())) { + queryWrapper.le("m.create_time", form.getEndDate()); + } + // 已读 + if(form.getZt() != null && form.getZt() == StudyMethodStatusEnum.yd.getValue()) { + queryWrapper.and(p -> p.apply("(m.id IN (SELECT study_method_id FROM t_study_method_read WHERE del_flag = 0 AND qmr_id = {0} AND study_subject_id = {1}))" + , SecurityUtils.getUserId(), form.getStudySubjectId())); + } + // 未读 + if(form.getZt() != null && form.getZt() == StudyMethodStatusEnum.wd.getValue()) { + queryWrapper.and(p -> p.apply("(m.id NOT IN (SELECT study_method_id FROM t_study_method_read WHERE del_flag = 0 AND qmr_id = {0} AND study_subject_id = {1}))" + , SecurityUtils.getUserId(), form.getStudySubjectId())); + } + queryWrapper.orderByDesc("m.create_time"); + return baseMapper.queryList(queryWrapper, SecurityUtils.getUserId()); } @Override @@ -44,7 +80,18 @@ public class StudyMethodServiceImpl extends ServiceImpl + \ No newline at end of file