import java.util.List;
/**
* @author liangxinyu
* @date 2024/1/2 2:54 PM
*/
@RequestMapping(value = "/test")
@RestController
@AllArgsConstructor
public class TestController {
@Autowired
private gMapper sisMapper;
@PostMapping(value = "/test1")
public Object test(@RequestBody List<String> countryIds){
QueryWrapper<TmsProWaveConfigPO> queryWrapper = new QueryWrapper<>();
for (String countryId: countryIds) {
queryWrapper.like("country_ids", countryId).or();
}
return wavePrognosisMapper.selectList(queryWrapper);
}
@PostMapping(value = "/test2")
public Object test2(@RequestBody List<String> countryIds){
QueryWrapper<gPO> queryWrapper = new QueryWrapper<>();
int size = countryIds.size() - 1;
int incr = 0;
for (String countryId: countryIds) {
queryWrapper.apply("json_contains(country_ids,'" + countryId + "')");
if(incr < size) {
queryWrapper.or();
}
incr++;
}
return apper.selectList(queryWrapper);
}
}
json_contain用法,模糊查询或青雀查询
最新推荐文章于 2024-02-23 14:35:49 发布