想要的结果是 (HongKongOtherTrans or hongKongOtherLogistics ) and (enable)
第一种方法不行
List<Servicer> findByHongKongOtherTransOrHongKongOtherLogisticsAndEnableOrderByChooseOrder(Integer hongKongOtherTrans,Integer hongKongOtherLogistics,Integer enable);
结果:
select servicer0_.id as id1_13_, servicer0_.address as address2_13_, servicer0_.choose_order as choose_o3_13_, servicer0_.code as code4_13_, servicer0_.create_time as create_t5_13_, servicer0_.enable as enable6_13_, servicer0_.group_id as group_id7_13_, servicer0_.hong_kong_china_trans as hong_kon8_13_, servicer0_.hong_kong_delivery as hong_kon9_13_, servicer0_.hong_kong_other_logistics as hong_ko10_13_, servicer0_.hong_kong_other_trans as hong_ko11_13_, servicer0_.hong_kong_pick as hong_ko12_13_, servicer0_.international_trans as interna13_13_, servicer0_.lead_in_date as lead_in14_13_, servicer0_.name as name15_13_, servicer0_.remark as remark16_13_, servicer0_.supply_org_id as supply_17_13_ from servicer servicer0_
where servicer0_.hong_kong_other_trans=? or servicer0_.hong_kong_other_logistics=? and servicer0_.enable=? order by servicer0_.choose_order asc
暂时只能用第二种
@Query("select e from Servicer e where e.enable =:enable and (e.hongKongOtherTrans =:hongKongOtherTrans or e.hongKongOtherLogistics =:hongKongOtherLogistics)")
List<Servicer> findByHongKongOther(@Param("hongKongOtherTrans") Integer hongKongOtherTrans,@Param("hongKongOtherLogistics") Integer hongKongOtherLogistics,@Param("enable") Integer enable);
结果:
select servicer0_.id as id1_13_, servicer0_.address as address2_13_, servicer0_.choose_order as choose_o3_13_, servicer0_.code as code4_13_, servicer0_.create_time as create_t5_13_, servicer0_.enable as enable6_13_, servicer0_.group_id as group_id7_13_, servicer0_.hong_kong_china_trans as hong_kon8_13_, servicer0_.hong_kong_delivery as hong_kon9_13_, servicer0_.hong_kong_other_logistics as hong_ko10_13_, servicer0_.hong_kong_other_trans as hong_ko11_13_, servicer0_.hong_kong_pick as hong_ko12_13_, servicer0_.international_trans as interna13_13_, servicer0_.lead_in_date as lead_in14_13_, servicer0_.name as name15_13_, servicer0_.remark as remark16_13_, servicer0_.supply_org_id as supply_17_13_ from servicer servicer0_ where servicer0_.enable=? and (servicer0_.hong_kong_other_trans=? or servicer0_.hong_kong_other_logistics=?)