zhs il y a 2 ans
Parent
commit
7e8ed89fe3

+ 10 - 0
src/main/java/com/tld/controller/StorageLocationController.java

@@ -26,6 +26,16 @@ public class StorageLocationController {
         return storageLocationService.getStorage(storageLocation);
     }
 
+    /**
+     * 查询全部库位
+     * @param storageLocation 参数
+     * @return 返回结果
+     */
+    @GetMapping("getStorageAll")
+    public Map<String, Object> getStorageAll(StorageLocation storageLocation){
+        return storageLocationService.getStorageAll(storageLocation);
+    }
+
     /**
      * 新增庫位信息
      * @param storageLocation 参数

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

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

+ 8 - 0
src/main/java/com/tld/model/Goods.java

@@ -76,6 +76,14 @@ public class Goods implements Serializable {
      * 品名
      */
     private String name;
+    /**
+     * 部门名称
+     */
+    private String userDepartmentName;
+    /**
+     * 库位名称
+     */
+    private String storageLocationName;
     /**
      * 页数
      */

+ 2 - 0
src/main/java/com/tld/service/StorageLocationService.java

@@ -15,4 +15,6 @@ public interface StorageLocationService {
     Map<String, Object> updateStorage(StorageLocation storageLocation);
 
     void export(StorageLocation storageLocation, HttpServletResponse response);
+
+    Map<String, Object> getStorageAll(StorageLocation storageLocation);
 }

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

@@ -130,10 +130,11 @@ public class DepartmentServiceImpl implements DepartmentService {
      * @return 返回结果
      */
     public String codeGenerate(String id){
-        String code = "BH";
-        for(int i = 0; i < 4 - id.length(); i++){
-            code = code + "0";
+        StringBuilder stringBuilder = new StringBuilder("BH");
+        for(int i = 0; i < 6 - id.length(); i++){
+            stringBuilder.append("0");
         }
-        return code + id;
+        stringBuilder.append(id);
+        return stringBuilder.toString();
     }
 }

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

@@ -132,10 +132,11 @@ public class RoleServiceImpl implements RoleService {
      * @return 返回结果
      */
     public String codeGenerate(String id){
-        String code = "BH";
-        for(int i = 0; i < 4 - id.length(); i++){
-            code = code + "0";
+        StringBuilder stringBuilder = new StringBuilder("BH");
+        for(int i = 0; i < 6 - id.length(); i++){
+            stringBuilder.append("0");
         }
-        return code + id;
+        stringBuilder.append(id);
+        return stringBuilder.toString();
     }
 }

+ 15 - 0
src/main/java/com/tld/service/impl/StorageLocationServiceImpl.java

@@ -107,4 +107,19 @@ public class StorageLocationServiceImpl implements StorageLocationService {
             e.printStackTrace();
         }
     }
+
+    @Override
+    public Map<String, Object> getStorageAll(StorageLocation storageLocation) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            List<StorageLocation> list = storageLocationMapper.getStorage(storageLocation);
+            map.put("data", list);
+            map.put("msg", "200");
+        }catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
 }

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

@@ -104,7 +104,7 @@ public class UserServiceImpl implements UserService {
             //修改用户编号
             userMapper.updateUser(user);
             map.put("msg", "200");
-        } catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
             map.put("msg", "500");
             map.put("errMsg", "服务器请求异常,请稍后再试");
@@ -182,10 +182,11 @@ public class UserServiceImpl implements UserService {
      * @return 返回结果
      */
     public String codeGenerate(String id){
-        String code = "TLD";
-        for(int i = 0; i < 4 - id.length(); i++){
-            code = code + "0";
+        StringBuilder stringBuilder = new StringBuilder("YH");
+        for(int i = 0; i < 6 - id.length(); i++){
+            stringBuilder.append("0");
         }
-        return code + id;
+        stringBuilder.append(id);
+        return stringBuilder.toString();
     }
 }

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

@@ -9,14 +9,33 @@
     <!-- 查询货品信息 -->
     <select id="getStorage" resultType="com.tld.model.Goods">
         select
-        <include refid="field"/>
-        from tld_goods
+            a.id,
+            a.item_number,
+            a.type,
+            a.min_accommodate,
+            a.accommodate_num,
+            a.max_accommodate,
+            a.supplier,
+            a.storage_location,
+            a.input_type,
+            a.user_department,
+            a.low_reserves,
+            a.high_reserves,
+            a.grade,
+            a. packing_type,
+            a. unit,
+            a.name,
+            b.department_name as userDepartmentName,
+            c.storage_location_name as storageLocationName
+        from tld_goods a
+        left join tld_department b on a.user_department = b.id
+        left join tld_storage_location c on a.storage_location = c.id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="itemNumber != null and itemNumber != ''">
-                and item_number = #{itemNumber}
+                and a.item_number = #{itemNumber}
             </if>
             <if test="id != null and id != ''">
-                and id = #{id}
+                and a.id = #{id}
             </if>
         </trim>
     </select>
@@ -86,8 +105,24 @@
     <!-- 导出数据查询 -->
     <select id="export" resultType="java.util.LinkedHashMap">
         select
-        item_number,name,type,min_accommodate,accommodate_num,max_accommodate,supplier,storage_location,input_type,user_department,low_reserves,high_reserves,grade,packing_type,unit
-        from tld_goods
+            a.item_number,
+            a.name,
+            a.type,
+            a.min_accommodate,
+            a.accommodate_num,
+            a.max_accommodate,
+            a.supplier,
+            c.storage_location_name,
+            a.input_type,
+            b.department_name,
+            a.low_reserves,
+            a.high_reserves,
+            a.grade,
+            a.packing_type,
+            a.unit
+        from tld_goods a
+        left join tld_department b on a.user_department = b.id
+        left join tld_storage_location c on a.storage_location = c.id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="itemNumber != null and itemNumber != ''">
                 and item_number = #{itemNumber}

+ 7 - 1
src/main/resources/mapper/StorageLocationMapper.xml

@@ -65,7 +65,13 @@
     </update>
     <!-- 导出数据查询 -->
     <select id="export" resultType="java.util.LinkedHashMap">
-        select storage_location_code,storage_location_name,warehouse_where,storage_location_type,is_not_disable,create_time
+        select
+               storage_location_code,
+               storage_location_name,
+               warehouse_where,
+               storage_location_type,
+               case is_not_disable when '1' then '启用' when '2' then '禁用' END as isNotDisable,
+               create_time
         from tld_storage_location
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="storageLocationCode != null and storageLocationCode != ''">