Browse Source

修改业务数据隔离功能

oyq28 3 years ago
parent
commit
bec1ee94b7

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/dao/CuttingToolMapper.java

@@ -22,5 +22,5 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface CuttingToolMapper extends SuperMapper<CuttingTool> {
 
-    IPage<CuttingTool> findPage(IPage<CuttingTool> page, @Param(Constants.WRAPPER) LbqWrapper<CuttingTool> wrapper);
+    IPage<CuttingTool> findPage(IPage<CuttingTool> page, @Param(Constants.WRAPPER) LbqWrapper<CuttingTool> wrapper, DataScope dataScope);
 }

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/impl/CuttingToolServiceImpl.java

@@ -51,7 +51,7 @@ public class CuttingToolServiceImpl extends SuperCacheServiceImpl<CuttingToolMap
     @Override
     @InjectionResult
     public IPage<CuttingTool> findPage(IPage<CuttingTool> page, LbqWrapper<CuttingTool> wrapper) {
-        return baseMapper.findPage(page, wrapper);
+        return baseMapper.findPage(page, wrapper, new DataScope());
     }
 
     @Override

+ 2 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/dao/ProductionresourceBizMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.github.zuihou.base.mapper.SuperMapper;
 import com.github.zuihou.business.productionResourceCenter.entity.Productionresource;
+import com.github.zuihou.database.mybatis.auth.DataScope;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
@@ -24,5 +25,5 @@ public interface ProductionresourceBizMapper extends SuperMapper<Productionresou
 
     List<Productionresource> selectResouces(Map queryParams);
 
-    IPage<Productionresource> getPageList(IPage<Productionresource> page,@Param(Constants.WRAPPER) LbqWrapper<Productionresource> wrapper);
+    IPage<Productionresource> getPageList(IPage<Productionresource> page, @Param(Constants.WRAPPER) LbqWrapper<Productionresource> wrapper, DataScope dataScope);
 }

+ 2 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/ProductionresourceBizServiceImpl.java

@@ -10,6 +10,7 @@ import com.github.zuihou.business.productionResourceCenter.entity.Productionreso
 import com.github.zuihou.business.productionResourceCenter.entity.ResourceBusiness;
 import com.github.zuihou.business.productionResourceCenter.service.ProductionresourceBizService;
 import com.github.zuihou.business.productionResourceCenter.service.ResourceBusinessService;
+import com.github.zuihou.database.mybatis.auth.DataScope;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.tenant.service.ProductionresourceService;
@@ -56,7 +57,7 @@ public class ProductionresourceBizServiceImpl extends SuperServiceImpl<Productio
 
     @Override
     public IPage<Productionresource> getPageList(IPage<Productionresource> page, LbqWrapper<Productionresource> wrapper){
-        return baseMapper.getPageList(page, wrapper);
+        return baseMapper.getPageList(page, wrapper, new DataScope());
     }
 
 }

+ 4 - 3
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/operationManagementCenter/TTaskMapper.xml

@@ -112,18 +112,19 @@
     <!-- 分页 -->
     <select id="pageList" resultMap="BaseResultMap">
         select
-        <include refid="Base_Column_List"/>
+        <include refid="Base_Column_List"/>, org_id
         from (
             select a.*,(case when TO_DAYS(NOW())-TO_DAYS(b.end_time) > 0 then '超时' else '否' end)as overtimeStatus,bo.name bomDesc,
             concat(a.expect_start_time,'到',a.expect_end_time) as planTime,d.rated_workHours as
             ratedWorkHours,concat(a.start_time,'到',a.end_time) as actualTime,o.order_name orderName,
-            b.plan_no as planNo,f.name as resourceDesc,d.content,d.prepare_workHours as prepareWorkHours,bo.no as bomNo,d.name as procedureDesc,f.ip,f.port
+            b.plan_no as planNo,f.name as resourceDesc,d.content,d.prepare_workHours as prepareWorkHours,bo.no as bomNo,d.name as procedureDesc,f.ip,f.port,z.org_id
             from imcs_t_task a
             left join imcs_p_plan b on a.plan_id = b.id
             left join imcs_b_bom bo on a.bom_id = bo.id
             left join imcs_b_bom_procedure d on a.procedure_id = d.id
             left join imcs_tenant_productionresource f on a.resource_id = f.id
-             left join imcs_o_order o on a.order_id = o.id
+            left join imcs_o_order o on a.order_id = o.id
+            left join imcs_z_zone z on o.zone_id = z.id
         where 1=1
         <if test="mulPlanStatus != null and mulPlanStatus != ''">
             and b.plan_status in(${mulPlanStatus})

+ 4 - 2
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionReadyCenter/CuttingToolMapper.xml

@@ -19,12 +19,14 @@
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id,create_user,create_time,update_user,update_time,
-        cutting_tool_name, cutting_tool_type, specifications, status,cutting_tool_picture,cutting_tool_install_picture
+        cutting_tool_name, cutting_tool_type, specifications, status,cutting_tool_picture,cutting_tool_install_picture,org_id
     </sql>
 
     <select id="findPage" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM imcs_cutting_tool s ${ew.customSqlSegment}
+        FROM (
+            select t.*, z.org_id from imcs_cutting_tool t  left join imcs_z_zone z on locate(z.abbreviate, left(t.cutting_tool_name,2))
+         ) s ${ew.customSqlSegment}
     </select>
 </mapper>

+ 2 - 2
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionResourceCenter/ProductionresourceBizMapper.xml

@@ -39,7 +39,7 @@
     <sql id="Base_Column_List">
         id,create_time,create_user,update_time,update_user,
         tenant_id, productionline_id, box_id, type, module_id, name, code, status, online_status,remark, resources_type,resources_category,lineDesc,
-        ip,port,capital_no,capital_name,capital_type,mode_specification,capital_price,production_date,production_no,manufacturer,tool_syn_time,tool_num
+        ip,port,capital_no,capital_name,capital_type,mode_specification,capital_price,production_date,production_no,manufacturer,tool_syn_time,tool_num,org_id
     </sql>
 
     <select id="getPageList" resultType="com.github.zuihou.business.productionResourceCenter.entity.Productionresource">
@@ -47,7 +47,7 @@
         <include refid="Base_Column_List"/>
         from (
             SELECT
-                itp.*,izz.name AS lineDesc
+                itp.*,izz.name AS lineDesc, izz.org_id
             FROM imcs_tenant_productionresource itp
             LEFT JOIN imcs_z_zone_productionresource izzp ON itp.id = izzp.resource_id
             LEFT JOIN  imcs_z_zone izz ON izzp.zone_id = izz.id