Browse Source

客户下拉

dxq 3 weeks ago
parent
commit
9311422d8f

+ 14
- 0
sto/src/main/java/com/shinsoft/sto/controller/main/CustomerController.java View File

@@ -89,4 +89,18 @@ public class CustomerController {
89 89
             return resultJSON;
90 90
         }
91 91
     }
92
+
93
+    @RequestMapping(value = "/querySelect")
94
+    public ResultJSON querySelect(HttpServletRequest request) {
95
+        try {
96
+//            String belongId = (String) request.getHeader("belongId");
97
+            String belongId=null;
98
+            resultJSON = customerService.querySelect(belongId);
99
+        } catch (Exception ex) {
100
+            ex.printStackTrace();
101
+            resultJSON = JSONTools.toResultJSON(ResponseCodeMsg.CODE_EX, ex);
102
+        } finally {
103
+            return resultJSON;
104
+        }
105
+    }
92 106
 }

+ 7
- 3
sto/src/main/java/com/shinsoft/sto/mapper/main/CustomerMapper.java View File

@@ -1,13 +1,17 @@
1 1
 package com.shinsoft.sto.mapper.main;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
-import com.shinsoft.sto.model.Config;
5 4
 import com.shinsoft.sto.model.common.selectModel;
6 5
 import com.shinsoft.sto.model.main.Customer;
6
+import org.apache.ibatis.annotations.Param;
7 7
 import org.apache.ibatis.annotations.Select;
8 8
 
9
+import java.util.List;
10
+
9 11
 public interface CustomerMapper extends BaseMapper<Customer> {
10 12
 
11
-    @Select("SELECT id as value,custtomerNm as label FROM STO_MAIN_CUSTOMER WHERE nvl(cancel_flag,0) = 0 and belong_id = #{belongId}")
12
-    selectModel selectModel(String belongId);
13
+    /**
14
+     * 查询客户下拉框数据
15
+     */
16
+    List<selectModel> selectCustomerOptions(@Param("belongId") String belongId);
13 17
 }

+ 10
- 0
sto/src/main/java/com/shinsoft/sto/mapper/main/CustomerMapper.xml View File

@@ -64,4 +64,14 @@
64 64
         and customer_name = #{customerName}
65 65
     </select>
66 66
 
67
+    <select id="selectCustomerOptions" resultType="com.shinsoft.sto.model.common.selectModel">
68
+        SELECT id as value, customer_nm as label
69
+        FROM T_MAIN_CUSTOMER WHERE nvl(cancel_flag,'0') = '0'
70
+        <if test="belongId!=null and belongId !=''">
71
+            AND belong_id = #{belongId}
72
+        </if>
73
+
74
+        ORDER BY add_time DESC
75
+    </select>
76
+
67 77
 </mapper>

+ 15
- 0
sto/src/main/java/com/shinsoft/sto/service/impl/main/CustomerServiceImp.java View File

@@ -7,9 +7,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
7 7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8 8
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9 9
 import com.shinsoft.sto.mapper.main.CustomerMapper;
10
+import com.shinsoft.sto.model.common.selectModel;
10 11
 import com.shinsoft.sto.model.main.Customer;
11 12
 import com.shinsoft.sto.service.main.CustomerService;
12 13
 import com.shinsoft.tools.JSONTools;
14
+import com.shinsoft.tools.model.common.ResponseCodeMsg;
13 15
 import com.shinsoft.tools.model.common.ResultJSON;
14 16
 import org.apache.commons.lang3.StringUtils;
15 17
 import org.springframework.beans.factory.annotation.Autowired;
@@ -118,4 +120,17 @@ public class CustomerServiceImp extends ServiceImpl<CustomerMapper, Customer> im
118 120
         resultJSON = JSONTools.toResultJSON("");
119 121
         return resultJSON;
120 122
     }
123
+
124
+    @Override
125
+    public ResultJSON querySelect(String belongId) {
126
+        try {
127
+            List<selectModel> list = customerMapper.selectCustomerOptions(belongId);
128
+            resultJSON = JSONTools.toResultJSON(list);
129
+            return resultJSON;
130
+        } catch (Exception ex) {
131
+            ex.printStackTrace();
132
+            resultJSON = JSONTools.toResultJSON(ResponseCodeMsg.CODE_EX, ex);
133
+            return resultJSON;
134
+        }
135
+    }
121 136
 }

+ 6
- 0
sto/src/main/java/com/shinsoft/sto/service/main/CustomerService.java View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.shinsoft.sto.model.main.Customer;
5 5
 import com.shinsoft.tools.model.common.ResultJSON;
6 6
 
7
+import java.util.List;
7 8
 import java.util.Map;
8 9
 
9 10
 /**
@@ -25,4 +26,9 @@ public interface CustomerService extends IService<Customer> {
25 26
     ResultJSON remove(String userId, String id);
26 27
 
27 28
     ResultJSON removeBatch(String userId, String ids);
29
+
30
+    /**
31
+     * 查询客户下拉选项
32
+     */
33
+    ResultJSON querySelect(String belongId);
28 34
 }

Loading…
Cancel
Save