zss
6 天以前 83abd7b427e84f6813e1a017912cf61676103316
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.ruoyi.account.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.account.mapper.BorrowInfoMapper;
import com.ruoyi.account.pojo.BorrowInfo;
import com.ruoyi.account.service.BorrowInfoService;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.domain.AjaxResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
/**
 * <p>
 * 借款信息表 服务实现类
 * </p>
 *
 * @author 芯导软件(江苏)有限公司
 * @since 2026-01-15 02:57:29
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class BorrowInfoServiceImpl extends ServiceImpl<BorrowInfoMapper, BorrowInfo> implements BorrowInfoService {
 
    private final BorrowInfoMapper borrowInfoMapper;
 
    @Override
    public AjaxResult listPage(Page page, BorrowInfo borrowInfo) {
        LambdaQueryWrapper<BorrowInfo> borrowInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
        if(borrowInfo != null){
            if(StringUtils.isNotEmpty(borrowInfo.getEntryDateStart()) && StringUtils.isNotEmpty(borrowInfo.getEntryDateEnd())){
                borrowInfoLambdaQueryWrapper.ge(BorrowInfo::getBorrowDate, borrowInfo.getEntryDateStart());
                borrowInfoLambdaQueryWrapper.le(BorrowInfo::getBorrowDate, borrowInfo.getEntryDateEnd());
            }
            if(borrowInfo.getStatus() != null){
                borrowInfoLambdaQueryWrapper.eq(BorrowInfo::getStatus, borrowInfo.getStatus());
            }
            if(StringUtils.isNotEmpty(borrowInfo.getBorrowerName())){
                borrowInfoLambdaQueryWrapper.like(BorrowInfo::getBorrowerName, borrowInfo.getBorrowerName());
            }
        }
        return AjaxResult.success(borrowInfoMapper.selectPage(page, borrowInfoLambdaQueryWrapper));
    }
 
    @Override
    public AjaxResult add(BorrowInfo borrowInfo) {
        int insert = borrowInfoMapper.insert(borrowInfo);
        if(insert > 0){
           return AjaxResult.success("添加成功");
        }
        return AjaxResult.success("添加失败");
    }
 
    @Override
    public AjaxResult updateBorrowInfo(BorrowInfo borrowInfo) {
        int update = borrowInfoMapper.updateById(borrowInfo);
        if(update > 0){
            return AjaxResult.success("修改成功");
        }
        return  AjaxResult.success("修改失败");
    }
 
    @Override
    public AjaxResult delete(List<Long> ids) {
        int delete = borrowInfoMapper.deleteBatchIds(ids);
        if(delete > 0){
           return AjaxResult.success("删除成功");
        }
        return  AjaxResult.success("删除失败");
    }
}