Explorar el Código

添加关键字搜索

gushoubang hace 1 mes
padre
commit
7b068b0784

+ 4 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/ProjectFilterVo.java

@@ -9,6 +9,10 @@ import lombok.Data;
 public class ProjectFilterVo {
     private String name;
     private String code;
+    /**
+     * 关键词:模糊匹配 name、company
+     */
+    private String keyWord;
     /**
      * 项目类型:0-查询全部数据,其他值-按具体类型过滤
      */

+ 38 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/ProjectMapper.xml

@@ -37,6 +37,12 @@
             <if test="code != null and code != ''">
                 AND code LIKE CONCAT('%', #{code}, '%')
             </if>
+            <if test="keyWord != null and keyWord != ''">
+                AND (
+                    name    LIKE CONCAT('%', #{keyWord}, '%')
+                    OR company LIKE CONCAT('%', #{keyWord}, '%')
+                )
+            </if>
             <if test="projectType != null and projectType != 0">
                 AND project_type = #{projectType}
             </if>
@@ -54,6 +60,12 @@
             <if test="code != null and code != ''">
                 AND code LIKE CONCAT('%', #{code}, '%')
             </if>
+            <if test="keyWord != null and keyWord != ''">
+                AND (
+                    name    LIKE CONCAT('%', #{keyWord}, '%')
+                    OR company LIKE CONCAT('%', #{keyWord}, '%')
+                )
+            </if>
             <if test="projectType != null and projectType != 0">
                 AND project_type = #{projectType}
             </if>
@@ -92,4 +104,30 @@
             COUNT(*) AS total
         FROM t_project
     </select>
+
+    <select id="selectOtherSupply" resultType="com.siwei.apply.domain.res.ProjectSupplyRes">
+        SELECT
+            '其他' AS gdType,
+            '亩'   AS gdUnit,
+            CAST(0 AS double precision) AS gdArea,
+            CAST(0 AS int)              AS count
+    </select>
+
+    <select id="selectOtherSupplyExcludeProject" resultType="com.siwei.apply.domain.res.ProjectSupplyRes">
+        SELECT
+            '其他' AS gdType,
+            '亩'   AS gdUnit,
+            COALESCE(
+                SUM(
+                    CASE
+                        WHEN gd_unit = '0' THEN COALESCE(gd_area, 0) / 666.6666667
+                        WHEN gd_unit = '1' THEN COALESCE(gd_area, 0) * 15
+                        ELSE COALESCE(gd_area, 0)
+                    END
+                ), 0
+            ) AS gdArea,
+            COUNT(*) AS count
+        FROM t_tdgy
+        WHERE project_id IS NULL OR project_id = ''
+    </select>
 </mapper>