diff --git a/src/main/java/com/ifish/daoImpl/UserDaoImpl.java b/src/main/java/com/ifish/daoImpl/UserDaoImpl.java index 5d48fde..4229ad5 100644 --- a/src/main/java/com/ifish/daoImpl/UserDaoImpl.java +++ b/src/main/java/com/ifish/daoImpl/UserDaoImpl.java @@ -46,25 +46,25 @@ public class UserDaoImpl extends HibernateBaseDao implements User public List getUserIds(String pushType,Integer firstResult, int maxResults) { //商家用户 if(PushTypeEnum.all_shops_push.getKey().equals(pushType)){ - String sql = "select user.user_id from tbl_user user,tbl_aliyun_device_info device where user_type=? and user.user_id = device.user_id and is_register_netease=? limit ?,?"; + String sql = "select DISTINCT user.user_id from tbl_user user,tbl_aliyun_device_info device where user_type=? and user.user_id = device.user_id and is_register_netease=? limit ?,?"; List list = this.getSession().createSQLQuery(sql).setString(0, UserTypeEnum.userType1.getKey()).setString(1, BooleanEnum.YES.getKey()).setInteger(2, firstResult).setInteger(3,maxResults).list(); return list; } //安卓用户 else if(PushTypeEnum.all_android_push.getKey().equals(pushType)){ - String sql = "select user.user_id from tbl_user user,tbl_aliyun_device_info device where login_type=? and user.user_id = device.user_id and is_register_netease=? limit ?,?"; - List list = this.getSession().createSQLQuery(sql).setString(0, PhoneTypeEnum.android.getKey()).setString(1, BooleanEnum.YES.getKey()).setInteger(2, firstResult).setInteger(3,maxResults).list(); + String sql = "select DISTINCT user.user_id from tbl_user user,tbl_aliyun_device_info device where user.user_id = device.user_id and is_register_netease=? limit ?,?"; + List list = this.getSession().createSQLQuery(sql).setString(0, BooleanEnum.YES.getKey()).setInteger(1, firstResult).setInteger(2,maxResults).list(); return list; } //IOS用户 else if(PushTypeEnum.all_ios_push.getKey().equals(pushType)){ - String sql = "select user.user_id from tbl_user user,tbl_aliyun_device_info device where login_type=? and user.user_id = device.user_id and is_register_netease=? limit ?,?"; - List list = this.getSession().createSQLQuery(sql).setString(0, PhoneTypeEnum.ios.getKey()).setString(1, BooleanEnum.YES.getKey()).setInteger(2, firstResult).setInteger(3,maxResults).list(); + String sql = "select DISTINCT user.user_id from tbl_user user,tbl_aliyun_device_info device where user.user_id = device.user_id and is_register_netease=? limit ?,?"; + List list = this.getSession().createSQLQuery(sql).setString(0, BooleanEnum.YES.getKey()).setInteger(1, firstResult).setInteger(2,maxResults).list(); return list; } //所有用户 else if(PushTypeEnum.all_push.getKey().equals(pushType)){ - String sql = "select user.user_id from tbl_user user,tbl_aliyun_device_info device where is_register_netease=? and user.user_id = device.user_id limit ?,?"; + String sql = "select DISTINCT user.user_id from tbl_user user,tbl_aliyun_device_info device where is_register_netease=? and user.user_id = device.user_id limit ?,?"; List list = this.getSession().createSQLQuery(sql).setString(0, BooleanEnum.YES.getKey()).setInteger(1, firstResult).setInteger(2,maxResults).list(); return list; } diff --git a/src/main/resources/mq.properties b/src/main/resources/mq.properties index 77df9ed..5eb164d 100644 --- a/src/main/resources/mq.properties +++ b/src/main/resources/mq.properties @@ -1,4 +1,5 @@ broker_url=tcp://localhost:61616 +#broker_url=tcp://test.ifish7.com:61616 username=admin #password=admin password=adminifish7