管道基础大数据平台系统开发-【后端】-Server
13693261870
2024-03-21 e55b5aaddc111abc8ae61260eb20fddf6b089c07
src/main/java/com/lf/server/service/sys/DownlogService.java
@@ -1,11 +1,16 @@
package com.lf.server.service.sys;
import com.lf.server.entity.data.DownloadEntity;
import com.lf.server.entity.sys.DownlogEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.helper.StringHelper;
import com.lf.server.helper.WebHelper;
import com.lf.server.mapper.sys.DownlogMapper;
import com.lf.server.service.data.DownloadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.sql.Timestamp;
import java.util.List;
@@ -18,16 +23,19 @@
    @Autowired
    DownlogMapper downlogMapper;
    @Autowired
    DownloadService downloadService;
    @Override
    public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end) {
        uname = StringHelper.getLikeStr(uname);
        uname = StringHelper.getLikeUpperStr(uname);
        return downlogMapper.selectCount(uname, type, start, end);
    }
    @Override
    public List<DownlogEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset) {
        uname = StringHelper.getLikeStr(uname);
        uname = StringHelper.getLikeUpperStr(uname);
        return downlogMapper.selectByPage(uname, type, start, end, limit, offset);
    }
@@ -71,4 +79,20 @@
    public Integer updates(List<DownlogEntity> list) {
        return downlogMapper.updates(list);
    }
    /**
     * 更新下载信息
     */
    public void updateInfos(UserEntity ue, DownloadEntity de, HttpServletRequest req) {
        de.setDcount(de.getDcount() + 1);
        de.setDownloadUser(ue.getId());
        int rows = downloadService.update(de);
        DownlogEntity entity = new DownlogEntity();
        entity.setDownid(de.getId());
        entity.setCreateUser(ue.getId());
        entity.setIp(WebHelper.getIpAddress(req));
        rows = downlogMapper.insert(entity);
    }
}