puzhibing
2023-02-15 2811bab657aab4145b65a45a824fb63e93b58e30
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
package com.stylefeng.guns.modular.system.controller.util;
 
import java.util.List;
 
import org.springframework.stereotype.Controller;
 
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.modular.system.model.User;
 
/**
 * 条件查询封装工具类
 */
@Controller
public class WrapperUtil extends BaseController {
    /**
     * 封装查询用户ID组
     */
    public static Wrapper getWrapperAndInUserId(List<User> 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("userId", ids);
    }
 
}