Implementing IN statements using JooqTemplate

작성자

카테고리:

← 피드로
DEV Community · ts5432 · 2026-08-20 개발(SW)

ts5432

@Service
public class SimpleUserService {
    @Autowired
    private JooqTemplate jt;
    public List<user> selectUserInDept(UserParam param) {
        //If deptIDs==null or deptIDs. isEmpty automatically ignores this query condition
        // SELECT * FROM user_table WHERE name LIKE '%?%' AND dept_id IN (?,?...);
        return jt.queryv("user_table",User.class,"name%",param.getName(),"dept_id:in",param.getDeptIds());
    }
    public List<user> selectUserNotInDept(UserParam param) {
        // SELECT * FROM user_table WHERE name LIKE '%?%' AND dept_id NOT IN (?,?...);
        return jt.queryv("user_table",User.class,"name%",param.getName(),"dept_id:notin",param.getDeptIds());
    }
}

Enter fullscreen mode Exit fullscreen mode

원문에서 계속 ↗