Browse Source

Merge remote-tracking branch 'origin/dev' into dev

rainco 7 years ago
parent
commit
ad4f3b0220

+ 39 - 34
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/dto/ListReqDTO.java

@@ -35,44 +35,49 @@ public class ListReqDTO implements Serializable {
     }
 
     public String getFinalCondition() {
-        JSONArray jsonArray = JSONArray.parseArray(this.condition);
-        if (null != jsonArray && jsonArray.size() > 0) {
-            StringBuffer finalCondition = new StringBuffer();
-            for (int i = 0; i < jsonArray.size(); i++) {
-                String con = null;
-                JSONObject jsonObject = (JSONObject)jsonArray.get(i);
-                Object type = jsonObject.get("type");
-                Object field = jsonObject.get("field");
-                Object operation = jsonObject.get("operation");
-                Object value = jsonObject.get("value");
-                //包含状态时,前台会自动加单引号
-                if (null != value && !"in".equals(operation) && !"not in".equals(operation)) {
-                    value = value.toString().replaceAll("'", "''");
-                }
-                if ("between".equals(operation)) {
-                    String[] vals = value.toString().split(",");
-                    con = " " + field + " " + operation + " '" + vals[0] + "' and '" + vals[1] + "' and";
-                } else if ("startsWith".equals(operation)) {
-                    con = " " + field + "  like '" + value +"%' and";
-                } else if ("endsWith".equals(operation)) {
-                    con = " " + field + " like '%" + value + "' and";
-                } else if ("in".equals(operation) || "not in".equals(operation)) {
-                    con = " " + field + " " + operation + " (" + value + ") and";
-                } else {
-                    //字符串默认是模糊查询
-                    if ("string".equals(type)) {
-                        con = " " + field + " like '%" + value + "%' and";
-                    } else if ("condition".equals(type)) {
-                        //type为condition为前端拼的条件
-                        con = " " + value + " and";
-                    }  else {
-                        con = " " + field + " " + operation + " '" + value + "' and";
+        try {
+            JSONArray jsonArray = JSONArray.parseArray(this.condition);
+            if (null != jsonArray && jsonArray.size() > 0) {
+                StringBuffer finalCondition = new StringBuffer();
+                for (int i = 0; i < jsonArray.size(); i++) {
+                    String con = null;
+                    JSONObject jsonObject = (JSONObject) jsonArray.get(i);
+                    Object type = jsonObject.get("type");
+                    Object field = jsonObject.get("field");
+                    Object operation = jsonObject.get("operation");
+                    Object value = jsonObject.get("value");
+                    //包含状态时,前台会自动加单引号
+                    if (null != value && !"in".equals(operation) && !"not in".equals(operation) &&
+                            !"condition".equals(type)) {
+                        value = value.toString().replaceAll("'", "''");
                     }
+                    if ("between".equals(operation)) {
+                        String[] vals = value.toString().split(",");
+                        con = " " + field + " " + operation + " '" + vals[0] + "' and '" + vals[1] + "' and";
+                    } else if ("startsWith".equals(operation)) {
+                        con = " " + field + "  like '" + value + "%' and";
+                    } else if ("endsWith".equals(operation)) {
+                        con = " " + field + " like '%" + value + "' and";
+                    } else if ("in".equals(operation) || "not in".equals(operation)) {
+                        con = " " + field + " " + operation + " (" + value + ") and";
+                    } else {
+                        //字符串默认是模糊查询
+                        if ("string".equals(type)) {
+                            con = " " + field + " like '%" + value + "%' and";
+                        } else if ("condition".equals(type)) {
+                            //type为condition为前端拼的条件
+                            con = " " + value + " and";
+                        } else {
+                            con = " " + field + " " + operation + " '" + value + "' and";
+                        }
 
+                    }
+                    finalCondition = finalCondition.append(con);
                 }
-                finalCondition = finalCondition.append(con);
+                return finalCondition.substring(0, finalCondition.length() - 3);
             }
-            return finalCondition.substring(0, finalCondition.length() - 3);
+        }catch (Exception e){
+            return null;
         }
         return null;
     }

+ 29 - 0
applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/VendorListDTO.java

@@ -0,0 +1,29 @@
+package com.usoftchina.saas.document.dto;
+
+import com.usoftchina.saas.document.entities.Vendor;
+import com.usoftchina.saas.document.entities.Vendorcontact;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class VendorListDTO implements Serializable {
+
+    private Vendor main;
+    private List<Vendorcontact> items;
+
+    public Vendor getMain() {
+        return main;
+    }
+
+    public void setMain(Vendor main) {
+        this.main = main;
+    }
+
+    public List<Vendorcontact> getItems() {
+        return items;
+    }
+
+    public void setItems(List<Vendorcontact> items) {
+        this.items = items;
+    }
+}

+ 8 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/VendorController.java

@@ -6,6 +6,7 @@ import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.commons.dto.DocReqDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.document.dto.VendorDTO;
+import com.usoftchina.saas.document.dto.VendorListDTO;
 import com.usoftchina.saas.document.service.VendorService;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,4 +26,11 @@ public class VendorController {
         PageInfo<VendorDTO> vendorList = vendorService.getVendorsByCondition(page, listReqDTO);
         return Result.success(vendorList);
     }
+
+    @GetMapping("/getListById/{id}")
+    public Result<VendorListDTO> getDataById(@PathVariable("id") Long id){
+//        List<> vendorService.getListById(id);
+        return null;
+    }
+
 }

+ 1 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorMapper.java

@@ -3,10 +3,9 @@ package com.usoftchina.saas.document.mapper;
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 
 
-import com.usoftchina.saas.commons.dto.DocReqDTO;
 import com.usoftchina.saas.document.dto.VendorDTO;
 import com.usoftchina.saas.document.entities.Vendor;
-import feign.Param;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 

+ 1 - 1
applications/document/document-server/src/main/resources/mapper/VendorMapper.xml

@@ -37,7 +37,7 @@
         <result column="ve_status" property="ve_status" jdbcType="VARCHAR" />
     </resultMap>
 
-    <select id="getVendorsByCondition" resultMap="VendorDTOResultMapper" parameterType="com.usoftchina.saas.commons.dto.DocReqDTO">
+    <select id="getVendorsByCondition" resultMap="VendorDTOResultMapper">
         SELECT * FROM VENDOR
         <where>
             <if test="condition!=null">