@@ -43,42 +43,45 @@ public class UserStatisticsDaoImpl extends GenericDaoBase<UserStatisticsVO, Long
4343 "FROM user_statistics us, account a " +
4444 "WHERE us.account_id = a.id AND (a.removed IS NULL OR a.removed >= ?) " +
4545 "ORDER BY us.id" ;
46- private final SearchBuilder <UserStatisticsVO > AccountDcIpDeviceSearch ;
46+ private final SearchBuilder <UserStatisticsVO > AllFieldsSearch ;
4747 private final SearchBuilder <UserStatisticsVO > AccountSearch ;
4848
4949 public UserStatisticsDaoImpl () {
5050 AccountSearch = createSearchBuilder ();
5151 AccountSearch .and ("account" , AccountSearch .entity ().getAccountId (), SearchCriteria .Op .EQ );
5252 AccountSearch .done ();
5353
54- AccountDcIpDeviceSearch = createSearchBuilder ();
55- AccountDcIpDeviceSearch .and ("account" , AccountDcIpDeviceSearch .entity ().getAccountId (), SearchCriteria .Op .EQ );
56- AccountDcIpDeviceSearch .and ("dc" , AccountDcIpDeviceSearch .entity ().getDataCenterId (), SearchCriteria .Op .EQ );
57- AccountDcIpDeviceSearch .and ("ip" , AccountDcIpDeviceSearch .entity ().getPublicIpAddress (), SearchCriteria .Op .EQ );
58- AccountDcIpDeviceSearch .and ("device" , AccountDcIpDeviceSearch .entity ().getDeviceId (), SearchCriteria .Op .EQ );
59- AccountDcIpDeviceSearch .and ("deviceType" , AccountDcIpDeviceSearch .entity ().getDeviceType (), SearchCriteria .Op .EQ );
60- AccountDcIpDeviceSearch .done ();
54+ AllFieldsSearch = createSearchBuilder ();
55+ AllFieldsSearch .and ("account" , AllFieldsSearch .entity ().getAccountId (), SearchCriteria .Op .EQ );
56+ AllFieldsSearch .and ("dc" , AllFieldsSearch .entity ().getDataCenterId (), SearchCriteria .Op .EQ );
57+ AllFieldsSearch .and ("network" , AllFieldsSearch .entity ().getNetworkId (), SearchCriteria .Op .EQ );
58+ AllFieldsSearch .and ("ip" , AllFieldsSearch .entity ().getPublicIpAddress (), SearchCriteria .Op .EQ );
59+ AllFieldsSearch .and ("device" , AllFieldsSearch .entity ().getDeviceId (), SearchCriteria .Op .EQ );
60+ AllFieldsSearch .and ("deviceType" , AllFieldsSearch .entity ().getDeviceType (), SearchCriteria .Op .EQ );
61+ AllFieldsSearch .done ();
6162 }
6263
6364 @ Override
64- public UserStatisticsVO findBy (long accountId , long dcId , String publicIp , Long deviceId , String deviceType ) {
65- SearchCriteria <UserStatisticsVO > sc = AccountDcIpDeviceSearch .create ();
65+ public UserStatisticsVO findBy (long accountId , long dcId , long networkId , String publicIp , Long deviceId , String deviceType ) {
66+ SearchCriteria <UserStatisticsVO > sc = AllFieldsSearch .create ();
6667 sc .setParameters ("account" , accountId );
6768 sc .setParameters ("dc" , dcId );
69+ sc .setParameters ("network" , networkId );
6870 sc .setParameters ("ip" , publicIp );
6971 sc .setParameters ("device" , deviceId );
70- sc .setParameters ("deviceType" , deviceType );
72+ sc .setParameters ("deviceType" , deviceType );
7173 return findOneBy (sc );
7274 }
7375
7476 @ Override
75- public UserStatisticsVO lock (long accountId , long dcId , String publicIp , Long deviceId , String deviceType ) {
76- SearchCriteria <UserStatisticsVO > sc = AccountDcIpDeviceSearch .create ();
77+ public UserStatisticsVO lock (long accountId , long dcId , long networkId , String publicIp , Long deviceId , String deviceType ) {
78+ SearchCriteria <UserStatisticsVO > sc = AllFieldsSearch .create ();
7779 sc .setParameters ("account" , accountId );
7880 sc .setParameters ("dc" , dcId );
81+ sc .setParameters ("network" , networkId );
7982 sc .setParameters ("ip" , publicIp );
8083 sc .setParameters ("device" , deviceId );
81- sc .setParameters ("deviceType" , deviceType );
84+ sc .setParameters ("deviceType" , deviceType );
8285 return lockOneRandomRow (sc , true );
8386 }
8487
0 commit comments