Change active packeges selecting
This commit is contained in:
parent
82a028c664
commit
887c2ff06e
4 changed files with 9 additions and 5 deletions
|
|
@ -24,7 +24,7 @@ public interface UserPackageMapper {
|
|||
|
||||
UserPackage findPackage(@Param("id") Integer id);
|
||||
|
||||
List<UserPackage> findUserPackages(@Param("userId") String userId, @Param("status") String status);
|
||||
List<UserPackage> findUserPackages(@Param("userId") String userId, @Param("statuses") List<String> status);
|
||||
|
||||
List<UserPackage> findAllPackagesByStatus(@Param("status") String status);
|
||||
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ public class SignalService {
|
|||
}
|
||||
|
||||
public List<UserPackage> findActivePackages(String userId) {
|
||||
return userPackageService.findUserPackages(userId, Status.ON_MONITORING);
|
||||
return userPackageService.findUserPackages(userId, Status.ON_MONITORING, Status.PROCESSING);
|
||||
}
|
||||
|
||||
public boolean isPackageExists(String username, String packageName) {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import ru.nbch.credit_tracker.enums.Status;
|
|||
import ru.nbch.credit_tracker.mapper.signal.UserPackageMapper;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
|
|
@ -45,8 +46,8 @@ public class UserPackageService {
|
|||
return mapper.findPackage(id);
|
||||
}
|
||||
|
||||
public List<UserPackage> findUserPackages(String userId, Status status) {
|
||||
return mapper.findUserPackages(userId.substring(0, 6), status.name());
|
||||
public List<UserPackage> findUserPackages(String userId, Status... status) {
|
||||
return mapper.findUserPackages(userId.substring(0, 6), Arrays.stream(status).map(Enum::name).toList());
|
||||
}
|
||||
|
||||
public List<UserPackage> findAllPackagesByStatus(Status status) {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,10 @@
|
|||
FROM signals_user_packages
|
||||
WHERE membercode IS NOT NULL
|
||||
AND LEFT(membercode, 6) = #{userId}
|
||||
AND status = #{status}
|
||||
AND status IN
|
||||
<foreach item="status" collection="statuses" open="(" separator="," close=")">
|
||||
#{status}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="findAllPackagesByStatus" resultMap="packageDataResultMap"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue