浏览代码

基本问题修改

qxp192083 5 年之前
父节点
当前提交
1f65550057

+ 14 - 0
dgtly-admin/src/main/java/com/dgtly/web/controller/system/SysIndexController.java

@@ -52,6 +52,20 @@ public class SysIndexController extends BaseController
         mmap.put("demoEnabled", Global.isDemoEnabled());
         return "homeIndex";
     }
+    // 系统首页
+    @GetMapping("/demo")
+    public String demo(ModelMap mmap)
+    {
+        // 取身份信息
+        SysUser user = ShiroUtils.getSysUser();
+        // 根据用户id取出菜单
+        List<SysMenu> menus = menuService.selectMenusByUser(user);
+        mmap.put("menus", menus);
+        mmap.put("user", user);
+        mmap.put("copyrightYear", Global.getCopyrightYear());
+        mmap.put("demoEnabled", Global.isDemoEnabled());
+        return "index";
+    }
 
     // 访客页面
     @RequiresPermissions("youtu:visitor:view")

+ 3 - 3
dgtly-admin/src/main/java/com/dgtly/web/core/config/SwaggerConfig.java

@@ -50,13 +50,13 @@ public class SwaggerConfig
         // 用ApiInfoBuilder进行定制
         return new ApiInfoBuilder()
                 // 设置标题
-                .title("标题:若依管理系统_接口文档")
+                .title("标题:管理系统_接口文档")
                 // 描述
                 .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
                 // 作者信息
-                .contact(new Contact(Global.getName(), null, null))
+                .contact(new Contact("dgtly", null, null))
                 // 版本
-                .version("版本号:" + Global.getVersion())
+                .version("版本号4.0.0")
                 .build();
     }
 }

+ 12 - 2
dgtly-common/src/main/java/com/dgtly/common/config/Global.java

@@ -7,18 +7,28 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import com.dgtly.common.utils.StringUtils;
 import com.dgtly.common.utils.YamlUtil;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
 
 /**
  * 全局配置类
  * 
  * @author ruoyi
  */
+@Component
 public class Global
 {
+
     private static final Logger log = LoggerFactory.getLogger(Global.class);
 
-    private static String NAME = "application.yml";
 
+    private static String active ;
+
+
+    @Value("${spring.profiles.active}")
+    public void setActive(String active) {
+        Global.active = active;
+    }
     /**
      * 当前对象实例
      */
@@ -56,7 +66,7 @@ public class Global
             Map<?, ?> yamlMap = null;
             try
             {
-                yamlMap = YamlUtil.loadYaml(NAME);
+                yamlMap = YamlUtil.loadYaml("application-"+active+".yml");
                 value = String.valueOf(YamlUtil.getProperty(yamlMap, key));
                 map.put(key, value != null ? value : StringUtils.EMPTY);
             }

+ 4 - 1
dgtly-framework/src/main/java/com/dgtly/framework/config/ResourcesConfig.java

@@ -25,6 +25,9 @@ public class ResourcesConfig implements WebMvcConfigurer
     @Value("${shiro.user.indexUrl}")
     private String indexUrl;
 
+    @Value("${ruoyi.profile}")
+    private String profile;
+
     @Autowired
     private RepeatSubmitInterceptor repeatSubmitInterceptor;
 
@@ -41,7 +44,7 @@ public class ResourcesConfig implements WebMvcConfigurer
     public void addResourceHandlers(ResourceHandlerRegistry registry)
     {
         /** 本地文件上传路径 */
-        registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + Global.getProfile() + "/");
+        registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + profile + "/");
 
         /** swagger配置 */
         registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");

+ 30 - 11
dgtly-goods/dgtly-goods-admin/src/main/java/com/dgtly/goods/controller/GoodsTypeController.java

@@ -1,6 +1,14 @@
 package com.dgtly.goods.controller;
 
+import java.util.ArrayList;
 import java.util.List;
+
+import com.dgtly.common.constant.UserConstants;
+import com.dgtly.common.core.domain.Ztree;
+import com.dgtly.common.utils.StringUtils;
+import com.dgtly.framework.util.ShiroUtils;
+import com.dgtly.system.domain.SysDept;
+import com.dgtly.system.domain.SysUser;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -26,15 +34,15 @@ import com.dgtly.common.core.page.TableDataInfo;
  * @date 2020-02-13
  */
 @Controller
-@RequestMapping("/system/type")
+@RequestMapping("/goods/type")
 public class GoodsTypeController extends BaseController
 {
-    private String prefix = "system/type";
+    private String prefix = "goods/type";
 
     @Autowired
     private IGoodsTypeService goodsTypeService;
 
-    @RequiresPermissions("system:type:view")
+    @RequiresPermissions("goods:type:view")
     @GetMapping()
     public String type()
     {
@@ -44,20 +52,29 @@ public class GoodsTypeController extends BaseController
     /**
      * 查询商品分类列列表
      */
-    @RequiresPermissions("system:type:list")
+    @RequiresPermissions("goods:type:list")
     @PostMapping("/list")
     @ResponseBody
-    public TableDataInfo list(GoodsType goodsType)
+    public List<GoodsType> list(GoodsType goodsType)
     {
-        startPage();
         List<GoodsType> list = goodsTypeService.selectGoodsTypeList(goodsType);
-        return getDataTable(list);
+        return list;
+    }
+    /**
+     * 加载部门列表树
+     */
+    @GetMapping("/treeData")
+    @ResponseBody
+    public List<Ztree> treeData(GoodsType goodsType)
+    {
+        List<Ztree> ztrees = goodsTypeService.selectGoodsTypeTree(goodsType);
+        return ztrees;
     }
 
     /**
      * 导出商品分类列列表
      */
-    @RequiresPermissions("system:type:export")
+    @RequiresPermissions("goods:type:export")
     @PostMapping("/export")
     @ResponseBody
     public AjaxResult export(GoodsType goodsType)
@@ -79,7 +96,7 @@ public class GoodsTypeController extends BaseController
     /**
      * 新增保存商品分类列
      */
-    @RequiresPermissions("system:type:add")
+    @RequiresPermissions("goods:type:add")
     @Log(title = "商品分类列", businessType = BusinessType.INSERT)
     @PostMapping("/add")
     @ResponseBody
@@ -102,7 +119,7 @@ public class GoodsTypeController extends BaseController
     /**
      * 修改保存商品分类列
      */
-    @RequiresPermissions("system:type:edit")
+    @RequiresPermissions("goods:type:edit")
     @Log(title = "商品分类列", businessType = BusinessType.UPDATE)
     @PostMapping("/edit")
     @ResponseBody
@@ -114,7 +131,7 @@ public class GoodsTypeController extends BaseController
     /**
      * 删除商品分类列
      */
-    @RequiresPermissions("system:type:remove")
+    @RequiresPermissions("goods:type:remove")
     @Log(title = "商品分类列", businessType = BusinessType.DELETE)
     @PostMapping( "/remove")
     @ResponseBody
@@ -122,4 +139,6 @@ public class GoodsTypeController extends BaseController
     {
         return toAjax(goodsTypeService.deleteGoodsTypeByIds(ids));
     }
+
+
 }

+ 4 - 2
dgtly-goods/dgtly-goods-admin/src/main/resources/templates/goods/type/add.html

@@ -22,14 +22,16 @@
     </div>
     <th:block th:include="include :: footer" />
     <script type="text/javascript">
-        var prefix = ctx + "system/type"
+        var prefix = ctx + "goots/type"
         $("#form-type-add").validate({
             focusCleanup: true
         });
 
         function submitHandler() {
             if ($.validate.form()) {
-                $.operate.save(prefix + "/add", $('#form-type-add').serialize());
+                let data  =$('#form-type-add').serialize();
+                data.push("aaaaaa");
+                $.operate.save(prefix + "/add", data);
             }
         }
     </script>

+ 15 - 16
dgtly-goods/dgtly-goods-admin/src/main/resources/templates/goods/type/type.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
 <head>
-    <th:block th:include="include :: header('商品分类列表')" />
+    <th:block th:include="include :: header('商品分类列表')" />
 </head>
 <body class="gray-bg">
      <div class="container-div">
@@ -23,7 +23,7 @@
                                 <input type="text" name="ancestors"/>
                             </li>
                             <li>
-                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
+                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                 <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                             </li>
                         </ul>
@@ -32,44 +32,43 @@
             </div>
 
             <div class="btn-group-sm" id="toolbar" role="group">
-                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:type:add">
+                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="goods:type:add">
                     <i class="fa fa-plus"></i> 添加
                 </a>
-                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:type:edit">
+                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="goods:type:edit">
                     <i class="fa fa-edit"></i> 修改
                 </a>
-                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:type:remove">
+                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="goods:type:remove">
                     <i class="fa fa-remove"></i> 删除
                 </a>
-                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:type:export">
-                    <i class="fa fa-download"></i> 导出
-                 </a>
             </div>
             <div class="col-sm-12 select-table table-striped">
-                <table id="bootstrap-table"></table>
+                <table id="bootstrap-tree-table"></table>
             </div>
         </div>
     </div>
     <th:block th:include="include :: footer" />
     <script th:inline="javascript">
-        var editFlag = [[${@permission.hasPermi('system:type:edit')}]];
-        var removeFlag = [[${@permission.hasPermi('system:type:remove')}]];
-        var prefix = ctx + "system/type";
-
+        var editFlag = [[${@permission.hasPermi('goods:type:edit')}]];
+        var removeFlag = [[${@permission.hasPermi('goods:type:remove')}]];
+        var prefix = ctx + "goods/type";
         $(function() {
             var options = {
+                code: "id",
+                parentCode: "parentId",
+                uniqueId: "id",
+                expandColumn:2,
                 url: prefix + "/list",
                 createUrl: prefix + "/add",
                 updateUrl: prefix + "/edit/{id}",
                 removeUrl: prefix + "/remove",
-                exportUrl: prefix + "/export",
                 modalName: "商品分类列",
                 columns: [{
                     checkbox: true
                 },
                 {
                     field : 'id', 
-                    title : '祖级列表',
+                    title : 'id',
                     visible: false
                 },
                 {
@@ -99,7 +98,7 @@
                     }
                 }]
             };
-            $.table.init(options);
+            $.treeTable.init(options);
         });
     </script>
 </body>

+ 13 - 0
dgtly-goods/dgtly-goods-common/src/main/java/com/dgtly/goods/domain/GoodsType.java

@@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 import com.dgtly.common.annotation.Excel;
 import com.dgtly.common.core.domain.BaseEntity;
 
+import java.util.List;
+
 /**
  * 商品分类列对象 goods_type
  * 
@@ -30,6 +32,10 @@ public class GoodsType extends BaseEntity
     @Excel(name = "祖级列表")
     private String ancestors;
 
+    /** 商品属性列表*/
+    private List<GoodsTypeAttribute> goodsTypeAttributes;
+
+
     public void setId(Long id) 
     {
         this.id = id;
@@ -67,6 +73,13 @@ public class GoodsType extends BaseEntity
         return ancestors;
     }
 
+    public List<GoodsTypeAttribute> getGoodsTypeAttributes() {
+        return goodsTypeAttributes;
+    }
+
+    public void setGoodsTypeAttributes(List<GoodsTypeAttribute> goodsTypeAttributes) {
+        this.goodsTypeAttributes = goodsTypeAttributes;
+    }
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 8 - 0
dgtly-goods/dgtly-goods-common/src/main/java/com/dgtly/goods/service/IGoodsTypeService.java

@@ -1,5 +1,6 @@
 package com.dgtly.goods.service;
 
+import com.dgtly.common.core.domain.Ztree;
 import com.dgtly.goods.domain.GoodsType;
 import java.util.List;
 
@@ -58,4 +59,11 @@ public interface IGoodsTypeService
      * @return 结果
      */
     public int deleteGoodsTypeById(Long id);
+
+    /**
+     * 获取商品分类树状结构
+     * @param goodsType
+     * @return
+     */
+    List<Ztree> selectGoodsTypeTree(GoodsType goodsType);
 }

+ 37 - 0
dgtly-goods/dgtly-goods-common/src/main/java/com/dgtly/goods/service/impl/GoodsTypeServiceImpl.java

@@ -1,6 +1,9 @@
 package com.dgtly.goods.service.impl;
 
+import java.util.ArrayList;
 import java.util.List;
+
+import com.dgtly.common.core.domain.Ztree;
 import com.dgtly.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -94,4 +97,38 @@ public class GoodsTypeServiceImpl implements IGoodsTypeService
     {
         return goodsTypeMapper.deleteGoodsTypeById(id);
     }
+
+    /**
+     * 获取商品分类树状结构
+     * @param goodsType
+     * @return
+     */
+    @Override
+    public List<Ztree> selectGoodsTypeTree(GoodsType goodsType) {
+        List<GoodsType> goodsTypes = goodsTypeMapper.selectGoodsTypeList(goodsType);
+        List<Ztree> ztrees = initZtree(goodsTypes);
+        return ztrees;
+    }
+
+    /**
+     * 分类对象转分类树
+     *
+     * @param goodsTypes 分类列表
+     * @return 树结构列表
+     */
+    public List<Ztree> initZtree(List<GoodsType>goodsTypes )
+    {
+        List<Ztree> ztrees = new ArrayList<Ztree>();
+        for (GoodsType goodsType : goodsTypes)
+        {
+
+            Ztree ztree = new Ztree();
+            ztree.setId(goodsType.getId());
+            ztree.setpId(goodsType.getParentId());
+            ztree.setName(goodsType.getName());
+            ztree.setTitle(goodsType.getName());
+            ztrees.add(ztree);
+        }
+        return ztrees;
+    }
 }