mitao
2024-04-30 ab4ea7b8f10c9b66aed9c2ea161a08b25c3851a7
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
package com.sinata.modular.system.controller.util;
 
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.sinata.core.base.controller.BaseController;
import com.sinata.modular.member.model.MemUser;
import org.springframework.stereotype.Controller;
 
import java.util.List;
 
/**
 * 条件查询封装工具类
 */
@Controller
public class WrapperUtil extends BaseController {
    /**
     * 封装查询用户ID组
     */
    public static Wrapper getWrapperAndInUserId(List<MemUser> list, Wrapper wrapper) {
        Integer[] ids = new Integer[]{0};
        if (ids != null && list.size() > 0) {
            ids = new Integer[list.size()];
            for (int i = 0; i < list.size(); i++) {
                ids[i] = list.get(i).getId();
            }
        }
        return wrapper.and().in("user_id", ids);
    }
 
}