零件修改查询

liweidong
liweidong-hj 3 days ago
parent da1101c8aa
commit f51db84ffc
  1. 48
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/mapper/PartMapper.xml
  2. 1
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/service/impl/DsPartServiceImpl.java
  3. 6
      blade-service/blade-desk/src/main/resources/application-dev.yml

@ -153,16 +153,42 @@
ROW_NUMBER() OVER (PARTITION BY p.PART_CODE ORDER BY v.PART_VERSION DESC) AS rn
FROM DS_PART p
LEFT JOIN DS_PART_VERSION v ON p.ID = v.PART_ID AND v.IS_DELETED = 0
WHERE NOT EXISTS (
SELECT 1
FROM DS_PART_RELATION r
WHERE r.CHILD_PART_ID = p.ID
AND r.IS_DELETED = 0
)
AND p.IS_DELETED = 0
WHERE p.IS_DELETED = 0
<!-- 动态判断是否查询子件 -->
<choose>
<!-- 当零件号或零件名称不为空时,支持查询子件 -->
<when test="(dsPart.partCode != null and dsPart.partCode != '') or (dsPart.partName != null and dsPart.partName != '')">
AND (
<!-- 原部件查询条件 -->
NOT EXISTS (
SELECT 1
FROM DS_PART_RELATION r
WHERE r.CHILD_PART_ID = p.ID
AND r.IS_DELETED = 0
)
OR
EXISTS (
SELECT 1
FROM DS_PART_RELATION r
WHERE r.CHILD_PART_ID = p.ID
AND r.IS_DELETED = 0
)
)
</when>
<!-- 只查询部件 -->
<otherwise>
AND NOT EXISTS (
SELECT 1
FROM DS_PART_RELATION r
WHERE r.CHILD_PART_ID = p.ID
AND r.IS_DELETED = 0
)
</otherwise>
</choose>
<if test="dsPart.plate != null and dsPart.plate != ''">
AND p.PLATE LIKE '%' || #{dsPart.plate} || '%'
AND p.PLATE LIKE '%' || #{dsPart.plate} || '%'
</if>
<if test="dsPart.partCode != null and dsPart.partCode != ''">
AND p.PART_CODE LIKE '%' || #{dsPart.partCode} || '%'
@ -174,7 +200,7 @@
AND p.SIN_TER_TYPE = #{dsPart.sinTerType}
</if>
<if test="dsPart.material != null and dsPart.material != ''">
AND p.MATERIAL LIKE '%' || #{dsPart.material} || '%'
AND p.MATERIAL LIKE '%' || #{dsPart.material} || '%'
</if>
<if test="dsPart.powderWeight != null">
AND p.POWDER_WEIGHT = #{dsPart.powderWeight}
@ -183,10 +209,10 @@
AND p.FORMING_THICKNESS = #{dsPart.formingThickness}
</if>
<if test="dsPart.productType != null">
AND p.PRODUCT_TYPE LIKE '%' || #{dsPart.productType} || '%'
AND p.PRODUCT_TYPE LIKE '%' || #{dsPart.productType} || '%'
</if>
<if test="dsPart.hardness != null">
AND p.HARDNESS LIKE '%' || #{dsPart.hardness} || '%'
AND p.HARDNESS LIKE '%' || #{dsPart.hardness} || '%'
</if>
<if test="dsPart.startDate != null and dsPart.endDate != null">
AND p.NEXT_DUE BETWEEN TO_DATE(#{dsPart.startDate}, 'YYYY-MM-DD')

@ -146,7 +146,6 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit
partIds = craftList.stream().map(DsCraftEntity::getPartId).collect(Collectors.toList());
}
}
}
}
if (null != partIds) {

@ -71,6 +71,6 @@ request:
logging:
config: classpath:logback.xml
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#mybatis-plus:
# configuration:
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
Loading…
Cancel
Save