feige
2025-04-29 fb7ca62d2854c82ac6e0a551bf921dabe6ee7bbc
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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.utils.MapUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.Physcial;
import com.ruoyi.domain.qrcode;
import com.ruoyi.mapper.PhyscialMapper;
import com.ruoyi.mapper.qrcodeMapper;
import com.ruoyi.service.PhyscialService;
import com.ruoyi.service.qrCodeService;
import org.springframework.stereotype.Service;
 
import java.text.ParseException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@Service
public class qrCodeServiceImpl extends ServiceImpl<qrcodeMapper, qrcode> implements qrCodeService {
 
 
 
 
    private LambdaQueryWrapper<qrcode> buildCondition(qrcode cos){
        LambdaQueryWrapper<qrcode> lqw = new LambdaQueryWrapper<>();
 
        lqw.like(!StringUtils.isEmpty(cos.getName()),qrcode::getName,cos.getName())
                .between(cos.getHappenStartDeadTime()!=null&&cos.getHappenEndDeadTime()!=null,qrcode::getCreateTime,cos.getHappenStartDeadTime(),cos.getHappenEndDeadTime());
//        lqw.like(!StringUtils.isEmpty(zfProperty.getType()), ZfProperty::getType, zfProperty.getType())
//                .like(!StringUtils.isEmpty(zfProperty.getTitle()), ZfProperty::getTitle, zfProperty.getTitle())
//                .like(!StringUtils.isEmpty(zfProperty.getLocation()), ZfProperty::getLocation, zfProperty.getLocation())
//                .like(!StringUtils.isEmpty(zfProperty.getHolder()), ZfProperty::getHolder, zfProperty.getHolder())
//                .like(!StringUtils.isEmpty(zfProperty.getAddress()), ZfProperty::getAddress, zfProperty.getAddress())
//                .like(!StringUtils.isEmpty(zfProperty.getRemark()), ZfProperty::getRemark, zfProperty.getRemark())
//                .eq(zfProperty.getFamilyId()!=null,ZfProperty::getFamilyId,zfProperty.getFamilyId())
//                .in(ZfProperty::getFamilyId,familyIdList)
//                .eq(zfProperty.getHappenTime()!=null,ZfProperty::getHappenTime,zfProperty.getHappenTime())
//                .between(zfProperty.getHappenStartTime() != null && zfProperty.getHappenEndTime() != null, ZfProperty::getHappenTime, zfProperty.getHappenStartTime(), zfProperty.getHappenEndTime());
//        if(cos.getUid()!=1)
//            lqw.eq(cos.getUid()!=null, coscan::getUid,cos.getUid());
        lqw.orderByDesc(qrcode::getCreateTime);
        return lqw;
 
    }
 
    @Override
    public List<qrcode> selectByCondition(qrcode cos) {
        LambdaQueryWrapper<qrcode> lqw = buildCondition(cos);
        List<qrcode> beanRecords = list(lqw);
        return beanRecords;
    }
 
    @Override
    public AjaxResult selectDataList(qrcode cos, Integer pageNum, Integer pageSize) {
        LambdaQueryWrapper<qrcode> lqw = buildCondition(cos);
 
        System.out.println(pageNum);
        System.out.println(pageSize);
        System.out.println("--------------------");
        Page<qrcode> zfPropertyPage = new Page<>(pageNum, pageSize);
        Page<qrcode> pageResult =
                // page(zfPropertyPage);
                page(zfPropertyPage, lqw);
        long total = pageResult.getTotal();
        List<qrcode> beanRecords = pageResult.getRecords();//得到查询出来的数据
        System.out.println(beanRecords);
        //  List<ZfProperty> dtoResult = markOwnData(familyId, beanRecords);
 
        HashMap<String, Object> data = MapUtils.getResult(pageResult);
        return AjaxResult.success(data);
    }
 
    @Override
    public AjaxResult addData(qrcode cos) throws ParseException {
        if (save(cos)) {
            return AjaxResult.success();
        }
        else{
            return AjaxResult.error();
        }
    }
 
    @Override
    public AjaxResult updateData(qrcode cos) {
        if(this.updateById(cos))
            return AjaxResult.success("修改成功!");
        else
            return AjaxResult.error("修改失败!");
    }
 
    @Override
    public AjaxResult deleteData(Long[] ids) {
 
        if (this.removeByIds(Arrays.asList(ids))) {
 
 
            return AjaxResult.success();
        }else {
            return AjaxResult.error();
        }
    }
}