瀏覽代碼

问题修改

zhs 2 年之前
父節點
當前提交
f9ad3939df

+ 2 - 0
src/main/java/com/tld/TldConsumer9560Application.java

@@ -1,10 +1,12 @@
 package com.tld;
 
+import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 
 @SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
+@MapperScan("com.*.mapper")
 public class TldConsumer9560Application {
 
 	public static void main(String[] args) {

+ 2 - 2
src/main/java/com/tld/controller/StorageLocationController.java

@@ -22,7 +22,7 @@ public class StorageLocationController {
      * @return 返回结果
      */
     @GetMapping("getStorage")
-    public Map<String, Object> getStorage(@RequestBody StorageLocation storageLocation){
+    public Map<String, Object> getStorage(StorageLocation storageLocation){
         return storageLocationService.getStorage(storageLocation);
     }
 
@@ -52,7 +52,7 @@ public class StorageLocationController {
      * @return 返回结果
      */
     @PutMapping("updateStorage")
-    public Map<String, Object> updateStorage(StorageLocation storageLocation){
+    public Map<String, Object> updateStorage(@RequestBody StorageLocation storageLocation){
         return storageLocationService.updateStorage(storageLocation);
     }
 

+ 0 - 1
src/main/java/com/tld/mapper/StorageLocationMapper.java

@@ -6,7 +6,6 @@ import org.apache.ibatis.annotations.Mapper;
 import java.util.List;
 import java.util.Map;
 
-@Mapper
 public interface StorageLocationMapper {
     List<StorageLocation> getStorage(StorageLocation storageLocation);
 

+ 1 - 1
src/main/java/com/tld/mapper/UserMapper.java

@@ -23,5 +23,5 @@ public interface UserMapper {
 
     List<Map<String, Object>> getUserExportData(User user);
 
-    int getUserIsNot(String userName);
+    int getUserIsNot(User user);
 }

+ 4 - 4
src/main/java/com/tld/service/impl/UserServiceImpl.java

@@ -91,10 +91,10 @@ public class UserServiceImpl implements UserService {
     public Map<String, Object> addUser(User user) {
         Map<String, Object> map = new HashMap<>();
         try{
-            int count = userMapper.getUserIsNot(user.getUserName());
+            int count = userMapper.getUserIsNot(user);
             if(count > 0){
                 map.put("msg", "510");
-                map.put("errMsg", "账号存在");
+                map.put("errMsg", "用户名已存在");
                 return map;
             }
             user.setPassword(DesEncry.encrypt(user.getPassword()));
@@ -132,10 +132,10 @@ public class UserServiceImpl implements UserService {
     public Map<String, Object> updateUser(User user) {
         Map<String, Object> map = new HashMap<>();
         try{
-            int count = userMapper.getUserIsNot(user.getUserName());
+            int count = userMapper.getUserIsNot(user);
             if(count > 0){
                 map.put("msg", "510");
-                map.put("errMsg", "账号存在");
+                map.put("errMsg", "用户名已存在");
                 return map;
             }
             userMapper.updateUser(user);

+ 6 - 0
src/main/resources/mapper/GoodsMapper.xml

@@ -15,6 +15,9 @@
             <if test="itemNumber != null and itemNumber != ''">
                 and item_number = #{itemNumber}
             </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
         </trim>
     </select>
     <!-- 新增货品信息 -->
@@ -89,6 +92,9 @@
             <if test="itemNumber != null and itemNumber != ''">
                 and item_number = #{itemNumber}
             </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
         </trim>
     </select>
 

+ 12 - 0
src/main/resources/mapper/StorageLocationMapper.xml

@@ -22,6 +22,12 @@
             <if test="storageLocationType != null and storageLocationType != ''">
                 and storage_location_type like CONCAT(CONCAT('%', #{storageLocationType}), '%')
             </if>
+            <if test="isNotDisable != null and isNotDisable != ''">
+                and is_not_disable = #{isNotDisable}
+            </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
         </trim>
     </select>
     <!-- 新增库位信息 -->
@@ -71,6 +77,12 @@
             <if test="storageLocationType != null and storageLocationType != ''">
                 and storage_location_type like CONCAT(CONCAT('%', #{storageLocationType}), '%')
             </if>
+            <if test="isNotDisable != null and isNotDisable != ''">
+                and is_not_disable = #{isNotDisable}
+            </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
         </trim>
     </select>
 </mapper>

+ 1 - 1
src/main/resources/mapper/UserMapper.xml

@@ -105,7 +105,7 @@
     </delete>
     <!-- 查询用户名是否存在 -->
     <select id="getUserIsNot" resultType="int">
-        select count(*) from tld_user where user_name = #{userName}
+        select count(*) from tld_user where user_name = #{userName} and id != #{id}
     </select>
     <!-- 查询导出数据 -->
     <select id="getUserExportData" resultType="java.util.LinkedHashMap">