ny
23 小时以前 b6f169fe43a2b13f351aefc152374fc7f0bc8cb7
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
package jnpf.portal.model;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import jnpf.base.MyBatisPrimaryBase;
import jnpf.base.UserInfo;
import jnpf.constant.JnpfConst;
import jnpf.portal.constant.PortalConst;
import jnpf.portal.entity.PortalDataEntity;
import jnpf.util.UserProvider;
import jnpf.util.context.SpringContext;
import lombok.Data;
 
import java.util.Objects;
 
/**
 * 类功能
 *
 * @author JNPF开发平台组 YanYu
 * @version v3.4.8
 * @copyrignt 引迈信息技术有限公司
 * @date 2023-04-21
 */
@Data
public class PortalCustomPrimary extends MyBatisPrimaryBase<PortalDataEntity> {
 
    /**
     * 平台
     */
    private String platform = JnpfConst.WEB;
    /**
     * 门户ID
     */
    private String portalId;
    /**
     * 系统ID
     */
    private String systemId;
    /**
     * 用户ID
     */
    private String creatorId;
    /**
     * 类型(mod:模型、custom:自定义)
     */
    private String type = PortalConst.CUSTOM;
 
    public PortalCustomPrimary(String platform, String portalId, String systemId, String userId) {
        if (platform != null) this.platform = platform;
        this.portalId = portalId;
        this.systemId = systemId;
        this.creatorId = userId;
    }
 
    public PortalCustomPrimary(String platform, String portalId) {
        if (platform != null) this.platform = platform;
        this.portalId = portalId;
        UserInfo userInfo = SpringContext.getBean(UserProvider.class).get();
        this.systemId = Objects.equals(platform, JnpfConst.WEB) ? userInfo.getSystemId() : userInfo.getAppSystemId();
        this.creatorId = userInfo.getUserId();
    }
 
    public QueryWrapper<PortalDataEntity> getQuery() {
        queryWrapper.lambda().eq(PortalDataEntity::getType, type);
        if (this.platform != null) queryWrapper.lambda().eq(PortalDataEntity::getPlatform, platform);
        if (this.portalId != null) queryWrapper.lambda().eq(PortalDataEntity::getPortalId, portalId);
//        if (this.systemId != null) queryWrapper.lambda().eq(PortalDataEntity::getSystemId, systemId);
        if(this.creatorId != null) queryWrapper.lambda().eq(PortalDataEntity::getCreatorUserId, creatorId);
        return queryWrapper;
    }
 
}