TSK-1618: fixed count of tasks for query with object references filter
This commit is contained in:
parent
8a7b4f500d
commit
c96117afb6
|
@ -538,6 +538,14 @@ public interface TaskQueryMapper {
|
|||
+ "<if test='ownerLike != null'>AND (<foreach item='item' collection='ownerLike' separator=' OR '>UPPER(t.OWNER) LIKE #{item}</foreach>)</if> "
|
||||
+ "<if test='isRead != null'>AND t.IS_READ = #{isRead}</if> "
|
||||
+ "<if test='isTransferred != null'>AND t.IS_TRANSFERRED = #{isTransferred}</if> "
|
||||
+ "<if test='objectReferences != null'>"
|
||||
+ "AND (<foreach item='item' collection='objectReferences' separator=' OR '> "
|
||||
+ "<if test='item.company != null'>t.POR_COMPANY = #{item.company} </if>"
|
||||
+ "<if test='item.system != null'> <if test='item.company != null'>AND</if> t.POR_SYSTEM = #{item.system} </if>"
|
||||
+ "<if test='item.systemInstance != null'> <if test='item.company != null or item.system != null'>AND</if> t.POR_INSTANCE = #{item.systemInstance} </if>"
|
||||
+ "<if test='item.type != null'> <if test='item.company != null or item.system != null or item.systemInstance != null'>AND</if> t.POR_TYPE = #{item.type} </if>"
|
||||
+ "<if test='item.value != null'> <if test='item.company != null or item.system != null or item.systemInstance != null or item.type != null'>AND</if> t.POR_VALUE = #{item.value} </if>"
|
||||
+ "</foreach>)</if>"
|
||||
+ "<if test='porCompanyIn != null'>AND t.POR_COMPANY IN(<foreach item='item' collection='porCompanyIn' separator=',' >#{item}</foreach>)</if> "
|
||||
+ "<if test='porCompanyLike != null'>AND (<foreach item='item' collection='porCompanyLike' separator=' OR '>UPPER(t.POR_COMPANY) LIKE #{item}</foreach>)</if> "
|
||||
+ "<if test='porSystemIn != null'>AND t.POR_SYSTEM IN(<foreach item='item' collection='porSystemIn' separator=',' >#{item}</foreach>)</if> "
|
||||
|
@ -645,6 +653,14 @@ public interface TaskQueryMapper {
|
|||
+ "<if test='ownerLike != null'>AND (<foreach item='item' collection='ownerLike' separator=' OR '>UPPER(t.OWNER) LIKE #{item}</foreach>)</if> "
|
||||
+ "<if test='isRead != null'>AND t.IS_READ = #{isRead}</if> "
|
||||
+ "<if test='isTransferred != null'>AND t.IS_TRANSFERRED = #{isTransferred}</if> "
|
||||
+ "<if test='objectReferences != null'>"
|
||||
+ "AND (<foreach item='item' collection='objectReferences' separator=' OR '> "
|
||||
+ "<if test='item.company != null'>t.POR_COMPANY = #{item.company} </if>"
|
||||
+ "<if test='item.system != null'> <if test='item.company != null'>AND</if> t.POR_SYSTEM = #{item.system} </if>"
|
||||
+ "<if test='item.systemInstance != null'> <if test='item.company != null or item.system != null'>AND</if> t.POR_INSTANCE = #{item.systemInstance} </if>"
|
||||
+ "<if test='item.type != null'> <if test='item.company != null or item.system != null or item.systemInstance != null'>AND</if> t.POR_TYPE = #{item.type} </if>"
|
||||
+ "<if test='item.value != null'> <if test='item.company != null or item.system != null or item.systemInstance != null or item.type != null'>AND</if> t.POR_VALUE = #{item.value} </if>"
|
||||
+ "</foreach>)</if>"
|
||||
+ "<if test='porCompanyIn != null'>AND t.POR_COMPANY IN(<foreach item='item' collection='porCompanyIn' separator=',' >#{item}</foreach>)</if> "
|
||||
+ "<if test='porCompanyLike != null'>AND (<foreach item='item' collection='porCompanyLike' separator=' OR '>UPPER(t.POR_COMPANY) LIKE #{item}</foreach>)</if> "
|
||||
+ "<if test='porSystemIn != null'>AND t.POR_SYSTEM IN(<foreach item='item' collection='porSystemIn' separator=',' >#{item}</foreach>)</if> "
|
||||
|
|
|
@ -108,7 +108,21 @@ class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
|
|||
|
||||
@WithAccessId(user = "admin")
|
||||
@Test
|
||||
void testQueryTasksByExcactValueAndTypeOfObjectReference() {
|
||||
void should_CountWithObjectReferencesFilter_When_MultipleFieldsAreSet() {
|
||||
ObjectReference objectReference = new ObjectReference();
|
||||
objectReference.setCompany("00");
|
||||
objectReference.setSystem("PASyste2");
|
||||
objectReference.setSystemInstance("00");
|
||||
objectReference.setType("VNR");
|
||||
objectReference.setValue("67890123");
|
||||
long count =
|
||||
TASK_SERVICE.createTaskQuery().primaryObjectReferenceIn(objectReference).count();
|
||||
assertThat(count).isEqualTo(1);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "admin")
|
||||
@Test
|
||||
void testQueryTasksByExactValueAndTypeOfObjectReference() {
|
||||
List<TaskSummary> results =
|
||||
TASK_SERVICE
|
||||
.createTaskQuery()
|
||||
|
|
Loading…
Reference in New Issue