@Test
void getTestSql() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/user/search")
.param("query","name$=$测试人员")
.param("sort","name$asc")).andReturn();
System.out.println(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8));
}
@Test
void getTestSimple() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/user/search")
.param("query","name$=$测试人员")).andReturn();
System.out.println(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8));
}
@Test
void getTestMoreTable() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/user/search")
.param("query","role.id$=$'111'")).andReturn();
System.out.println(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8));
}
@Test
void getTestManyConditionsAnd() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/user/search")
.param("query","name$=$测试人员,role.id$=$'111',+")).andReturn();
System.out.println(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8));
}
@Test
void getTestManyConditionsOr() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/user/search")
.param("query","name$=$测试人员,role.id$=$'111',-")).andReturn();
System.out.println(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8));
}
例如: (id='123222' and (name='xasd' or phone='123456' )) or (name='123' and phone='2222') 语句则:id$=$'123222',name$=$'xasd',phone$=$'123456',-,+,name$=$'123',phone$=$'2222',+,-
@Test
void getTestManyConditionsAndOr() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/user/search")
.param("query","name$=$测试人员,role.id$=$'111',-,name$=$测试人员,role.id$=$'111',-,+")).andReturn();
System.out.println(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8));
}
@Test
void getTestSort() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/user/search")
.param("sort","name$asc,role.name$desc")).andReturn();
System.out.println(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8));
}