liyong
5 小时以前 1ca5584d7e3200a9af65a099bd26d3593e2ba702
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.ruoyi.sales.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.other.mapper.TempFileMapper;
import com.ruoyi.sales.mapper.CommonFileMapper;
import com.ruoyi.sales.pojo.CommonFile;
import com.ruoyi.sales.service.ICommonFileService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
 
import java.util.Arrays;
import java.util.List;
 
@Service
@RequiredArgsConstructor
@Slf4j
public class CommonFileServiceImpl extends ServiceImpl<CommonFileMapper, CommonFile> implements ICommonFileService {
 
    private final CommonFileMapper commonFileMapper;
 
    private final TempFileMapper tempFileMapper;
 
    public List<CommonFile> getFileListByBusinessId(Long businessId,Integer type) {
        return commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>().eq(CommonFile::getCommonId, businessId)
                .eq(CommonFile::getType, type));
    }
 
    public void deleteByBusinessId(Long businessId,Integer type) {
        commonFileMapper.delete(new LambdaQueryWrapper<CommonFile>().eq(CommonFile::getCommonId, businessId)
                .eq(CommonFile::getType, type));
    }
 
    public void deleteByBusinessIds(List<Long> businessId,Integer type) {
        commonFileMapper.delete(new LambdaQueryWrapper<CommonFile>().in(CommonFile::getCommonId, businessId)
                .eq(CommonFile::getType, type));
    }
 
 
    @Override
    public int deleteSalesLedgerByIds(Long[] ids) {
       for (Long id : ids) {
           if (id == null) {
               return 1;
           }
       }
        return commonFileMapper.deleteBatchIds(Arrays.asList(ids));
    }
 
 
    @Override
    public int delCommonFileByIds(Long[] ids) {
        return commonFileMapper.deleteBatchIds(Arrays.asList(ids));
    }
}