diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7b016a8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.compile.nullAnalysis.mode": "automatic" +} \ No newline at end of file diff --git a/common-ruoyi/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java b/common-ruoyi/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java index 439ba22..a568291 100644 --- a/common-ruoyi/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java +++ b/common-ruoyi/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java @@ -1,16 +1,14 @@ package com.ruoyi.common.core.domain.entity; -import java.util.ArrayList; -import java.util.List; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; + import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; - -import lombok.Data; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.core.domain.BaseEntity; +import java.util.ArrayList; +import java.util.List; /** * 部门表 sys_dept @@ -67,6 +65,10 @@ public class SysDept extends BaseEntity // ERP部门编码 private String erpNumber; + // 订单部门ID + private List orderDeptIds; + /** 子部门 */ private List children = new ArrayList(); + } diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 0f1ef03..2ef9da5 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -1,7 +1,6 @@ package com.ruoyi.system.service.impl; import com.alibaba.fastjson2.JSONObject; -import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.entity.SysDept; @@ -49,7 +48,7 @@ public class SysDeptServiceImpl implements ISysDeptService * @return 部门信息集合 */ @Override - @DataScope(deptAlias = "d") + // @DataScope(deptAlias = "d") public List selectDeptList(SysDeptQuery query) { return deptMapper.selectDeptList(query); diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/domain/PriceVO.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/domain/PriceVO.java index 78f07e1..c18142f 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/domain/PriceVO.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/domain/PriceVO.java @@ -18,4 +18,5 @@ public class PriceVO extends Price { @ApiModelProperty("部门名称") private String deptName; + } diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/prodOrder/domain/ProdOrderQuery.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/prodOrder/domain/ProdOrderQuery.java index d700a1c..5a3597b 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/prodOrder/domain/ProdOrderQuery.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/prodOrder/domain/ProdOrderQuery.java @@ -30,4 +30,7 @@ public class ProdOrderQuery extends ProdOrderVO { @ApiModelProperty("排除的ID列表") private List excludeIds; + @ApiModelProperty("用户部门ID") + private Long userDeptId; + } diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/prodOrder/mapper/ProdOrderMapper.xml b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/prodOrder/mapper/ProdOrderMapper.xml index fbb55c8..8c9669b 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/prodOrder/mapper/ProdOrderMapper.xml +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/prodOrder/mapper/ProdOrderMapper.xml @@ -104,9 +104,22 @@ #{item} - ${query.params.dataScope} + AND ( 1=1 ${query.params.dataScope} + + OR ( + + EXISTS ( + SELECT 1 + FROM sys_dept d + WHERE d.dept_id = #{query.userDeptId} + AND FIND_IN_SET(bpo.dept_id, d.order_dept_ids) + ) + ) + + ) + - select d.dept_id from sys_dept d left join sys_role_dept rd on d.dept_id = rd.dept_id @@ -57,8 +74,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by d.parent_id, d.order_num - select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.erp_id, d.erp_number, + d.order_dept_ids, (select dept_name from sys_dept where dept_id = d.parent_id) parent_name from sys_dept d where d.dept_id = #{deptId} @@ -101,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_by, erp_id, erp_number, + order_dept_ids, create_time )values( #{deptId}, @@ -115,6 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createBy}, #{erpId}, #{erpNumber}, + #{orderDeptIds, typeHandler=com.ruoyi.common.mybatis.typehandler.LongSplitListTypeHandler}, sysdate() ) @@ -133,6 +153,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by = #{updateBy}, erp_id = #{erpId}, erp_number = #{erpNumber}, + order_dept_ids = #{orderDeptIds, typeHandler=com.ruoyi.common.mybatis.typehandler.LongSplitListTypeHandler}, update_time = sysdate() where dept_id = #{deptId} diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/yh/ProdOrderController.java b/ruoyi-web/src/main/java/com/ruoyi/web/yh/ProdOrderController.java index 48097f1..35cbc04 100644 --- a/ruoyi-web/src/main/java/com/ruoyi/web/yh/ProdOrderController.java +++ b/ruoyi-web/src/main/java/com/ruoyi/web/yh/ProdOrderController.java @@ -43,6 +43,7 @@ public class ProdOrderController extends BaseController { startPage(); startOrderBy(); + query.setUserDeptId(getDeptId()); List list = prodOrderService.selectProdOrderList(query); return getDataTable(list); } @@ -55,6 +56,7 @@ public class ProdOrderController extends BaseController { ProdOrderQuery query = new ProdOrderQuery(); query.setIds(ids); + query.setUserDeptId(getDeptId()); List list = prodOrderService.selectProdOrderList(query); return success(list); }