1
This commit is contained in:
@@ -0,0 +1,59 @@
|
|||||||
|
package org.nl.sso;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.nl.AppRun;
|
||||||
|
import org.nl.system.service.dict.ISysDictService;
|
||||||
|
import org.nl.system.service.dict.dao.Dict;
|
||||||
|
import org.nl.system.service.dict.dao.mapper.SysDictMapper;
|
||||||
|
import org.nl.system.service.role.dao.SysRole;
|
||||||
|
import org.nl.system.service.role.dao.mapper.SysRoleMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: lyd
|
||||||
|
* @Description:
|
||||||
|
* @Date: 2022/12/14
|
||||||
|
*/
|
||||||
|
@SpringBootTest(classes = AppRun.class)
|
||||||
|
public class DictTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
SysDictMapper sysDictMapper;
|
||||||
|
@Autowired
|
||||||
|
SysRoleMapper sysRoleMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ISysDictService ISysDictService;
|
||||||
|
@Test
|
||||||
|
void QueryTest() {
|
||||||
|
String blurry = null;
|
||||||
|
// QueryWrapper<Dict> queryWrapper = new QueryWrapper<>();
|
||||||
|
// if (ObjectUtil.isNotEmpty(blurry)) {
|
||||||
|
// queryWrapper.like("code", blurry)
|
||||||
|
// .or()
|
||||||
|
// .like("name", blurry);
|
||||||
|
// }
|
||||||
|
// queryWrapper.orderBy(true, true, "code");
|
||||||
|
// Page<Dict> dictPage = new Page<>(0, 3);
|
||||||
|
// IPage<Dict> dictIPage = dictMapper.selectPage(dictPage, queryWrapper);
|
||||||
|
LambdaQueryWrapper<Dict> lam = new LambdaQueryWrapper<>();
|
||||||
|
lam.like(ObjectUtil.isNotEmpty(blurry), Dict::getCode, blurry)
|
||||||
|
.or(ObjectUtil.isNotEmpty(blurry))
|
||||||
|
.like(ObjectUtil.isNotEmpty(blurry), Dict::getName, blurry);
|
||||||
|
IPage<Dict> pages = new Page<>(0, 3);
|
||||||
|
sysDictMapper.selectPage(pages, lam);
|
||||||
|
pages.getRecords().forEach(System.out::println);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void show() {
|
||||||
|
sysRoleMapper.list().forEach(sysRole -> System.out.println(sysRole));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user