Pārlūkot izejas kodu

增加客户下拉框的查询后台

YL2767 2 mēnešus atpakaļ
vecāks
revīzija
e72cd217da

+ 16
- 0
src/main/java/com/th/demo/controller/maint/CustomerController.java Parādīt failu

@@ -116,4 +116,20 @@ public class CustomerController {
116 116
         }
117 117
     }
118 118
 
119
+    @RequestMapping(value = "/queryByUserId.do")//查询方法 前两个参数是分页参数
120
+    public String queryByUserId(String fId,
121
+                               HttpServletRequest request) {
122
+
123
+        try {
124
+            String userId = (String) request.getAttribute("userId");
125
+            String belongId = (String) request.getAttribute("belongId");
126
+            result = customerService.queryByUserId(userId, belongId);
127
+        } catch (Exception ex) {
128
+            ex.printStackTrace();
129
+            result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
130
+        } finally {
131
+            return result;
132
+        }
133
+    }
134
+
119 135
 }

+ 2
- 0
src/main/java/com/th/demo/mapping/maint/CustomerMapper.java Parādīt failu

@@ -22,4 +22,6 @@ public interface CustomerMapper {
22 22
     List<Customer> select(String query, String belongId);
23 23
 
24 24
     Customer selectByName(String customerName, String belongId);
25
+
26
+    List<Customer> selectByUserId(String userId, String belongId);
25 27
 }

+ 9
- 1
src/main/java/com/th/demo/service/impl/maint/CustomerServiceImpl.java Parādīt failu

@@ -111,7 +111,7 @@ public class CustomerServiceImpl implements CustomerService {
111 111
         result = Tools.moreThanZeroResultJSON(num);
112 112
         return result;
113 113
     }
114
-@Transactional
114
+    @Transactional
115 115
     @Override
116 116
     public String defaultAddress(String json, String userId, String belongId) {
117 117
 
@@ -131,4 +131,12 @@ public class CustomerServiceImpl implements CustomerService {
131 131
         num += customerAddressMapper.updateByPrimaryKey(customerAddress);
132 132
         return Tools.moreThanZeroResultJSON(num);
133 133
     }
134
+
135
+    @Transactional
136
+    @Override
137
+    public String queryByUserId(String userId, String belongId) {
138
+
139
+        List<Customer> list = customerMapper.selectByUserId(userId, belongId);
140
+        return JSONTools.toString(list);
141
+    }
134 142
 }

+ 2
- 0
src/main/java/com/th/demo/service/maint/CustomerService.java Parādīt failu

@@ -12,4 +12,6 @@ public interface CustomerService {
12 12
     String saveAddress(String json, String userId, String belongId);
13 13
 
14 14
     String defaultAddress(String json, String userId, String belongId);
15
+
16
+    String queryByUserId(String userId, String belongId);
15 17
 }

+ 7
- 0
src/main/resource/mapper/maint/CustomerMapper.xml Parādīt failu

@@ -220,4 +220,11 @@
220 220
     and ifnull(cancel_flag,'0') = '0'
221 221
   </select>
222 222
 
223
+  <select id="selectByUserId" resultMap="BaseResultMap" >
224
+    select *
225
+    from t_maint_customer
226
+    where belong_id = #{param2,jdbcType=VARCHAR}
227
+      and ifnull(cancel_flag,'0') = '0'
228
+  </select>
229
+
223 230
 </mapper>

Notiek ielāde…
Atcelt
Saglabāt