Merge remote-tracking branch 'origin/master'
# Conflicts: # ghy-goods/src/main/java/com/ghy/goods/domain/DeptGoodsCategory.java # ghy-goods/src/main/java/com/ghy/goods/service/impl/DeptGoodsCategoryServiceImpl.java
This commit is contained in:
commit
82f1cdbad6
|
|
@ -152,7 +152,7 @@ public class GoodsCategoryController extends BaseController {
|
|||
/**
|
||||
* 商品类别表
|
||||
*/
|
||||
@RequiresPermissions("goods:goods:list")
|
||||
// @RequiresPermissions("goods:goods:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public List<GoodsCategory> list(GoodsCategory category) {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
package com.ghy.web.controller.goods;
|
||||
|
||||
import com.ghy.common.core.controller.BaseController;
|
||||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.core.domain.Ztree;
|
||||
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||
import com.ghy.goods.domain.GoodsCategory;
|
||||
import com.ghy.goods.service.GoodsCategoryService;
|
||||
import com.ghy.goods.service.GoodsDeptCategoryService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
|
@ -21,8 +23,9 @@ public class GoodsDeptCategoryController extends BaseController {
|
|||
|
||||
@Resource
|
||||
GoodsCategoryService goodsCategoryService;
|
||||
// @Resource
|
||||
// GoodsDeptCategoryService goodsDeptCategoryService;
|
||||
|
||||
@Resource
|
||||
GoodsDeptCategoryService goodsDeptCategoryService;
|
||||
|
||||
@RequiresPermissions("goods:deptcategory:view")
|
||||
@GetMapping()
|
||||
|
|
@ -32,11 +35,21 @@ public class GoodsDeptCategoryController extends BaseController {
|
|||
|
||||
|
||||
@RequiresPermissions("goods:deptcategory:add")
|
||||
@GetMapping("/add")
|
||||
public String edit(ModelMap mmap) {
|
||||
@GetMapping("/add/{id}")
|
||||
public String edit(@PathVariable(name = "id") Long id, ModelMap mmap) {
|
||||
return PREFIX + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品类别表
|
||||
*/
|
||||
@RequiresPermissions("goods:goods:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public List<GoodsCategory> list(GoodsCategory category) {
|
||||
return goodsCategoryService.selectGoodsCategoryList(category);
|
||||
}
|
||||
|
||||
@GetMapping("/tree")
|
||||
@ResponseBody
|
||||
public List<Ztree> goodsDeptCategoryTree() {
|
||||
|
|
@ -45,4 +58,10 @@ public class GoodsDeptCategoryController extends BaseController {
|
|||
return goodsCategoryService.selectCategoryTree(null);
|
||||
}
|
||||
|
||||
@PostMapping("/app/list")
|
||||
@ResponseBody
|
||||
public AjaxResult appList(@RequestBody DeptGoodsCategory deptGoodsCategory){
|
||||
return AjaxResult.success(goodsDeptCategoryService.appList(deptGoodsCategory.getDeptId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,141 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('修改部门')" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-dept-edit" th:object="${dept}">
|
||||
<input name="deptId" type="hidden" th:field="*{deptId}" />
|
||||
<input id="treeId" name="parentId" type="hidden" th:field="*{parentId}" />
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">上级部门:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input class="form-control" type="text" id="treeName" onclick="selectDeptTree()" readonly="true" th:field="*{parentName}">
|
||||
<span class="input-group-addon"><i class="fa fa-search"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">部门名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="deptName" th:field="*{deptName}" id="deptName" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">显示排序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="orderNum" th:field="*{orderNum}" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">负责人:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="leader" th:field="*{leader}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">联系电话:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="phone" th:field="*{phone}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">邮箱:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="email" th:field="*{email}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">部门状态:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
|
||||
<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
|
||||
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "system/dept";
|
||||
|
||||
$("#form-dept-edit").validate({
|
||||
onkeyup: false,
|
||||
rules:{
|
||||
deptName:{
|
||||
remote: {
|
||||
url: prefix + "/checkDeptNameUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
"deptId": function() {
|
||||
return $("#deptId").val();
|
||||
},
|
||||
"parentId": function() {
|
||||
return $("input[name='parentId']").val();
|
||||
},
|
||||
"deptName": function() {
|
||||
return $.common.trim($("#deptName").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
orderNum:{
|
||||
digits:true
|
||||
},
|
||||
email:{
|
||||
email:true,
|
||||
},
|
||||
phone:{
|
||||
isPhone:true,
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
"deptName": {
|
||||
remote: "部门已经存在"
|
||||
}
|
||||
},
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-dept-edit').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
/*部门管理-修改-选择部门树*/
|
||||
function selectDeptTree() {
|
||||
var deptId = $("#treeId").val();
|
||||
var excludeId = $("input[name='deptId']").val();
|
||||
if(deptId > 0) {
|
||||
var options = {
|
||||
title: '部门选择',
|
||||
width: "380",
|
||||
url: prefix + "/selectDeptTree/" + $("#treeId").val() + "/" + excludeId,
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
} else {
|
||||
$.modal.alertError("父部门不能选择");
|
||||
}
|
||||
}
|
||||
|
||||
function doSubmit(index, layero){
|
||||
var tree = layero.find("iframe")[0].contentWindow.$._tree;
|
||||
if ($.tree.notAllowLastLevel(tree)) {
|
||||
var body = $.modal.getChildFrame(index);
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
$.modal.close(index);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,14 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('修改角色')" />
|
||||
<th:block th:include="include :: header('新增分公司类目')" />
|
||||
<th:block th:include="include :: ztree-css" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-role-edit">
|
||||
<form class="form-horizontal m" id="form-category-add">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">菜单权限:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="check-box">
|
||||
<input type="checkbox" value="1">展开/折叠</label>
|
||||
|
|
@ -35,8 +34,32 @@
|
|||
$.tree.init(options);
|
||||
});
|
||||
|
||||
function edit() {
|
||||
var menuIds = $.tree.getCheckedNodes();
|
||||
$('input').on('ifChanged', function(obj){
|
||||
var type = $(this).val();
|
||||
var checked = obj.currentTarget.checked;
|
||||
if (type == 1) {
|
||||
if (checked) {
|
||||
$._tree.expandAll(true);
|
||||
} else {
|
||||
$._tree.expandAll(false);
|
||||
}
|
||||
} else if (type == "2") {
|
||||
if (checked) {
|
||||
$._tree.checkAllNodes(true);
|
||||
} else {
|
||||
$._tree.checkAllNodes(false);
|
||||
}
|
||||
} else if (type == "3") {
|
||||
if (checked) {
|
||||
$._tree.setting.check.chkboxType = { "Y": "ps", "N": "ps" };
|
||||
} else {
|
||||
$._tree.setting.check.chkboxType = { "Y": "", "N": "" };
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function add() {
|
||||
var menuIds = $.tree.getCheckedNodes("goodsCategoryId");
|
||||
$.ajax({
|
||||
cache : true,
|
||||
type : "POST",
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-primary" onclick="$.operate.edit(1)" shiro:hasPermission="goods:category:edit">
|
||||
<a class="btn btn-primary" onclick="$.operate.add(1)" shiro:hasPermission="goods:category:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-info" id="expandAllBtn">
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
var editFlag = [[${@permission.hasPermi('goods:category:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('goods:category:remove')}]];
|
||||
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
||||
var prefix = ctx + "goods/category"
|
||||
var prefix = ctx + "goods/deptcategory"
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
|
|
@ -58,6 +58,7 @@
|
|||
parentCode: "parentCategoryId",
|
||||
uniqueId: "goodsCategoryId",
|
||||
url: prefix + "/list",
|
||||
addUrl: prefix + "/add/{id}",
|
||||
createUrl: prefix + "/add/{id}",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove/{id}",
|
||||
|
|
|
|||
|
|
@ -278,6 +278,7 @@ public class ShiroConfig
|
|||
//部分接口不需要登陆校验
|
||||
filterChainDefinitionMap.put("/wx/**", "anon");
|
||||
filterChainDefinitionMap.put("/pay/**", "anon");
|
||||
filterChainDefinitionMap.put("/goods/**", "anon");
|
||||
filterChainDefinitionMap.put("/adapay/**", "anon");
|
||||
filterChainDefinitionMap.put("/MP_verify_bRFuvYpyQ4WLr0on.txt", "anon");
|
||||
// 对静态资源设置匿名访问
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.ghy.common.annotation.Excel;
|
|||
import com.ghy.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author clunt
|
||||
* 分公司使用类目
|
||||
|
|
@ -38,4 +40,8 @@ public class DeptGoodsCategory extends BaseEntity {
|
|||
@Excel(name = "三级分销扣点比例", cellType = Excel.ColumnType.STRING)
|
||||
private String threeRate;
|
||||
|
||||
private Long parentCategoryId;
|
||||
|
||||
private List<DeptGoodsCategory> child;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,4 +45,7 @@ public interface DeptGoodsCategoryMapper {
|
|||
*/
|
||||
int deleteDeptGoodsCategoryByIds(Collection<Long> goodsCategoryId);
|
||||
|
||||
|
||||
List<DeptGoodsCategory> appList(DeptGoodsCategory deptGoodsCategory);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,18 @@
|
|||
package com.ghy.goods.service;
|
||||
|
||||
import com.ghy.common.core.domain.Ztree;
|
||||
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GoodsDeptCategoryService {
|
||||
|
||||
|
||||
List<Ztree> tree(Long parentId);
|
||||
|
||||
/**
|
||||
* @param deptId 筛选条件
|
||||
* @return 父子层级的list
|
||||
*/
|
||||
List<DeptGoodsCategory> appList(Long deptId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.ghy.goods.service.impl;
|
||||
|
||||
import com.ghy.common.core.domain.Ztree;
|
||||
import com.ghy.common.utils.StringUtils;
|
||||
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||
import com.ghy.goods.domain.GoodsCategory;
|
||||
import com.ghy.goods.mapper.DeptGoodsCategoryMapper;
|
||||
|
|
@ -20,6 +22,8 @@ import java.util.stream.Collectors;
|
|||
@Service
|
||||
public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService {
|
||||
|
||||
@Resource
|
||||
private DeptGoodsCategoryMapper goodsCategoryMapper;
|
||||
@Resource
|
||||
GoodsCategoryService goodsCategoryService;
|
||||
@Resource
|
||||
|
|
@ -65,4 +69,46 @@ public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService {
|
|||
public DeptGoodsCategory get(long id) {
|
||||
return deptGoodsCategoryMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Ztree> tree(Long parentId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptGoodsCategory> appList(Long deptId) {
|
||||
DeptGoodsCategory deptGoodsCategory = new DeptGoodsCategory();
|
||||
deptGoodsCategory.setDeptId(deptId);
|
||||
// 第一层
|
||||
List<DeptGoodsCategory> goodsCategoryList = goodsCategoryMapper.appList(deptGoodsCategory);
|
||||
// 第二层
|
||||
this.fillChild(goodsCategoryList);
|
||||
// 第三层
|
||||
for (DeptGoodsCategory category : goodsCategoryList) {
|
||||
if (StringUtils.isNotNull(category.getChild())) {
|
||||
this.fillChild(category.getChild());
|
||||
}
|
||||
}
|
||||
// 第四层
|
||||
for (DeptGoodsCategory category : goodsCategoryList) {
|
||||
if (StringUtils.isNotNull(category.getChild())) {
|
||||
for (DeptGoodsCategory result : category.getChild()) {
|
||||
if (StringUtils.isNotNull(result.getChild())) {
|
||||
this.fillChild(result.getChild());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return goodsCategoryList;
|
||||
}
|
||||
|
||||
private void fillChild(List<DeptGoodsCategory> goodsCategoryList) {
|
||||
List<DeptGoodsCategory> childList;
|
||||
for (DeptGoodsCategory deptGoodsCategory : goodsCategoryList) {
|
||||
childList = goodsCategoryMapper.appList(deptGoodsCategory);
|
||||
if (childList.size() > 0) {
|
||||
deptGoodsCategory.setChild(childList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ public class GoodsCategoryServiceImpl implements GoodsCategoryService {
|
|||
ztree.setpId(goodsCategory.getParentCategoryId());
|
||||
ztree.setName(goodsCategory.getGoodsCategoryName());
|
||||
ztree.setTitle(goodsCategory.getGoodsCategoryName());
|
||||
|
||||
ztrees.add(ztree);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,12 @@
|
|||
<result property="deptGoodsCategoryId" column="dept_goods_category_id"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="goodsCategoryId" column="goods_category_id"/>
|
||||
<result property="goodsCategoryName" column="goods_category_name"/>
|
||||
<result property="parentCategoryId" column="parent_category_id" />
|
||||
<result property="categorySort" column="category_sort"/>
|
||||
<result property="oneRate" column="one_rate"/>
|
||||
<result property="twoRate" column="two_rate"/>
|
||||
<result property="threeRate" column="three_rate"/>
|
||||
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
|
|
@ -24,6 +25,23 @@
|
|||
FROM dept_goods_category
|
||||
</sql>
|
||||
|
||||
<select id="appList" parameterType="com.ghy.goods.domain.DeptGoodsCategory" resultMap="DeptGoodsCategoryResult">
|
||||
SELECT dgc.dept_goods_category_id, dgc.dept_id, dgc.goods_category_id, gc.goods_category_name, gc.parent_category_id, dgc.category_sort,
|
||||
dgc.one_rate, dgc.two_rate, dgc.three_rate, dgc.create_by, dgc.create_time, dgc.remark
|
||||
FROM dept_goods_category dgc
|
||||
LEFT JOIN goods_category gc on gc.goods_category_id = dgc.goods_category_id
|
||||
<where>
|
||||
dgc.dept_id = #{deptId}
|
||||
<if test="goodsCategoryId == null ">
|
||||
and gc.parent_category_id is null
|
||||
</if>
|
||||
<if test="goodsCategoryId != null ">
|
||||
and gc.parent_category_id = #{goodsCategoryId}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
<update id="updateDeptGoodsCategory" parameterType="com.ghy.goods.domain.DeptGoodsCategory">
|
||||
UPDATE dept_goods_category
|
||||
<set>
|
||||
|
|
|
|||
Loading…
Reference in New Issue