zhs 2 éve
szülő
commit
aa28cfc503

+ 11 - 1
src/main/java/com/tld/controller/MenuController.java

@@ -70,7 +70,7 @@ public class MenuController {
     }
 
     /**
-     * 根据角色查询菜单内容
+     * 根据角色查询菜单内容PC
      * @param userId 参数
      * @return 返回结果
      */
@@ -79,5 +79,15 @@ public class MenuController {
         return menuService.getUserMenu(userId);
     }
 
+    /**
+     * 根据角色查询菜单内容PDA
+     * @param userId 参数
+     * @return 返回结果
+     */
+    @GetMapping("getUserMenuPDA")
+    public Map<String, Object> getUserMenuPDA(String userId){
+        return menuService.getUserMenuPDA(userId);
+    }
+
 
 }

+ 2 - 0
src/main/java/com/tld/mapper/MenuMapper.java

@@ -18,4 +18,6 @@ public interface MenuMapper {
     List<Menu> getUserMenu(String userId);
 
     List<Menu> getPage(Menu menu);
+
+    List<Menu> getUserMenuPDA(String userId);
 }

+ 4 - 0
src/main/java/com/tld/model/Menu.java

@@ -33,6 +33,10 @@ public class Menu implements Serializable {
      * 自身id
      */
     private String idCode;
+    /**
+     * 类型
+     */
+    private String type;
     /**
      * 页数
      */

+ 4 - 0
src/main/java/com/tld/model/Role.java

@@ -40,6 +40,10 @@ public class Role implements Serializable {
      * 前段用菜单名称
      */
     private String menuBefore;
+    /**
+     * pda菜单
+     */
+    private String menuPda;
     /**
      * 页数
      */

+ 4 - 0
src/main/java/com/tld/model/StorageLocation.java

@@ -32,6 +32,10 @@ public class StorageLocation implements Serializable {
      * 库位类型
      */
     private String storageLocationType;
+    /**
+     *库存容量
+     */
+    private String storageLocationCapacity;
     /**
      * 是否禁用
      */

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

@@ -16,4 +16,6 @@ public interface MenuService {
     Map<String, Object> getUserMenu(String userId);
 
     Map<String, Object> getPage(Menu menu);
+
+    Map<String, Object> getUserMenuPDA(String userId);
 }

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

@@ -117,6 +117,21 @@ public class MenuServiceImpl implements MenuService {
         return map;
     }
 
+    @Override
+    public Map<String, Object> getUserMenuPDA(String userId) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            List<Menu> list = menuMapper.getUserMenuPDA(userId);
+            map.put("data", list);
+            map.put("msg", "200");
+        }catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
     /**
      * 树结构查询
      * @return

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

@@ -87,7 +87,7 @@ public class StorageLocationServiceImpl implements StorageLocationService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("库位编号", "库位名称", "所在仓库","库位类型","是否禁用","创建时间");
+            List<Object> head = Arrays.asList("库位编号", "库位名称", "所在仓库","库位类型","库位容量","是否禁用","创建时间");
             //查询数据
             PageHelper.startPage(storageLocation.getPage(), storageLocation.getLimit());
             PageInfo<Map<String, Object>> list = new PageInfo<>(storageLocationMapper.export(storageLocation));

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

@@ -31,7 +31,7 @@ public class UserServiceImpl implements UserService {
         try{
             user.setPassword(DesEncry.encrypt(user.getPassword()));
             User user1 = userMapper.login(user);
-            //获取用户ip
+            //获取用户ip3000
             String ipAddr = IpUtils.getIpAddr(request);
             if(null == user1){
                 map.put("msg", "510");

+ 28 - 0
src/main/java/com/tld/util/CommRes.java

@@ -0,0 +1,28 @@
+package com.tld.util;
+
+import lombok.Data;
+
+/**
+ * 返回类
+ */
+@Data
+public class CommRes {
+    private String code;
+    private String msg;
+    private Object data;
+
+    public static CommRes success(Object data){
+        CommRes commRes = new CommRes();
+        commRes.setCode("200");
+        commRes.setMsg("操作成功");
+        commRes.setData(data);
+        return commRes;
+    }
+    public static CommRes fail(String msg){
+        CommRes commRes = new CommRes();
+        commRes.setCode("400");
+        commRes.setMsg(msg);
+        commRes.setData("");
+        return commRes;
+    }
+}

+ 4 - 1
src/main/resources/mapper/DepartmentMapper.xml

@@ -18,6 +18,9 @@
             <if test="departmentName != null and departmentName != ''">
                 and department_name like CONCAT(CONCAT('%', #{departmentName}), '%')
             </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
         </trim>
     </select>
     <!-- 新增部门 -->
@@ -53,7 +56,7 @@
         from tld_department
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="code != null and code != ''">
-                and code = #{departmentCode}
+                and code = #{code}
             </if>
             <if test="departmentName != null and departmentName != ''">
                 and department_name like CONCAT(CONCAT('%', #{departmentName}), '%')

+ 25 - 2
src/main/resources/mapper/MenuMapper.xml

@@ -4,7 +4,7 @@
 <mapper namespace="com.tld.mapper.MenuMapper">
 
     <sql id="field">
-        id,name,url,p_id,order_by
+        id,name,url,p_id,order_by,type
     </sql>
     <!-- 查询菜单 -->
     <select id="getMenu" resultType="com.tld.model.Menu">
@@ -15,6 +15,7 @@
             <if test="pId != null and pId != ''">
                 and p_id = #{pId}
             </if>
+            and type = "PC"
         </trim>
         order by order_by
     </select>
@@ -30,12 +31,18 @@
             <if test="name != null and name != ''">
                 and name like CONCAT(CONCAT('%', #{name}), '%')
             </if>
+            <if test="type != null and type != ''">
+                and type = #{type}
+            </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
         </trim>
         order by order_by
     </select>
     <!-- 新增菜单 -->
     <insert id="addMenu">
-        insert into tld_menu(name,url,p_id,order_by) values(#{name},#{url},#{pId},#{orderBy})
+        insert into tld_menu(name,url,p_id,order_by,type) values(#{name},#{url},#{pId},#{orderBy},#{type})
     </insert>
     <!-- 修改菜单 -->
     <update id="updateMenu">
@@ -54,6 +61,9 @@
                 <if test="orderBy != null and orderBy != ''">
                     order_by = #{orderBy},
                 </if>
+                <if test="type != null and type != ''">
+                    type = #{type},
+                </if>
             </trim>
         </set>
             where id = #{id}
@@ -75,4 +85,17 @@
         WHERE c.menu LIKE CONCAT('%', CONCAT(a.id, ','), '%')
         ORDER BY a.order_by
     </select>
+    <!-- 根据角色查询菜单内容 -->
+    <select id="getUserMenuPDA" resultType="com.tld.model.Menu">
+        SELECT a.id,
+               a.name,
+               a.url,
+               a.p_id,
+               c.menu_pda
+        FROM tld_menu a
+                 JOIN tld_user b ON b.id = #{userId}
+                 JOIN tld_role c ON b.role = c.id
+        WHERE c.menu_pda LIKE CONCAT('%', CONCAT(a.id, ','), '%')
+        ORDER BY a.order_by
+    </select>
 </mapper>

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

@@ -4,7 +4,7 @@
 <mapper namespace="com.tld.mapper.RoleMapper">
 
     <sql id="roleField">
-        id,role_code,role_name,create_time,remarks,menu,menu_before
+        id,role_code,role_name,create_time,remarks,menu,menu_before,menu_pda
     </sql>
     <!-- 新增角色 -->
     <insert id="addRole">
@@ -33,6 +33,9 @@
                 <if test="menuBefore != null and menuBefore != ''">
                     menu_before = #{menuBefore},
                 </if>
+                <if test="menuPda != null">
+                    menu_pda = #{menuPda},
+                </if>
             </trim>
         </set>
             where id = #{id}
@@ -49,6 +52,9 @@
             <if test="roleName != null and roleName != ''">
                 and role_name like CONCAT(CONCAT('%', #{roleName}), '%')
             </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
         </trim>
     </select>
     <!-- 删除角色信息 -->

+ 8 - 4
src/main/resources/mapper/StorageLocationMapper.xml

@@ -4,7 +4,7 @@
 <mapper namespace="com.tld.mapper.StorageLocationMapper">
 
     <sql id="field">
-        id,storage_location_code,storage_location_name,warehouse_where,storage_location_type,is_not_disable,create_time
+        id,storage_location_code,storage_location_name,warehouse_where,storage_location_type,is_not_disable,storage_location_capacity,create_time
     </sql>
     <!-- 查询库位信息 -->
     <select id="getStorage" resultType="com.tld.model.StorageLocation">
@@ -32,8 +32,8 @@
     </select>
     <!-- 新增库位信息 -->
     <insert id="addStorage">
-        insert into tld_storage_location(storage_location_code,storage_location_name,warehouse_where,storage_location_type,is_not_disable,create_time)
-        values(#{storageLocationCode},#{storageLocationName},#{warehouseWhere},#{storageLocationType},#{isNotDisable},DATE_FORMAT(NOW(), '%Y-%m-%d'))
+        insert into tld_storage_location(storage_location_code,storage_location_name,warehouse_where,storage_location_type,is_not_disable,storage_location_capacity,create_time)
+        values(#{storageLocationCode},#{storageLocationName},#{warehouseWhere},#{storageLocationType},#{isNotDisable},#{storageLocationCapacity},DATE_FORMAT(NOW(), '%Y-%m-%d'))
     </insert>
     <!-- 删除库位信息 -->
     <delete id="delStorage">
@@ -56,6 +56,9 @@
                 <if test="storageLocationType != null and storageLocationType != ''">
                     storage_location_type = #{storageLocationType},
                 </if>
+                <if test="storageLocationCapacity != null and storageLocationCapacity != ''">
+                    storage_location_capacity = #{storageLocationCapacity},
+                </if>
                 <if test="isNotDisable != null and isNotDisable != ''">
                     is_not_disable = #{isNotDisable},
                 </if>
@@ -70,7 +73,8 @@
                storage_location_name,
                warehouse_where,
                storage_location_type,
-               case is_not_disable when '1' then '启用' when '2' then '禁用' END as isNotDisable,
+               storage_location_capacity,
+               case is_not_disable when '1' then '启用' when '0' then '禁用' END as isNotDisable,
                create_time
         from tld_storage_location
         <trim prefix="WHERE" prefixOverrides="and |or">