whywhyo
2023-07-11 e5ebd02de9615e2a22694dba7e4207526054b2f8
123456
10个文件已修改
791 ■■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSelfNoteController.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZYearInfoController.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZSecret.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZSelfNote.java 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZYearHealth.java 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZYearInfo.java 114 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZYearInfoService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteServiceImpl.java 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZYearInfoServiceImpl.java 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSelfNoteController.java
@@ -1,9 +1,27 @@
package com.ruoyi.web.controller.zhang;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.ZSelfNote;
import com.ruoyi.service.ZSelfNoteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM;
import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE;
/**
 * <p>
@@ -15,7 +33,96 @@
 */
@RestController
@RequestMapping("/zSelfNote")
public class ZSelfNoteController {
@Slf4j
public class ZSelfNoteController extends BaseController {
    @Autowired
    private ZSelfNoteService zSelfNoteService;
    /**
     * 查询所有记录
     */
    @GetMapping("/all")
    public AjaxResult listAll(ZSelfNote zSelfNote){
        Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zSelfNoteService.selectDataList(zSelfNote,pageNum,pageSize);
    }
    /**
     * 根据id查询
     */
    @GetMapping()
    public AjaxResult listById(Long id){
        return AjaxResult.success(zSelfNoteService.getById(id));
    }
    /**
     * 模板
     */
    @GetMapping("/model")
    public void getModel(HttpServletResponse response){
        ZSelfNote zSelfNote = new ZSelfNote();
        List<ZSelfNote> emptyList = Collections.singletonList(zSelfNote);
        ExcelUtil<ZSelfNote> util = new ExcelUtil<>(ZSelfNote.class);
        util.exportExcel(response, emptyList, "个人记事本记录数据");
    }
    /**
     * 导出个人记事本记录列表
     */
//    @PreAuthorize("@ss.hasPermi('system:property:export')")
    @Log(title = "个人记事本记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export/{ids}")
    public void export(HttpServletResponse response,@PathVariable Long[] ids)
    {
        List<ZSelfNote> list = zSelfNoteService.selectByIds(ids);
        log.info("导出记录为:{}",list);
        ExcelUtil<ZSelfNote> util = new ExcelUtil<>(ZSelfNote.class);
        util.exportExcel(response, list, "个人记事本记录数据");
    }
    /**
     * 导入个人记事本记录列表
     */
    @Log(title = "用户管理", businessType = BusinessType.IMPORT)
    @PostMapping("/importData")
    public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception
    {
        return zSelfNoteService.importExcel(file);
    }
    /**
     * 新增个人记事本记录
     */
//    @PreAuthorize("@ss.hasPermi('system:property:add')")
    @Log(title = "个人记事本记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZSelfNote zSelfNote)
    {
        return zSelfNoteService.mySave(zSelfNote);
    }
    /**
     * 修改个人记事本记录
     */
//    @PreAuthorize("@ss.hasPermi('system:property:edit')")
    @Log(title = "个人记事本记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZSelfNote zSelfNote)
    {
        return toAjax(zSelfNoteService.updateById(zSelfNote));
    }
//
    /**
     * 批量删除个人记事本记录
     */
//    @PreAuthorize("@ss.hasPermi('system:property:remove')")
    @Log(title = "个人记事本记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zSelfNoteService.removeByIds(Arrays.asList(ids)));
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZYearInfoController.java
@@ -1,9 +1,27 @@
package com.ruoyi.web.controller.zhang;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.ZYearInfo;
import com.ruoyi.service.ZYearInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM;
import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE;
/**
 * <p>
@@ -15,7 +33,96 @@
 */
@RestController
@RequestMapping("/zYearInfo")
public class ZYearInfoController {
@Slf4j
public class ZYearInfoController extends BaseController {
    @Autowired
    private ZYearInfoService zYearInfoService;
    /**
     * 查询所有记录
     */
    @GetMapping("/all")
    public AjaxResult listAll(ZYearInfo zYearInfo){
        Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zYearInfoService.selectDataList(zYearInfo,pageNum,pageSize);
    }
    /**
     * 根据id查询
     */
    @GetMapping()
    public AjaxResult listById(Long id){
        return AjaxResult.success(zYearInfoService.getById(id));
    }
    /**
     * 模板
     */
    @GetMapping("/model")
    public void getModel(HttpServletResponse response){
        ZYearInfo zYearInfo = new ZYearInfo();
        List<ZYearInfo> emptyList = Collections.singletonList(zYearInfo);
        ExcelUtil<ZYearInfo> util = new ExcelUtil<>(ZYearInfo.class);
        util.exportExcel(response, emptyList, "年度健康记录数据");
    }
    /**
     * 导出年度健康记录列表
     */
//    @PreAuthorize("@ss.hasPermi('system:property:export')")
    @Log(title = "年度健康记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export/{ids}")
    public void export(HttpServletResponse response,@PathVariable Long[] ids)
    {
        List<ZYearInfo> list = zYearInfoService.selectByIds(ids);
        log.info("导出记录为:{}",list);
        ExcelUtil<ZYearInfo> util = new ExcelUtil<>(ZYearInfo.class);
        util.exportExcel(response, list, "年度健康记录数据");
    }
    /**
     * 导入年度健康记录列表
     */
    @Log(title = "用户管理", businessType = BusinessType.IMPORT)
    @PostMapping("/importData")
    public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception
    {
        return zYearInfoService.importExcel(file);
    }
    /**
     * 新增年度健康记录
     */
//    @PreAuthorize("@ss.hasPermi('system:property:add')")
    @Log(title = "年度健康记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZYearInfo zYearInfo)
    {
        return zYearInfoService.mySave(zYearInfo);
    }
    /**
     * 修改年度健康记录
     */
//    @PreAuthorize("@ss.hasPermi('system:property:edit')")
    @Log(title = "年度健康记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZYearInfo zYearInfo)
    {
        return toAjax(zYearInfoService.updateById(zYearInfo));
    }
//
    /**
     * 批量删除年度健康记录
     */
//    @PreAuthorize("@ss.hasPermi('system:property:remove')")
    @Log(title = "年度健康记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zYearInfoService.removeByIds(Arrays.asList(ids)));
    }
}
zhang-content/src/main/java/com/ruoyi/domain/ZSecret.java
@@ -113,4 +113,6 @@
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date happenEndTime;
}
zhang-content/src/main/java/com/ruoyi/domain/ZSelfNote.java
@@ -1,10 +1,16 @@
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
 * <p>
@@ -15,27 +21,23 @@
 * @since 2023-03-14
 */
@TableName("z_self_note")
@Data
public class ZSelfNote implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private Long id;
    /**
     * 用户id
     */
    private Integer userId;
    private Long uid;
    /**
     * 地点
     */
    private String address;
    /**
     * 时间
     */
    private LocalDateTime noteDate;
    /**
     * 标题
@@ -47,64 +49,35 @@
     */
    private String remark;
    /**
     * 人物
     */
    private String people;
    public Integer getId() {
        return id;
    }
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createTime;
    public void setId(Integer id) {
        this.id = id;
    }
    /**
     * 发生时间
     */
    @Excel(name = "发生时间",dateFormat = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date happenTime;
    public Integer getUserId() {
        return userId;
    }
    /**
     * 电子文件路径
     */
    private String url;
    public void setUserId(Integer userId) {
        this.userId = userId;
    }
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date happenStartTime;
    public String getAddress() {
        return address;
    }
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date happenEndTime;
    public void setAddress(String address) {
        this.address = address;
    }
    public LocalDateTime getNoteDate() {
        return noteDate;
    }
    public void setNoteDate(LocalDateTime noteDate) {
        this.noteDate = noteDate;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Override
    public String toString() {
        return "ZSelfNote{" +
        "id=" + id +
        ", userId=" + userId +
        ", address=" + address +
        ", noteDate=" + noteDate +
        ", title=" + title +
        ", remark=" + remark +
        "}";
    }
}
zhang-content/src/main/java/com/ruoyi/domain/ZYearHealth.java
@@ -3,6 +3,8 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
@@ -14,17 +16,18 @@
 * @since 2023-03-14
 */
@TableName("z_year_health")
@Data
public class ZYearHealth implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private Long id;
    /**
     * 年度健康表持有者id
     */
    private Integer uid;
    private Long uid;
    /**
     * 生活习惯
@@ -66,100 +69,4 @@
     */
    private String diseaseOutcome;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public Integer getUid() {
        return uid;
    }
    public void setUid(Integer uid) {
        this.uid = uid;
    }
    public String getLifeHabit() {
        return lifeHabit;
    }
    public void setLifeHabit(String lifeHabit) {
        this.lifeHabit = lifeHabit;
    }
    public String getTreatment() {
        return treatment;
    }
    public void setTreatment(String treatment) {
        this.treatment = treatment;
    }
    public String getFamilyDisease() {
        return familyDisease;
    }
    public void setFamilyDisease(String familyDisease) {
        this.familyDisease = familyDisease;
    }
    public String getNowDisease() {
        return nowDisease;
    }
    public void setNowDisease(String nowDisease) {
        this.nowDisease = nowDisease;
    }
    public String getDiseaseHappen() {
        return diseaseHappen;
    }
    public void setDiseaseHappen(String diseaseHappen) {
        this.diseaseHappen = diseaseHappen;
    }
    public String getDiseaseDevelop() {
        return diseaseDevelop;
    }
    public void setDiseaseDevelop(String diseaseDevelop) {
        this.diseaseDevelop = diseaseDevelop;
    }
    public String getDiseaseTreat() {
        return diseaseTreat;
    }
    public void setDiseaseTreat(String diseaseTreat) {
        this.diseaseTreat = diseaseTreat;
    }
    public String getDiseaseOutcome() {
        return diseaseOutcome;
    }
    public void setDiseaseOutcome(String diseaseOutcome) {
        this.diseaseOutcome = diseaseOutcome;
    }
    @Override
    public String toString() {
        return "ZYearHealth{" +
        "id=" + id +
        ", uid=" + uid +
        ", lifeHabit=" + lifeHabit +
        ", treatment=" + treatment +
        ", familyDisease=" + familyDisease +
        ", nowDisease=" + nowDisease +
        ", diseaseHappen=" + diseaseHappen +
        ", diseaseDevelop=" + diseaseDevelop +
        ", diseaseTreat=" + diseaseTreat +
        ", diseaseOutcome=" + diseaseOutcome +
        "}";
    }
}
zhang-content/src/main/java/com/ruoyi/domain/ZYearInfo.java
@@ -1,10 +1,17 @@
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
 * <p>
@@ -15,124 +22,71 @@
 * @since 2023-03-14
 */
@TableName("z_year_info")
@Data
public class ZYearInfo implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private Long id;
    /**
     * 年度健康表id
     */
    private Integer hid;
    private Long uid;
    /**
     * 体检时间
     */
    private LocalDateTime checkTime;
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "体检时间")
    private Date checkTime;
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date happenStartTime;
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date happenEndTime;
    /**
     * 看病:0、体检:1
     * 类型
     */
    private Integer type;
    @Excel(name = "类型")
    private String type;
    /**
     * 就诊医院
     */
    @Excel(name = "就诊医院")
    private String hospital;
    /**
     * 题名
     */
    @Excel(name = "题名")
    private String title;
    /**
     * 注意事项
     */
    @Excel(name = "注意事项")
    private String notice;
    /**
     * 备注
     */
    @Excel(name = "备注")
    private String remark;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createTime;
    public Integer getId() {
        return id;
    }
    private String url;
    public void setId(Integer id) {
        this.id = id;
    }
    public Integer getHid() {
        return hid;
    }
    public void setHid(Integer hid) {
        this.hid = hid;
    }
    public LocalDateTime getCheckTime() {
        return checkTime;
    }
    public void setCheckTime(LocalDateTime checkTime) {
        this.checkTime = checkTime;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getNotice() {
        return notice;
    }
    public void setNotice(String notice) {
        this.notice = notice;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Override
    public String toString() {
        return "ZYearInfo{" +
        "id=" + id +
        ", hid=" + hid +
        ", checkTime=" + checkTime +
        ", type=" + type +
        ", hospital=" + hospital +
        ", title=" + title +
        ", notice=" + notice +
        ", remark=" + remark +
        "}";
    }
}
zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteService.java
@@ -2,7 +2,11 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZSelfNote;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
 * <p>
@@ -14,4 +18,11 @@
 */
public interface ZSelfNoteService extends IService<ZSelfNote> {
    AjaxResult selectDataList(ZSelfNote zSelfNote, Integer pageNum, Integer pageSize);
    List<ZSelfNote> selectByIds(Long[] ids);
    AjaxResult importExcel(MultipartFile file);
    AjaxResult mySave(ZSelfNote zSelfNote);
}
zhang-content/src/main/java/com/ruoyi/service/ZYearInfoService.java
@@ -2,7 +2,12 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZYearInfo;
import com.ruoyi.domain.ZYearInfo;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
 * <p>
@@ -13,5 +18,11 @@
 * @since 2023-03-14
 */
public interface ZYearInfoService extends IService<ZYearInfo> {
    AjaxResult selectDataList(ZYearInfo zYearInfo, Integer pageNum, Integer pageSize);
    List<ZYearInfo> selectByIds(Long[] ids);
    AjaxResult importExcel(MultipartFile file);
    AjaxResult mySave(ZYearInfo zYearInfo);
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteServiceImpl.java
@@ -1,11 +1,28 @@
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.MapUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.ZSelfNote;
import com.ruoyi.domain.ZSelfNote;
import com.ruoyi.mapper.ZSelfNoteMapper;
import com.ruoyi.service.ZSelfNoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
/**
 * <p>
@@ -18,4 +35,101 @@
@Service
public class ZSelfNoteServiceImpl extends ServiceImpl<ZSelfNoteMapper, ZSelfNote> implements ZSelfNoteService {
    @Autowired
    ZSelfNoteServiceImpl zSelfNoteService;
    private LambdaQueryWrapper<ZSelfNote> uniqueCondition(ZSelfNote zSelfNote) {
        LambdaQueryWrapper<ZSelfNote> lqw = new LambdaQueryWrapper<>();
        lqw.eq(StringUtils.isNotEmpty(zSelfNote.getAddress()), ZSelfNote::getAddress, zSelfNote.getAddress())
                .eq(StringUtils.isNotEmpty(zSelfNote.getPeople()), ZSelfNote::getPeople, zSelfNote.getPeople())
                .eq(zSelfNote.getHappenTime() != null, ZSelfNote::getHappenTime, zSelfNote.getHappenTime())
                .eq(StringUtils.isNotEmpty(zSelfNote.getTitle()), ZSelfNote::getTitle, zSelfNote.getTitle())
                .eq(StringUtils.isNotEmpty(zSelfNote.getRemark()), ZSelfNote::getRemark, zSelfNote.getRemark())
                .eq(zSelfNote.getUid() != null, ZSelfNote::getUid, zSelfNote.getUid());
        return lqw;
    }
    private LambdaQueryWrapper<ZSelfNote> buildCondition(ZSelfNote zSelfNote, Long userId) {
        LambdaQueryWrapper<ZSelfNote> lqw = new LambdaQueryWrapper<>();
        lqw.eq(userId != null, ZSelfNote::getUid, userId)
                .like(StringUtils.isNotEmpty(zSelfNote.getPeople()), ZSelfNote::getPeople, zSelfNote.getPeople())
                .like(StringUtils.isNotEmpty(zSelfNote.getTitle()), ZSelfNote::getTitle, zSelfNote.getTitle())
                .between(zSelfNote.getHappenStartTime() != null && zSelfNote.getHappenEndTime() != null, ZSelfNote::getHappenTime, zSelfNote.getHappenStartTime(), zSelfNote.getHappenEndTime())
                .orderByDesc(ZSelfNote::getCreateTime);
        return lqw;
    }
    /**
     * 分页查找
     */
    @Override
    public AjaxResult selectDataList(ZSelfNote zSelfNote, Integer pageNum, Integer pageSize) {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        Long userId = user.getUserId();
        LambdaQueryWrapper<ZSelfNote> lqw = buildCondition(zSelfNote, userId);
        Page<ZSelfNote> pageBean = new Page<>(pageNum, pageSize);
        Page<ZSelfNote> pageResult = page(pageBean, lqw);
        List<ZSelfNote> beanRecords = pageResult.getRecords();//得到查询出来的数据
        HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords);
        return AjaxResult.success(data);
    }
    @Override
    public List<ZSelfNote> selectByIds(Long[] ids) {
        List<ZSelfNote> list = new ArrayList<>();
        if (ids.length != 0)
            list = listByIds(Arrays.asList(ids));
        else
            list = list();
        return list;
    }
    @Override
    public AjaxResult mySave(ZSelfNote zSelfNote) {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        Long userId = user.getUserId();
        zSelfNote.setUid(userId);
        //检查是否有重复数据插入
        LambdaQueryWrapper<ZSelfNote> lqw = uniqueCondition(zSelfNote);
        List<ZSelfNote> list = list(lqw);
        if (list.size() > 0) {
            throw new RuntimeException("请勿新增重复数据");
        }
        if (save(zSelfNote)) {
            return AjaxResult.success();
        } else {
            return AjaxResult.error();
        }
    }
    @Override
    @Transactional
    public AjaxResult importExcel(MultipartFile file) {
        ExcelUtil<ZSelfNote> util = new ExcelUtil<>(ZSelfNote.class);
        List<ZSelfNote> dataList = null;
        try {
            dataList = util.importExcel(file.getInputStream());
        } catch (Exception e) {
            throw new RuntimeException("没有按照规则导入数据");
        }
        assert dataList != null;
        for (ZSelfNote zSelfNote : dataList) {
            zSelfNoteService.mySave(zSelfNote);
        }
        return AjaxResult.success();
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZYearInfoServiceImpl.java
@@ -1,11 +1,28 @@
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.MapUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.ZYearInfo;
import com.ruoyi.domain.ZYearInfo;
import com.ruoyi.mapper.ZYearInfoMapper;
import com.ruoyi.service.ZYearInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
/**
 * <p>
@@ -18,4 +35,102 @@
@Service
public class ZYearInfoServiceImpl extends ServiceImpl<ZYearInfoMapper, ZYearInfo> implements ZYearInfoService {
    @Autowired
    ZYearInfoServiceImpl zYearInfoService;
    private LambdaQueryWrapper<ZYearInfo> uniqueCondition(ZYearInfo zYearInfo) {
        LambdaQueryWrapper<ZYearInfo> lqw = new LambdaQueryWrapper<>();
        lqw.eq(StringUtils.isNotEmpty(zYearInfo.getType()), ZYearInfo::getType, zYearInfo.getType())
                .eq(StringUtils.isNotEmpty(zYearInfo.getHospital()), ZYearInfo::getHospital, zYearInfo.getHospital())
                .eq(StringUtils.isNotEmpty(zYearInfo.getTitle()), ZYearInfo::getTitle, zYearInfo.getTitle())
                .eq(zYearInfo.getCheckTime() != null, ZYearInfo::getCheckTime, zYearInfo.getCheckTime())
                .eq(StringUtils.isNotEmpty(zYearInfo.getNotice()), ZYearInfo::getNotice, zYearInfo.getNotice())
                .eq(StringUtils.isNotEmpty(zYearInfo.getRemark()), ZYearInfo::getRemark, zYearInfo.getRemark())
                .eq(zYearInfo.getUid() != null, ZYearInfo::getUid, zYearInfo.getUid());
        return lqw;
    }
    private LambdaQueryWrapper<ZYearInfo> buildCondition(ZYearInfo zYearInfo, Long userId) {
        LambdaQueryWrapper<ZYearInfo> lqw = new LambdaQueryWrapper<>();
        lqw.eq(userId != null, ZYearInfo::getUid, userId)
                .like(StringUtils.isNotEmpty(zYearInfo.getType()), ZYearInfo::getType, zYearInfo.getType())
                .like(StringUtils.isNotEmpty(zYearInfo.getHospital()), ZYearInfo::getHospital, zYearInfo.getHospital())
                .like(StringUtils.isNotEmpty(zYearInfo.getTitle()), ZYearInfo::getTitle, zYearInfo.getTitle())
                .between(zYearInfo.getHappenStartTime() != null && zYearInfo.getHappenEndTime() != null, ZYearInfo::getCheckTime, zYearInfo.getHappenStartTime(), zYearInfo.getHappenEndTime())
                .orderByDesc(ZYearInfo::getCreateTime);
        return lqw;
    }
    /**
     * 分页查找
     */
    @Override
    public AjaxResult selectDataList(ZYearInfo zYearInfo, Integer pageNum, Integer pageSize) {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        Long userId = user.getUserId();
        LambdaQueryWrapper<ZYearInfo> lqw = buildCondition(zYearInfo, userId);
        Page<ZYearInfo> pageBean = new Page<>(pageNum, pageSize);
        Page<ZYearInfo> pageResult = page(pageBean, lqw);
        List<ZYearInfo> beanRecords = pageResult.getRecords();//得到查询出来的数据
        HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords);
        return AjaxResult.success(data);
    }
    @Override
    public List<ZYearInfo> selectByIds(Long[] ids) {
        List<ZYearInfo> list = new ArrayList<>();
        if (ids.length != 0)
            list = listByIds(Arrays.asList(ids));
        else
            list = list();
        return list;
    }
    @Override
    public AjaxResult mySave(ZYearInfo zYearInfo) {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        Long userId = user.getUserId();
        zYearInfo.setUid(userId);
        //检查是否有重复数据插入
        LambdaQueryWrapper<ZYearInfo> lqw = uniqueCondition(zYearInfo);
        List<ZYearInfo> list = list(lqw);
        if (list.size() > 0) {
            throw new RuntimeException("请勿新增重复数据");
        }
        if (save(zYearInfo)) {
            return AjaxResult.success();
        } else {
            return AjaxResult.error();
        }
    }
    @Override
    @Transactional
    public AjaxResult importExcel(MultipartFile file) {
        ExcelUtil<ZYearInfo> util = new ExcelUtil<>(ZYearInfo.class);
        List<ZYearInfo> dataList = null;
        try {
            dataList = util.importExcel(file.getInputStream());
        } catch (Exception e) {
            throw new RuntimeException("没有按照规则导入数据");
        }
        assert dataList != null;
        for (ZYearInfo zYearInfo : dataList) {
            zYearInfoService.mySave(zYearInfo);
        }
        return AjaxResult.success();
    }
}