姜永辉 1 год назад
Родитель
Сommit
fbcd446e0f

+ 15 - 0
src/main/java/com/dk/mdm/mapper/ivt/InventoryMapper.xml

@@ -98,6 +98,15 @@
             <if test="freezeQty != null">
                 AND tpi.freeze_qty = #{freezeQty}
             </if>
+            <if test="categoryId != null and categoryId != ''">
+                AND tmgs.category_id = #{categoryId}::UUID
+            </if>
+            <if  test="searchText != null">
+                AND (tmgs.sku_code  like concat('%', my_ex.likequery(#{searchText}) , '%')
+                OR  tmgs.sku_name like concat('%', my_ex.likequery(#{searchText}) , '%')
+                OR  tpi.non_std_code like concat('%', my_ex.likequery(#{searchText}) , '%')
+                )
+            </if>
         </where>
     </sql>
 
@@ -127,6 +136,12 @@
         FROM dkic_b.t_psi_inventory tpi
         <include refid="Join_Table"/>
         <include refid="Condition"/>
+        <if test="desc != null and desc != ''">
+            order by tpi.usable_qty desc
+        </if>
+        <if test="desc == null or desc == ''">
+            order by tpi.usable_qty
+        </if>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
         </if>

+ 4 - 0
src/main/java/com/dk/mdm/model/query/ivt/InventoryQuery.java

@@ -116,7 +116,11 @@ public class InventoryQuery extends PageInfo<InventoryQuery>{
     @ApiModelProperty(value = "冻结数量")
     private BigDecimal freezeQty;
 
+    @ApiModelProperty(value = "模糊查询")
+    private String searchText;
 
+    @ApiModelProperty(value = "排序")
+    private String desc;
     /*
      * 相关属性
      * @TableField(exist = false)