querywapper.eq_PowerQUERy合并查询模糊匹配

(62) 2024-08-07 23:01:03

querywapper.eq_PowerQUERy合并查询模糊匹配 (https://mushiming.com/)  第1张

public ResponseResult bind(DriverCarBindingRelationship driverCarBindingRelationship){ /* * 判断:在绑定司机和车辆关系之前,先判断一下二者之间是否已经绑定,如果已经绑定过,则不容许再绑定 * */ QueryWrapper<DriverCarBindingRelationship> queryWrapper = new QueryWrapper<>(); //查询包装器 //多种条件情况下进行查询,以下三种情况必须满足 queryWrapper.eq("driver_id",driverCarBindingRelationship.getDriverId()); queryWrapper.eq("car_id",driverCarBindingRelationship.getCarId()); queryWrapper.eq("bind_state",DriverCarConstants.DRIVER_CAR_BIND); Integer integer = driverCarBindingRelationshipMapper.selectCount(queryWrapper); if(integer.intValue()>0){ return ResponseResult.fail(CommonStatusEnum.DRIVER_CAR_BIND_EXIST.getCode(),CommonStatusEnum.DRIVER_CAR_BIND_EXIST.getValue()); } } 

底层运行结果:

Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@] was not registered for synchronization because synchronization is not active
JDBC Connection [HikariProxyConnection@ wrapping com.mysql.cj.jdbc.ConnectionImpl@4e911e70] will not be managed by Spring
> Preparing: SELECT COUNT( * ) FROM driver_car_binding_relationship WHERE (driver_id = ? AND car_id = ? AND bind_state = ?)
> Parameters: 53(Long), 6(Long), 1(Integer)
<
Columns: COUNT( * )
<
Row: 0
<== Total: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@]

THE END

发表回复