he2802 пре 2 година
родитељ
комит
1b6058ff8e
98 измењених фајлова са 1013 додато и 213 уклоњено
  1. 18 0
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java
  2. 9 0
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/goods/GoodsController.java
  3. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/ExamMapper.java
  4. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/ExamQuestionMapper.java
  5. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionBusinessMapper.java
  6. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionChapterExamMapper.java
  7. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionChapterMapper.java
  8. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionMapper.java
  9. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionModuleChapterMapper.java
  10. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionModuleMapper.java
  11. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IExamQuestionService.java
  12. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IExamService.java
  13. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionBusinessService.java
  14. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionChapterExamService.java
  15. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionChapterService.java
  16. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionModuleChapterService.java
  17. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionModuleService.java
  18. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionService.java
  19. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamQuestionServiceImpl.java
  20. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamServiceImpl.java
  21. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionBusinessServiceImpl.java
  22. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionChapterExamServiceImpl.java
  23. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionChapterServiceImpl.java
  24. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionModuleChapterServiceImpl.java
  25. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionModuleServiceImpl.java
  26. 4 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java
  27. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/mapper/CertificateCommonMapper.java
  28. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseChapterBusinessMapper.java
  29. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseChapterMapper.java
  30. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseChapterSectionMapper.java
  31. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseEducationTypeMapper.java
  32. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseMenuExamMapper.java
  33. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseMenuMapper.java
  34. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseModuleBusinessMapper.java
  35. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseModuleChapterMapper.java
  36. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseSectionBusinessMapper.java
  37. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseSectionMapper.java
  38. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseSubjectMapper.java
  39. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/MajorProjectMapper.java
  40. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseChapterBusinessService.java
  41. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseChapterSectionService.java
  42. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseChapterService.java
  43. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseMenuExamService.java
  44. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseMenuService.java
  45. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseModuleBusinessService.java
  46. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseModuleChapterService.java
  47. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseSectionBusinessService.java
  48. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseSectionService.java
  49. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/IMajorProjectService.java
  50. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseChapterBusinessServiceImpl.java
  51. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseChapterSectionServiceImpl.java
  52. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseChapterServiceImpl.java
  53. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseMenuExamServiceImpl.java
  54. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseMenuServiceImpl.java
  55. 6 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseModuleBusinessServiceImpl.java
  56. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseModuleChapterServiceImpl.java
  57. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSectionBusinessServiceImpl.java
  58. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSectionServiceImpl.java
  59. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/MajorProjectServiceImpl.java
  60. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/mapper/ExamPaperMapper.java
  61. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/IExamPaperService.java
  62. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamPaperServiceImpl.java
  63. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/domain/GoodsAttached.java
  64. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsAttachedMapper.java
  65. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsCourseMapper.java
  66. 7 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsMapper.java
  67. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsSpecAttributeMapper.java
  68. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsAttachedService.java
  69. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsCourseService.java
  70. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsSpecAttributeService.java
  71. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsAttachedServiceImpl.java
  72. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsCourseServiceImpl.java
  73. 611 207
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java
  74. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsSpecAttributeServiceImpl.java
  75. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/bank/ExamMapper.xml
  76. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/bank/ExamQuestionMapper.xml
  77. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionBusinessMapper.xml
  78. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionChapterExamMapper.xml
  79. 5 0
      zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionChapterMapper.xml
  80. 4 1
      zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionMapper.xml
  81. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionModuleChapterMapper.xml
  82. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionModuleMapper.xml
  83. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterBusinessMapper.xml
  84. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterMapper.xml
  85. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterSectionMapper.xml
  86. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseMenuExamMapper.xml
  87. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseMenuMapper.xml
  88. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseModuleBusinessMapper.xml
  89. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseModuleChapterMapper.xml
  90. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseSectionBusinessMapper.xml
  91. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseSectionMapper.xml
  92. 1 1
      zhongzheng-system/src/main/resources/mapper/modules/course/MajorMapper.xml
  93. 3 0
      zhongzheng-system/src/main/resources/mapper/modules/course/MajorProjectMapper.xml
  94. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/exam/ExamPaperMapper.xml
  95. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsAttachedMapper.xml
  96. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsCourseMapper.xml
  97. 25 1
      zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml
  98. 4 0
      zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsSpecAttributeMapper.xml

+ 18 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java

@@ -1,7 +1,9 @@
 package com.zhongzheng.controller.common;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.zhongzheng.common.config.RuoYiConfig;
 import com.zhongzheng.common.constant.Constants;
 import com.zhongzheng.common.core.domain.AjaxResult;
@@ -36,8 +38,10 @@ import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.order.service.IOrderService;
 import com.zhongzheng.modules.order.service.impl.OrderServiceImpl;
 import com.zhongzheng.modules.system.bo.SysTenantAdminBo;
+import com.zhongzheng.modules.system.domain.SysTenant;
 import com.zhongzheng.modules.system.service.ISysTenantService;
 import com.zhongzheng.modules.system.service.ISysUserService;
+import com.zhongzheng.modules.system.vo.SysTenantVo;
 import com.zhongzheng.modules.user.vo.UserExportVo;
 import com.zhongzheng.modules.wx.bo.WxShareGoodsBo;
 import com.zhongzheng.modules.wx.service.IWxPayService;
@@ -58,6 +62,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 通用请求处理
@@ -297,4 +302,17 @@ public class CommonController
         iSysTenantService.createTenantAdmin(bo);
         return AjaxResult.success();
     }
+
+    @ApiOperation("获取企业列表")
+    @GetMapping("common/tenant/list")
+    public AjaxResult<List<SysTenantVo>> getTenantList() {
+        String tenant = ServletUtils.getRequest().getHeader("TenantId");
+        List<SysTenant> list = iSysTenantService.list();
+        if (CollectionUtils.isEmpty(list)){
+            return AjaxResult.success(new ArrayList<>());
+        }
+        List<SysTenantVo> collect = list.stream().filter(x -> !x.getTenantId().equals(Long.valueOf(tenant)))
+                .map(item -> BeanUtil.toBean(item, SysTenantVo.class)).collect(Collectors.toList());
+        return AjaxResult.success(collect);
+    }
 }

+ 9 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/goods/GoodsController.java

@@ -330,6 +330,15 @@ public class GoodsController extends BaseController {
         return toAjax(iGoodsService.goodsBatchCopyTenant(bo) ? 1 : 0);
     }
 
+    /**
+     * 商品批量复制(新机构)
+     */
+    @ApiOperation("商品批量复制(增量)")
+    @PostMapping("/batch/copy/add")
+    public AjaxResult<Void> goodsBatchCopyAddTenant(@RequestBody GoodsBatchCopyTenantBo bo) {
+        return toAjax(iGoodsService.goodsBatchCopyIncrementTenant(bo) ? 1 : 0);
+    }
+
     /**
      * 商品关系ID处理(全量复制后的处理方法)
      */

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/ExamMapper.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.bank.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.bank.bo.ExamQueryBo;
 import com.zhongzheng.modules.bank.bo.QuestionQueryBo;
@@ -7,6 +8,7 @@ import com.zhongzheng.modules.bank.domain.Exam;
 import com.zhongzheng.modules.bank.vo.ExamVo;
 import com.zhongzheng.modules.bank.vo.QuestionVo;
 import com.zhongzheng.modules.exam.bo.ExamPaperQueryBo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -19,4 +21,7 @@ import java.util.List;
 public interface ExamMapper extends BaseMapper<Exam> {
     List<ExamVo> getList(ExamQueryBo bo);
     List<ExamVo> getPaperExamList(ExamPaperQueryBo bo);
+
+    @InterceptorIgnore(tenantLine = "true")
+    Exam getExamByTenant(@Param("code") String code,@Param("newTenantId") Long newTenantId);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/ExamQuestionMapper.java

@@ -1,11 +1,13 @@
 package com.zhongzheng.modules.bank.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.bank.bo.ExamQuestionQueryBo;
 import com.zhongzheng.modules.bank.bo.QuestionBusinessQueryBo;
 import com.zhongzheng.modules.bank.domain.ExamQuestion;
 import com.zhongzheng.modules.bank.domain.QuestionBusiness;
 import com.zhongzheng.modules.bank.vo.ExamQuestionVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -20,4 +22,6 @@ public interface ExamQuestionMapper extends BaseMapper<ExamQuestion> {
     List<ExamQuestionVo> getAppList(ExamQuestionQueryBo bo);
     List<ExamQuestionVo> getAppTempList(ExamQuestionQueryBo bo);
 
+    @InterceptorIgnore(tenantLine = "true")
+    void deleteByIdAndTenant(@Param("newExamId") Long newExamId,@Param("newTenantId") Long newTenantId);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionBusinessMapper.java

@@ -4,6 +4,7 @@ import com.zhongzheng.modules.bank.bo.QuestionBusinessQueryBo;
 import com.zhongzheng.modules.bank.domain.QuestionBusiness;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.course.domain.CourseChapterBusiness;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -15,4 +16,6 @@ import java.util.List;
  */
 public interface QuestionBusinessMapper extends BaseMapper<QuestionBusiness> {
     List<QuestionBusiness> getListById(QuestionBusinessQueryBo bo);
+
+    void deleteByIdAndTenant(@Param("majorId") Long majorId,@Param("newTenantId") Long newTenantId,@Param("type") Integer type);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionChapterExamMapper.java

@@ -1,11 +1,13 @@
 package com.zhongzheng.modules.bank.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.bank.bo.QuestionChapterExamQueryBo;
 import com.zhongzheng.modules.bank.bo.QuestionModuleChapterQueryBo;
 import com.zhongzheng.modules.bank.domain.QuestionChapterExam;
 import com.zhongzheng.modules.bank.vo.ExamVo;
 import com.zhongzheng.modules.bank.vo.QuestionChapterVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -19,4 +21,7 @@ public interface QuestionChapterExamMapper extends BaseMapper<QuestionChapterExa
     List<ExamVo> getList(QuestionChapterExamQueryBo bo);
 
     List<ExamVo> getDoList(QuestionChapterExamQueryBo bo);
+
+    @InterceptorIgnore(tenantLine = "true")
+    void deleteByIdAndTenant(@Param("newChapterExamId") Long newChapterExamId,@Param("newTenantId") Long newTenantId);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionChapterMapper.java

@@ -1,10 +1,12 @@
 package com.zhongzheng.modules.bank.mapper;
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.bank.bo.ExamQueryBo;
 import com.zhongzheng.modules.bank.bo.QuestionChapterQueryBo;
 import com.zhongzheng.modules.bank.domain.QuestionChapter;
 import com.zhongzheng.modules.bank.vo.ExamVo;
 import com.zhongzheng.modules.bank.vo.QuestionChapterVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -17,4 +19,7 @@ import java.util.List;
 public interface QuestionChapterMapper extends BaseMapper<QuestionChapter> {
     List<QuestionChapterVo> getList(QuestionChapterQueryBo bo);
     QuestionChapterVo getById(Long chapterExamId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    QuestionChapter getChaptereExamByTenant(@Param("code") String code,@Param("newTenantId") Long newTenantId);
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionMapper.java

@@ -34,4 +34,5 @@ public interface QuestionMapper extends BaseMapper<Question> {
 
     List<BankGoodsExamVo> getBankGoodsExamList(@Param("goodsId") Long goodsId);
 
+    Question getQuestionByTenant(@Param("code") String code,@Param("newTenantId") Long newTenantId);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionModuleChapterMapper.java

@@ -1,11 +1,13 @@
 package com.zhongzheng.modules.bank.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.bank.bo.ExamQuestionQueryBo;
 import com.zhongzheng.modules.bank.bo.QuestionModuleChapterQueryBo;
 import com.zhongzheng.modules.bank.domain.QuestionModuleChapter;
 import com.zhongzheng.modules.bank.vo.ExamQuestionVo;
 import com.zhongzheng.modules.bank.vo.QuestionChapterVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -18,4 +20,7 @@ import java.util.List;
 public interface QuestionModuleChapterMapper extends BaseMapper<QuestionModuleChapter> {
     List<QuestionChapterVo> getList(QuestionModuleChapterQueryBo bo);
     List<QuestionChapterVo> getDoList(QuestionModuleChapterQueryBo bo);
+
+    @InterceptorIgnore(tenantLine = "true")
+    void deleteByIdAndTenant(@Param("newModuleExamId") Long newModuleExamId,@Param("newTenantId")  Long newTenantId);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionModuleMapper.java

@@ -1,11 +1,13 @@
 package com.zhongzheng.modules.bank.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.bank.bo.QuestionChapterQueryBo;
 import com.zhongzheng.modules.bank.bo.QuestionModuleQueryBo;
 import com.zhongzheng.modules.bank.domain.QuestionModule;
 import com.zhongzheng.modules.bank.vo.QuestionChapterVo;
 import com.zhongzheng.modules.bank.vo.QuestionModuleVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -17,4 +19,7 @@ import java.util.List;
  */
 public interface QuestionModuleMapper extends BaseMapper<QuestionModule> {
     List<QuestionModuleVo> getList(QuestionModuleQueryBo bo);
+
+    @InterceptorIgnore(tenantLine = "true")
+    QuestionModule getModuleByTenant(@Param("code") String code,@Param("newTenantId") Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IExamQuestionService.java

@@ -55,4 +55,6 @@ public interface IExamQuestionService extends IService<ExamQuestion> {
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    void deleteByIdAndTenant(Long newExamId, Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IExamService.java

@@ -57,4 +57,6 @@ public interface IExamService extends IService<Exam> {
 	List<ExamVo> getPaperExamList(ExamPaperQueryBo bo);
 
     boolean batchDelExam(QuestionBatchDelBo bo);
+
+    Exam getExamByTenant(String code, Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionBusinessService.java

@@ -51,4 +51,6 @@ public interface IQuestionBusinessService extends IService<QuestionBusiness> {
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    void deleteByIdAndTenant(Long newModuleExamId, Long newTenantId,Integer type);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionChapterExamService.java

@@ -54,4 +54,6 @@ public interface IQuestionChapterExamService extends IService<QuestionChapterExa
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    void deleteByIdAndTenant(Long newChapterExamId, Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionChapterService.java

@@ -59,4 +59,6 @@ public interface IQuestionChapterService extends IService<QuestionChapter> {
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
     boolean batchDelChapterExam(QuestionBatchDelBo bo);
+
+	QuestionChapter getChaptereExamByTenant(String code, Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionModuleChapterService.java

@@ -54,4 +54,6 @@ public interface IQuestionModuleChapterService extends IService<QuestionModuleCh
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    void deleteByIdAndTenant(Long newModuleExamId, Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionModuleService.java

@@ -54,4 +54,6 @@ public interface IQuestionModuleService extends IService<QuestionModule> {
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
     boolean batchDelModuleExam(QuestionBatchDelBo bo);
+
+    QuestionModule getModuleByTenant(String code, Long newTenantId);
 }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionService.java

@@ -98,5 +98,5 @@ public interface IQuestionService extends IService<Question> {
 	TodayExamWeekRecordDetailVo getTodayExamWeekRecord(Long goodsId, Long userId);
 
 
-
+    Question getQuestionByTenant(String code, Long newTenantId);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamQuestionServiceImpl.java

@@ -114,4 +114,9 @@ public class ExamQuestionServiceImpl extends ServiceImpl<ExamQuestionMapper, Exa
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    public void deleteByIdAndTenant(Long newExamId, Long newTenantId) {
+        baseMapper.deleteByIdAndTenant(newExamId, newTenantId);
+    }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamServiceImpl.java

@@ -340,4 +340,9 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
                 .set(Exam::getStatus,bo.getStatus())
                 .in(Exam::getExamId,bo.getIds()));
     }
+
+    @Override
+    public Exam getExamByTenant(String code, Long newTenantId) {
+        return baseMapper.getExamByTenant(code, newTenantId);
+    }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionBusinessServiceImpl.java

@@ -106,4 +106,9 @@ public class QuestionBusinessServiceImpl extends ServiceImpl<QuestionBusinessMap
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    public void deleteByIdAndTenant(Long newModuleExamId, Long newTenantId,Integer type) {
+        baseMapper.deleteByIdAndTenant(newModuleExamId, newTenantId,type);
+    }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionChapterExamServiceImpl.java

@@ -113,4 +113,9 @@ public class QuestionChapterExamServiceImpl extends ServiceImpl<QuestionChapterE
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    public void deleteByIdAndTenant(Long newChapterExamId, Long newTenantId) {
+        baseMapper.deleteByIdAndTenant(newChapterExamId, newTenantId);
+    }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionChapterServiceImpl.java

@@ -221,4 +221,9 @@ public class QuestionChapterServiceImpl extends ServiceImpl<QuestionChapterMappe
                 .set(QuestionChapter::getStatus,bo.getStatus())
                 .in(QuestionChapter::getChapterExamId,bo.getIds()));
     }
+
+    @Override
+    public QuestionChapter getChaptereExamByTenant(String code, Long newTenantId) {
+        return baseMapper.getChaptereExamByTenant(code, newTenantId);
+    }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionModuleChapterServiceImpl.java

@@ -111,4 +111,9 @@ public class QuestionModuleChapterServiceImpl extends ServiceImpl<QuestionModule
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    public void deleteByIdAndTenant(Long newModuleExamId, Long newTenantId) {
+        baseMapper.deleteByIdAndTenant(newModuleExamId, newTenantId);
+    }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionModuleServiceImpl.java

@@ -206,4 +206,9 @@ public class QuestionModuleServiceImpl extends ServiceImpl<QuestionModuleMapper,
                 .set(QuestionModule::getUpdateTime,DateUtils.getNowTime())
                 .in(QuestionModule::getModuleExamId,bo.getIds()));
     }
+
+    @Override
+    public QuestionModule getModuleByTenant(String code, Long newTenantId) {
+        return baseMapper.getModuleByTenant(code, newTenantId);
+    }
 }

+ 4 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -1995,7 +1995,10 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
         return result;
     }
 
-
+    @Override
+    public Question getQuestionByTenant(String code, Long newTenantId) {
+        return baseMapper.getQuestionByTenant(code, newTenantId);
+    }
 
 
     private String getPercent(Integer x,Integer y){

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/mapper/CertificateCommonMapper.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.base.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.base.bo.CertificateCommonQueryBo;
 import com.zhongzheng.modules.base.bo.CertificateTpQueryBo;
@@ -19,5 +20,6 @@ import java.util.List;
 public interface CertificateCommonMapper extends BaseMapper<CertificateCommon> {
     List<CertificateCommonVo> getList(CertificateCommonQueryBo bo);
 
+    @InterceptorIgnore(tenantLine = "true")
     CertificateCommon getCertificateByTenant(@Param("code") String code,@Param("newTenantId") Long newTenantId);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseChapterBusinessMapper.java

@@ -1,7 +1,9 @@
 package com.zhongzheng.modules.course.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.course.domain.CourseChapterBusiness;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -14,4 +16,6 @@ import java.util.List;
 public interface CourseChapterBusinessMapper extends BaseMapper<CourseChapterBusiness> {
     List<CourseChapterBusiness> getListById(Long id);
 
+    @InterceptorIgnore(tenantLine = "true")
+    void deleteByIdAndTenant(@Param("chapterId") Long chapterId,@Param("newTenantId") Long newTenantId);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseChapterMapper.java

@@ -1,12 +1,14 @@
 package com.zhongzheng.modules.course.mapper;
 
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.course.bo.CourseChapterQueryBo;
 import com.zhongzheng.modules.course.bo.CourseSectionQueryBo;
 import com.zhongzheng.modules.course.domain.CourseChapter;
 import com.zhongzheng.modules.course.vo.CourseChapterVo;
 import com.zhongzheng.modules.course.vo.CourseSectionVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -19,4 +21,7 @@ import java.util.List;
 public interface CourseChapterMapper extends BaseMapper<CourseChapter> {
     List<CourseChapterVo> selectListByBo(CourseChapterQueryBo bo);
     CourseChapterVo getInfo(Long chapterId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    CourseChapter getChapterByTenant(@Param("code") String code,@Param("newTenantId") Long newTenantId);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseChapterSectionMapper.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.course.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
 import com.zhongzheng.modules.course.domain.CourseChapterBusiness;
@@ -45,4 +46,7 @@ public interface CourseChapterSectionMapper extends BaseMapper<CourseChapterSect
 
     Long getStudyDuration(@Param("typeId") Long typeId,@Param("gradeId") Long gradeId,
                           @Param("userId") Long userId,@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("examId") Long examId,@Param("courseId") Long courseId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    void deleteByIdAndTenant(@Param("chapterId") Long chapterId,@Param("newTenantId") Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseEducationTypeMapper.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.course.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.zhongzheng.modules.base.vo.BaseFilterVo;
 import com.zhongzheng.modules.course.domain.CourseEducationType;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -18,5 +19,6 @@ public interface CourseEducationTypeMapper extends BaseMapper<CourseEducationTyp
    List<CourseEducationTypeVo> selectUserEduList(@Param("userId") Long userId,@Param("goodsType") Integer goodsType);
    List<BaseFilterVo> selectUserAllBusinessList(@Param("userId") Long userId);
 
+    @InterceptorIgnore(tenantLine = "true")
     CourseEducationType getEducationTypeBytenant(@Param("encoder") String encoder,@Param("newTenantId") Long newTenantId);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseMenuExamMapper.java

@@ -1,11 +1,13 @@
 package com.zhongzheng.modules.course.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.course.bo.CourseMenuExamQueryBo;
 import com.zhongzheng.modules.course.bo.CourseQueryBo;
 import com.zhongzheng.modules.course.domain.CourseMenuExam;
 import com.zhongzheng.modules.course.vo.CourseMenuExamVo;
 import com.zhongzheng.modules.course.vo.CourseVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -17,4 +19,7 @@ import java.util.List;
  */
 public interface CourseMenuExamMapper extends BaseMapper<CourseMenuExam> {
     List<CourseMenuExamVo> getList(CourseMenuExamQueryBo bo);
+
+    @InterceptorIgnore(tenantLine = "true")
+    void deleteByIdTenant(@Param("newCourseId") Long newCourseId,@Param("newTenantId") Long newTenantId);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseMenuMapper.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.course.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
 import com.zhongzheng.modules.course.domain.CourseMenu;
@@ -35,4 +36,7 @@ public interface CourseMenuMapper extends BaseMapper<CourseMenu> {
     Integer auditCheck(@Param("sectionId") Long id,@Param("gradeId") Long gradeId,@Param("userId")Long userId,@Param("courseId")Long courseId);
 
     List<CourseUserMenuVo> getGoodsMenuList(CourseMenuQueryBo bo);
+
+    @InterceptorIgnore(tenantLine = "true")
+    void deleteByIdTenant(@Param("newCourseId") Long newCourseId,@Param("newTenantId") Long newTenantId);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseModuleBusinessMapper.java

@@ -1,7 +1,9 @@
 package com.zhongzheng.modules.course.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.course.domain.CourseModuleBusiness;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -13,4 +15,7 @@ import java.util.List;
  */
 public interface CourseModuleBusinessMapper extends BaseMapper<CourseModuleBusiness> {
     List<CourseModuleBusiness> getListById(Long moduleId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    void deleteByIdAndTenant(@Param("moduleId") Long moduleId,@Param("newTenantId") Long newTenantId);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseModuleChapterMapper.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.course.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
 import com.zhongzheng.modules.course.domain.CourseModuleChapter;
@@ -28,4 +29,7 @@ public interface CourseModuleChapterMapper extends BaseMapper<CourseModuleChapte
 
     Integer learningExamCheck(@Param("typeId") Long typeId,@Param("gradeId") Long gradeId,
                               @Param("userId") Long userId,@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("examId") Long examId,@Param("courseId") Long courseId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    void deleteByIdAndTenant(@Param("newModuleId") Long newModuleId,@Param("newTenantId") Long newTenantId);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseSectionBusinessMapper.java

@@ -1,8 +1,10 @@
 package com.zhongzheng.modules.course.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.course.domain.CourseSectionBusiness;
 import com.zhongzheng.modules.course.vo.CourseSectionBusinessVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -15,4 +17,6 @@ import java.util.List;
 public interface CourseSectionBusinessMapper extends BaseMapper<CourseSectionBusiness> {
     List<CourseSectionBusiness> getListById(Long id);
 
+    @InterceptorIgnore(tenantLine = "true")
+    void deleteByIdAndTenant(@Param("sectionId") Long sectionId,@Param("newTenantId")  Long newTenantId);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseSectionMapper.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.course.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.course.bo.CourseSectionQueryBo;
 import com.zhongzheng.modules.course.domain.CourseSection;
@@ -26,4 +27,7 @@ public interface CourseSectionMapper extends BaseMapper<CourseSection> {
     Long checkUserHaveLiveGoods(@Param("userId") Long userId,@Param("goodsId") Long goodsId);
 
     Long checkCrossLiveTime(@Param("startTime") Long startTime,@Param("endTime") Long endTime,@Param("sectionId") Long sectionId,@Param("liveUrl") String liveUrl);
+
+    @InterceptorIgnore(tenantLine = "true")
+    CourseSection getSectionByTenant(@Param("code") String code,@Param("newTenantId") Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseSubjectMapper.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.course.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.zhongzheng.modules.course.bo.CourseProjectTypeQueryBo;
 import com.zhongzheng.modules.course.bo.CourseSubjectQueryBo;
 import com.zhongzheng.modules.course.domain.CourseBusiness;
@@ -28,5 +29,6 @@ public interface CourseSubjectMapper extends BaseMapper<CourseSubject> {
 
     Integer countNum(CourseSubjectQueryBo bo);
 
+    @InterceptorIgnore(tenantLine = "true")
     CourseSubject getSubjectByTenant(@Param("encoder") String encoder,@Param("newTenantId") Long newTenantId);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/MajorProjectMapper.java

@@ -1,7 +1,9 @@
 package com.zhongzheng.modules.course.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.zhongzheng.modules.course.domain.MajorProject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 科目绑定项目Mapper接口
@@ -11,4 +13,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface MajorProjectMapper extends BaseMapper<MajorProject> {
 
+    @InterceptorIgnore(tenantLine = "true")
+    void deleteByIdTenant(@Param("newMajorId") Long newMajorId,@Param("newTenantId") Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseChapterBusinessService.java

@@ -52,4 +52,6 @@ public interface ICourseChapterBusinessService extends IService<CourseChapterBus
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    void deleteByIdAndTenant(Long chapterId, Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseChapterSectionService.java

@@ -60,4 +60,6 @@ public interface ICourseChapterSectionService extends IService<CourseChapterSect
     List<CourseUserChapterSectionVo> sectionList(CourseMenuQueryBo bo);
 
 	List<CourseUserChapterSectionVo> sectionExamList(CourseMenuQueryBo bo);
+
+    void deleteByIdAndTenant(Long chapterId, Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseChapterService.java

@@ -58,4 +58,6 @@ public interface ICourseChapterService extends IService<CourseChapter> {
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
     boolean batchDelChapter(GoodsBatchDelBo bo);
+
+    CourseChapter getChapterByTenant(String code, Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseMenuExamService.java

@@ -51,4 +51,6 @@ public interface ICourseMenuExamService extends IService<CourseMenuExam> {
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    void deleteByIdTenant(Long newCourseId, Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseMenuService.java

@@ -64,4 +64,6 @@ public interface ICourseMenuService extends IService<CourseMenu> {
 	 * @return java.util.List<com.zhongzheng.modules.course.vo.CourseUserMenuVo>
 	 */
 	List<CourseUserMenuVo> getGoodsRebuildMenuList(CourseMenuQueryBo bo);
+
+    void deleteByIdTenant(Long newCourseId, Long newTenantId);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseModuleBusinessService.java

@@ -5,6 +5,7 @@ import com.zhongzheng.modules.course.bo.CourseModuleBusinessAddBo;
 import com.zhongzheng.modules.course.bo.CourseModuleBusinessEditBo;
 import com.zhongzheng.modules.course.bo.CourseModuleBusinessQueryBo;
 import com.zhongzheng.modules.course.domain.CourseChapterBusiness;
+import com.zhongzheng.modules.course.domain.CourseModule;
 import com.zhongzheng.modules.course.domain.CourseModuleBusiness;
 import com.zhongzheng.modules.course.vo.CourseModuleBusinessVo;
 
@@ -52,4 +53,6 @@ public interface ICourseModuleBusinessService extends IService<CourseModuleBusin
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    void deleteByIdAndTenant(Long moduleId, Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseModuleChapterService.java

@@ -54,4 +54,6 @@ public interface ICourseModuleChapterService extends IService<CourseModuleChapte
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
     List<CourseUserModuleChapterVo> chapterList(CourseMenuQueryBo bo);
+
+    void deleteByIdAndTenant(Long newModuleId, Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseSectionBusinessService.java

@@ -53,4 +53,6 @@ public interface ICourseSectionBusinessService extends IService<CourseSectionBus
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    void deleteByIdAndTenant(Long sectionId, Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseSectionService.java

@@ -77,4 +77,6 @@ public interface ICourseSectionService extends IService<CourseSection> {
 	List<LiveGetMessageListResponse.MessageList> GetHistoryChatMsg(CourseSectionQueryBo bo) throws IOException, NoSuchAlgorithmException;
 
     boolean batchDelSection(GoodsBatchDelBo bo);
+
+    CourseSection getSectionByTenant(String code, Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/IMajorProjectService.java

@@ -49,4 +49,6 @@ public interface IMajorProjectService extends IService<MajorProject> {
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    void deleteByIdTenant(Long newMajorId, Long newTenantId);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseChapterBusinessServiceImpl.java

@@ -106,4 +106,9 @@ public class CourseChapterBusinessServiceImpl extends ServiceImpl<CourseChapterB
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    public void deleteByIdAndTenant(Long chapterId, Long newTenantId) {
+        baseMapper.deleteByIdAndTenant(chapterId, newTenantId);
+    }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseChapterSectionServiceImpl.java

@@ -205,4 +205,9 @@ public class CourseChapterSectionServiceImpl extends ServiceImpl<CourseChapterSe
         }
         return examList;
     }
+
+    @Override
+    public void deleteByIdAndTenant(Long chapterId, Long newTenantId) {
+        baseMapper.deleteByIdAndTenant(chapterId, newTenantId);
+    }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseChapterServiceImpl.java

@@ -220,6 +220,11 @@ public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, C
                 .in(CourseChapter::getChapterId,bo.getIds()));
     }
 
+    @Override
+    public CourseChapter getChapterByTenant(String code, Long newTenantId) {
+        return baseMapper.getChapterByTenant(code, newTenantId);
+    }
+
     private boolean checkNameUnique(CourseChapter entity) {
         CourseChapter info = getOne(new LambdaQueryWrapper<CourseChapter>()
                 .eq(CourseChapter::getPrefixName,entity.getPrefixName()).eq(CourseChapter::getName,entity.getName()).last("limit 1"));

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseMenuExamServiceImpl.java

@@ -111,4 +111,9 @@ public class CourseMenuExamServiceImpl extends ServiceImpl<CourseMenuExamMapper,
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    public void deleteByIdTenant(Long newCourseId, Long newTenantId) {
+        baseMapper.deleteByIdTenant(newCourseId, newTenantId);
+    }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseMenuServiceImpl.java

@@ -320,4 +320,9 @@ public class CourseMenuServiceImpl extends ServiceImpl<CourseMenuMapper, CourseM
         }
         return courseMenuVos;
     }
+
+    @Override
+    public void deleteByIdTenant(Long newCourseId, Long newTenantId) {
+        baseMapper.deleteByIdTenant(newCourseId, newTenantId);
+    }
 }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseModuleBusinessServiceImpl.java

@@ -6,6 +6,7 @@ import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.course.bo.CourseModuleBusinessAddBo;
 import com.zhongzheng.modules.course.bo.CourseModuleBusinessEditBo;
 import com.zhongzheng.modules.course.bo.CourseModuleBusinessQueryBo;
+import com.zhongzheng.modules.course.domain.CourseModule;
 import com.zhongzheng.modules.course.domain.CourseModuleBusiness;
 import com.zhongzheng.modules.course.mapper.CourseModuleBusinessMapper;
 import com.zhongzheng.modules.course.service.ICourseModuleBusinessService;
@@ -105,4 +106,9 @@ public class CourseModuleBusinessServiceImpl extends ServiceImpl<CourseModuleBus
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    public void deleteByIdAndTenant(Long moduleId, Long newTenantId) {
+        baseMapper.deleteByIdAndTenant(moduleId, newTenantId);
+    }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseModuleChapterServiceImpl.java

@@ -154,4 +154,9 @@ public class CourseModuleChapterServiceImpl extends ServiceImpl<CourseModuleChap
         }
         return courseUserModuleChapterVos;
     }
+
+    @Override
+    public void deleteByIdAndTenant(Long newModuleId, Long newTenantId) {
+        baseMapper.deleteByIdAndTenant(newModuleId, newTenantId);
+    }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSectionBusinessServiceImpl.java

@@ -106,4 +106,9 @@ public class CourseSectionBusinessServiceImpl extends ServiceImpl<CourseSectionB
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    public void deleteByIdAndTenant(Long sectionId, Long newTenantId) {
+        baseMapper.deleteByIdAndTenant(sectionId, newTenantId);
+    }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSectionServiceImpl.java

@@ -660,6 +660,11 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
                 .in(CourseSection::getSectionId,bo.getIds()));
     }
 
+    @Override
+    public CourseSection getSectionByTenant(String code, Long newTenantId) {
+        return baseMapper.getSectionByTenant(code, newTenantId);
+    }
+
     @Transactional(rollbackFor = Exception.class)
     public String insertByAddBoImport(CourseSectionAddBo bo, String errorLog, Integer no) {
         CourseSection add = BeanUtil.toBean(bo, CourseSection.class);

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/MajorProjectServiceImpl.java

@@ -99,4 +99,9 @@ public class MajorProjectServiceImpl extends ServiceImpl<MajorProjectMapper, Maj
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    public void deleteByIdTenant(Long newMajorId, Long newTenantId) {
+        baseMapper.deleteByIdTenant(newMajorId, newTenantId);
+    }
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/mapper/ExamPaperMapper.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.exam.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.zhongzheng.modules.exam.domain.ExamPaper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.exam.vo.ExamPaperVo;
@@ -19,4 +20,7 @@ public interface ExamPaperMapper extends BaseMapper<ExamPaper> {
     List<ExamPaperVo> getGoodsExamPaperByGoodsIds(@Param("goodsIds") List<Long> goodsIds);
 
     List<ExamPaperVo> getGoodsExamPaperByGoodsId(@Param("goodsId") Long goodsId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    ExamPaper getExamPaperByTenant(@Param("encoder") String encoder,@Param("newTenantId") Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/IExamPaperService.java

@@ -55,4 +55,6 @@ public interface IExamPaperService extends IService<ExamPaper> {
 	List<ExamPaperVo> getGoodsExamPaperByGoodsIds(List<Long> goodsId);
 
 	List<ExamPaperVo> getGoodsExamPaperByGoodsId(Long goodsId);
+
+    ExamPaper getExamPaperByTenant(String encoder, Long newTenantId);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamPaperServiceImpl.java

@@ -138,4 +138,9 @@ public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper
     public List<ExamPaperVo> getGoodsExamPaperByGoodsId(Long goodsId) {
         return this.baseMapper.getGoodsExamPaperByGoodsId(goodsId);
     }
+
+    @Override
+    public ExamPaper getExamPaperByTenant(String encoder, Long newTenantId) {
+        return baseMapper.getExamPaperByTenant(encoder, newTenantId);
+    }
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/domain/GoodsAttached.java

@@ -40,4 +40,6 @@ private static final long serialVersionUID=1L;
     /** 修改时间 */
     @TableField(fill = FieldFill.INSERT_UPDATE)
     private Long updateTime;
+
+    private Long tenantId;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsAttachedMapper.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.goods.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo;
 import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
@@ -22,4 +23,7 @@ public interface GoodsAttachedMapper extends BaseMapper<GoodsAttached> {
     List<GoodsAttachedVo> selectDoList(GoodsAttachedQueryBo bo);
 
     List<GoodsAttachedPaperVo> getPaperIds(@Param("goodsId") Long goodsId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    void deleteByIdTenant(@Param("newGoodsId") Long newGoodsId,@Param("newTenantId") Long newTenantId);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsCourseMapper.java

@@ -26,4 +26,7 @@ public interface GoodsCourseMapper extends BaseMapper<GoodsCourse> {
 
     @InterceptorIgnore(tenantLine = "true")
     List<Long> getCourseIdsByGoodsAndTenant(@Param("goodsId") Long goodsId,@Param("tenantId") Long tenantId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    void deleteByIdTenant(@Param("newGoodsId") Long newGoodsId,@Param("newTenantId") Long newTenantId);
 }

+ 7 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsMapper.java

@@ -51,5 +51,11 @@ public interface GoodsMapper extends BaseMapper<Goods> {
     UserOrderGoodsVo countUserOrderGoods(@Param("goodsId") Long goodsId, @Param("userId") Long userId,@Param("tenantId")Long tenantId);
 
     @InterceptorIgnore(tenantLine = "true")
-    GoodsVo queryGoodsByIdTenant(@Param("goodsId") Long goodsId,@Param("tenantId")Long tenantId);
+    Goods queryGoodsByTenant(@Param("code") String code,@Param("tenantId")Long tenantId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    void updateByTenant(Goods goods);
+
+    @InterceptorIgnore(tenantLine = "true")
+    GoodsVo queryGoodsByIdTenant(@Param("goodsId") Long goodsId,@Param("tenantId") Long tenantId);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsSpecAttributeMapper.java

@@ -24,4 +24,7 @@ public interface GoodsSpecAttributeMapper extends BaseMapper<GoodsSpecAttribute>
 
     @InterceptorIgnore(tenantLine = "true")
     Integer deleteByIdsTenant(@Param("specAttrIds") List<Long> specAttrIds);
+
+    @InterceptorIgnore(tenantLine = "true")
+    GoodsSpecAttribute getSpecAttrByTenant(@Param("name") String name,@Param("createTime") Long createTime,@Param("newTenantId") Long newTenantId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsAttachedService.java

@@ -55,4 +55,6 @@ public interface IGoodsAttachedService extends IService<GoodsAttached> {
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    void deleteByIdTenant(Long newGoodsId, Long newTenantId);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsCourseService.java

@@ -59,4 +59,7 @@ public interface IGoodsCourseService extends IService<GoodsCourse> {
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
     List<Long> getCourseIdsByGoodsAndTenant(Long goodsId, Long trainOrgId);
+
+    void deleteByIdTenant(Long newGoodsId, Long newTenantId);
+
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsSpecAttributeService.java

@@ -55,4 +55,7 @@ public interface IGoodsSpecAttributeService extends IService<GoodsSpecAttribute>
     List<Long> getIdsByTenant(List<Long> specIds);
 
 	void deleteByIdsTenant(List<Long> specAttrIds);
+
+	GoodsSpecAttribute getSpecAttrByTenant(String name, Long createTime, Long newTenantId);
+
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsAttachedServiceImpl.java

@@ -131,4 +131,9 @@ public class GoodsAttachedServiceImpl extends ServiceImpl<GoodsAttachedMapper, G
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    public void deleteByIdTenant(Long newGoodsId, Long newTenantId) {
+        baseMapper.deleteByIdTenant(newGoodsId, newTenantId);
+    }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsCourseServiceImpl.java

@@ -122,4 +122,9 @@ public class GoodsCourseServiceImpl extends ServiceImpl<GoodsCourseMapper, Goods
     public List<Long> getCourseIdsByGoodsAndTenant(Long goodsId, Long trainOrgId) {
         return baseMapper.getCourseIdsByGoodsAndTenant(goodsId,trainOrgId);
     }
+
+    @Override
+    public void deleteByIdTenant(Long newGoodsId, Long newTenantId) {
+        baseMapper.deleteByIdTenant(newGoodsId, newTenantId);
+    }
 }

+ 611 - 207
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.goods.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.ObjectUtil;
@@ -1215,6 +1216,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
     }
 
     @Override
+    @Transactional
     public boolean goodsBatchCopyIncrementTenant(GoodsBatchCopyTenantBo bo) {
         //获取商品信息
         List<Goods> goodsList = list(new LambdaQueryWrapper<Goods>()
@@ -1226,12 +1228,18 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         Long newTenantId = bo.getTenantId();
         List<GoodsSpecAttributeRelation> newRelationList = new ArrayList<>();
         for (Goods goods : goodsList) {
+            Long oldGoodsId = goods.getGoodsId();
+            Long newGoodsId = 0L;
             //判断商品是否存在
-            GoodsVo newGoods = this.baseMapper.queryGoodsByIdTenant(goods.getGoodsId(),newTenantId);
+            Goods newGoods = this.baseMapper.queryGoodsByTenant(goods.getCode(),newTenantId);
             if (ObjectUtils.isNull(newGoods)){
                 //不存在(新增)
                 goods.setGoodsId(null);
-                goods.setTeacherId(newTenantId);
+                goods.setTenantId(newTenantId);
+            }else {
+                //修改
+                goods.setGoodsId(newGoods.getGoodsId());
+                goods.setTenantId(newTenantId);
             }
 
             //供应方ID
@@ -1257,7 +1265,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
                                     payServe.setServeId(null);
                                     payServe.setTenantId(newTenantId);
                                     iPayServeService.save(payServe);
-                                    supply.setServerId(newPayServer.getServeId());
+                                    supply.setServerId(payServe.getServeId());
                                 }
                             }
                         }
@@ -1271,62 +1279,12 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
 
             //教育类型
             if (ObjectUtil.isNotNull(goods.getEducationTypeId())){
-                CourseEducationType type = iCourseEducationTypeService.getById(goods.getEducationTypeId());
-                if (ObjectUtil.isNotNull(type)){
-                    CourseEducationType newType = iCourseEducationTypeService.getEducationTypeBytenant(type.getEncoder(),newTenantId);
-                    if (ObjectUtil.isNotNull(newType)){
-                        goods.setEducationTypeId(newType.getId());
-                    }else {
-                        type.setId(null);
-                        type.setTenantId(newTenantId);
-                        iCourseEducationTypeService.save(type);
-                        goods.setEducationTypeId(type.getId());
-                    }
-                }
+                goods.setEducationTypeId(getNewEducationTypeId(goods.getEducationTypeId(),newTenantId));
             }
 
             //业务层次
             if (ObjectUtil.isNotNull(goods.getBusinessId())){
-                CourseBusiness business = iCourseBusinessService.getById(goods.getBusinessId());
-                if (ObjectUtil.isNotNull(business)){
-                    CourseBusiness newBusiness = iCourseBusinessService.getBusinessByTenant(business.getEncoder(),newTenantId);
-                    if (ObjectUtil.isNotNull(newBusiness)){
-                        goods.setBusinessId(newBusiness.getId());
-                    }else {
-                        business.setId(null);
-                        business.setTenantId(newTenantId);
-                        //项目ID
-                        if (ObjectUtils.isNotNull(business.getProjectId())){
-                            CourseProjectType projectType = iCourseProjectTypeService.getById(business.getProjectId());
-                            if (ObjectUtil.isNotNull(projectType)){
-                                CourseProjectType newProject = iCourseProjectTypeService.getProjectByTenant(projectType.getEncoder(), newTenantId);
-                                if (ObjectUtil.isNotNull(newProject)){
-                                    business.setProjectId(newProject.getId().intValue());
-                                }else {
-                                    //新增项目
-                                    //判断项目的教育类型是否存在
-                                    CourseEducationType educationType = iCourseEducationTypeService.getById(projectType.getEducationId());
-                                    CourseEducationType newEducationType = iCourseEducationTypeService.getEducationTypeBytenant(educationType.getEncoder(), newTenantId);
-                                    if (ObjectUtil.isNotNull(newEducationType)){
-                                        projectType.setEducationId(newEducationType.getId().intValue());
-                                    }else {
-                                        educationType.setId(null);
-                                        educationType.setTenantId(newTenantId);
-                                        iCourseEducationTypeService.save(educationType);
-                                        projectType.setEducationId(educationType.getId().intValue());
-                                    }
-                                    projectType.setId(null);
-                                    projectType.setTenantId(newTenantId);
-                                    iCourseProjectTypeService.save(projectType);
-                                    business.setProjectId(projectType.getId().intValue());
-                                }
-                            }
-                        }
-                        iCourseBusinessService.save(business);
-                        goods.setBusinessId(business.getId());
-                    }
-
-                }
+                goods.setBusinessId(getNewBusinessId(goods.getBusinessId(),newTenantId));
             }
 
             //所属院校
@@ -1347,45 +1305,12 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
 
             //所属专业
             if (ObjectUtil.isNotNull(goods.getMajorId())){
-                Major major = iMajorService.getById(goods.getMajorId());
-                if (ObjectUtil.isNotNull(major)){
-                    Major newMajor = iMajorService.getMajorByTenant(major.getEncoder(),newTenantId);
-                    if (ObjectUtil.isNotNull(newMajor)){
-                        goods.setMajorId(newMajor.getId());
-                    }else {
-                        major.setId(null);
-                        major.setTenantId(newTenantId);
-                        iMajorService.save(major);
-                        goods.setMajorId(major.getId());
-                    }
-                }
+                goods.setMajorId(getNewMajorId(goods.getMajorId(),newTenantId));
             }
 
             //项目
             if (ObjectUtil.isNotNull(goods.getProjectId())){
-                CourseProjectType project = iCourseProjectTypeService.getById(goods.getProjectId());
-                if (ObjectUtil.isNotNull(project)){
-                    CourseProjectType newProject = iCourseProjectTypeService.getProjectByTenant(project.getEncoder(),newTenantId);
-                    if (ObjectUtil.isNotNull(newProject)){
-                        goods.setProjectId(newProject.getId().intValue());
-                    }else {
-                        project.setId(null);
-                        project.setTenantId(newTenantId);
-                        //判断项目的教育类型是否存在
-                        CourseEducationType educationType = iCourseEducationTypeService.getById(project.getEducationId());
-                        CourseEducationType newEducationType = iCourseEducationTypeService.getEducationTypeBytenant(educationType.getEncoder(), newTenantId);
-                        if (ObjectUtil.isNotNull(newEducationType)){
-                            project.setEducationId(newEducationType.getId().intValue());
-                        }else {
-                            educationType.setId(null);
-                            educationType.setTenantId(newTenantId);
-                            iCourseEducationTypeService.save(educationType);
-                            project.setEducationId(educationType.getId().intValue());
-                        }
-                        iCourseProjectTypeService.save(project);
-                        goods.setProjectId(project.getId().intValue());
-                    }
-                }
+                goods.setProjectId(getNewProjectTypeId(goods.getProjectId().longValue(),newTenantId).intValue());
             }
 
             //讲义
@@ -1451,127 +1376,192 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
 
             //证书模板
             if (ObjectUtils.isNotNull(goods.getCertificateTpId())){
-                CertificateTp certificateTp = iCertificateTpService.getById(goods.getCertificateTpId());
-                if (ObjectUtils.isNotNull(certificateTp)){
-                    CertificateTp newCertificateTp =iCertificateTpService.getCertificateTpByTenant(certificateTp.getCode(),newTenantId);
-                    if (ObjectUtils.isNotNull(newCertificateTp)){
-                        goods.setCertificateTpId(newCertificateTp.getTpId());
-                    }else {
-                        certificateTp.setTpId(null);
-                        certificateTp.setTenantId(newTenantId);
-                        certificateTp.setCertificateId(getNewCertificateId(certificateTp.getCertificateId(),newTenantId));
-                        certificateTp.setTpId(getNewCertificateTypeId(certificateTp.getTpId(),newTenantId));
-                        iCertificateTpService.save(certificateTp);
-                        goods.setCertificateTpId(certificateTp.getTpId());
-                    }
-                }
+                goods.setCertificateTpId(getNewCertificateTpId(goods.getCertificateTpId(),newTenantId));
             }
 
             //规格模板
             if (ObjectUtils.isNotNull(goods.getSpecTemplateId())){
-                List<GoodsSpecAttributeRelation> attributeRelationList = goodsSpecAttributeRelationService
-                        .list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
-                        .eq(GoodsSpecAttributeRelation::getGoodsId, goods.getGoodsId()));
-                if (CollectionUtils.isNotEmpty(attributeRelationList)){
-                    for (GoodsSpecAttributeRelation relation : attributeRelationList) {
-                        GoodsSpecTemplate specTemplate = goodsSpecTemplateService.getById(relation.getSpecTemplateId());
-                        GoodsSpecTemplate newSpecTemplate = goodsSpecTemplateService.getSpecTpByTenant(specTemplate.getName(),specTemplate.getCreateTime(),newTenantId);
-                       if (ObjectUtils.isNotNull(newSpecTemplate)){
-                           //更新
-                           List<Long> specIds = goodsSpecService.getIdsByTenant(newSpecTemplate.getSpecTemplateId(),newTenantId);
-                           if (CollectionUtils.isNotEmpty(specIds)){
-                               //删除关联信息
-                               List<Long> specAttrIds = goodsSpecAttributeService.getIdsByTenant(specIds);
-                                if (CollectionUtils.isNotEmpty(specAttrIds)){
-                                    goodsSpecAttributeService.deleteByIdsTenant(specAttrIds);
-                                    goodsSpecAttributeRelationService.deleteByTemplateIdTenant(newSpecTemplate.getSpecTemplateId(),newTenantId);
-                                }
-                               goodsSpecService.deleteByIdsTenant(specIds);
-                           }
-                           //新增关联
-                           List<GoodsSpec> specList = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>()
-                                   .eq(GoodsSpec::getSpecTemplateId, specTemplate.getSpecTemplateId()));
-                           if (CollectionUtils.isNotEmpty(specList)){
-                               specList.forEach(item -> {
-                                   Long oldSpecId = item.getSpecId();
-                                   item.setSpecId(null);
-                                   item.setSpecTemplateId(newSpecTemplate.getSpecTemplateId());
-                                   item.setTenantId(newTenantId);
-                                   goodsSpecService.save(item);
-                                   List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService
-                                           .list(new LambdaQueryWrapper<GoodsSpecAttribute>()
-                                           .eq(GoodsSpecAttribute::getSpecId, oldSpecId));
-                                    if (CollectionUtils.isNotEmpty(specAttributeList)){
-                                        List<GoodsSpecAttributeRelation> relationList = goodsSpecAttributeRelationService
-                                                .list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
-                                                .eq(GoodsSpecAttributeRelation::getSpecTemplateId, specTemplate.getSpecTemplateId()));
-                                        if (CollectionUtils.isNotEmpty(relationList)){
-                                            newRelationList.addAll(relationList);
-                                        }
-                                        List<GoodsSpecAttribute> collect = specAttributeList.stream().map(attrItem -> {
-                                            attrItem.setSpecAttributeId(null);
-                                            attrItem.setSpecId(item.getSpecId());
-                                            attrItem.setTenantId(newTenantId);
-                                            return attrItem;
-                                        }).collect(Collectors.toList());
-                                        goodsSpecAttributeService.saveBatch(collect);
-                                    }
-                               });
-                           }
-
-                       }else {
-                           Long oldSpecTemplateId = specTemplate.getSpecTemplateId();
-                           //新增
-                           specTemplate.setSpecTemplateId(null);
-                           specTemplate.setTenantId(newTenantId);
-                           goodsSpecTemplateService.save(specTemplate);
-                           //新增关联
-                           List<GoodsSpec> specList = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>()
-                                   .eq(GoodsSpec::getSpecTemplateId, oldSpecTemplateId));
-                           if (CollectionUtils.isNotEmpty(specList)){
-                               specList.forEach(item -> {
-                                   Long oldSpecId = item.getSpecId();
-                                   item.setSpecId(null);
-                                   item.setSpecTemplateId(specTemplate.getSpecTemplateId());
-                                   item.setTenantId(newTenantId);
-                                   goodsSpecService.save(item);
-                                   List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService
-                                           .list(new LambdaQueryWrapper<GoodsSpecAttribute>()
-                                                   .eq(GoodsSpecAttribute::getSpecId, oldSpecId));
-                                   if (CollectionUtils.isNotEmpty(specAttributeList)){
-                                       List<GoodsSpecAttributeRelation> relationList = goodsSpecAttributeRelationService
-                                               .list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
-                                                       .eq(GoodsSpecAttributeRelation::getSpecTemplateId,oldSpecTemplateId));
-                                       if (CollectionUtils.isNotEmpty(relationList)){
-                                           newRelationList.addAll(relationList);
-                                       }
-                                       List<GoodsSpecAttribute> collect = specAttributeList.stream().map(attrItem -> {
-                                           attrItem.setSpecAttributeId(null);
-                                           attrItem.setSpecId(item.getSpecId());
-                                           attrItem.setTenantId(newTenantId);
-                                           return attrItem;
-                                       }).collect(Collectors.toList());
-                                       goodsSpecAttributeService.saveBatch(collect);
-                                   }
-                               });
-                           }
-                       }
+                Long oldSpecTemplateId = goods.getSpecTemplateId();
+                Long newSpecTemplateId = 0L;
+                GoodsSpecTemplate specTemplate = goodsSpecTemplateService.getById(oldSpecTemplateId);
+                GoodsSpecTemplate newSpecTemplate = goodsSpecTemplateService.getSpecTpByTenant(specTemplate.getName(),specTemplate.getCreateTime(),newTenantId);
+                if (ObjectUtils.isNotNull(newSpecTemplate)){
+                    //更新
+                    List<Long> specIds = goodsSpecService.getIdsByTenant(newSpecTemplate.getSpecTemplateId(),newTenantId);
+                    if (CollectionUtils.isNotEmpty(specIds)){
+                        //删除关联信息
+                        List<Long> specAttrIds = goodsSpecAttributeService.getIdsByTenant(specIds);
+                        if (CollectionUtils.isNotEmpty(specAttrIds)){
+                            goodsSpecAttributeService.deleteByIdsTenant(specAttrIds);
+                            goodsSpecAttributeRelationService.deleteByTemplateIdTenant(newSpecTemplate.getSpecTemplateId(),newTenantId);
+                        }
+                        goodsSpecService.deleteByIdsTenant(specIds);
+                    }
+                    newSpecTemplateId = newSpecTemplate.getSpecTemplateId();
+                }else {
+                    //新增
+                    specTemplate.setEducationTypeId(getNewEducationTypeId(specTemplate.getEducationTypeId(),newTenantId));
+                    specTemplate.setBusinessId(getNewBusinessId(specTemplate.getBusinessId(), newTenantId));
+                    specTemplate.setSpecTemplateId(null);
+                    specTemplate.setTenantId(newTenantId);
+                    goodsSpecTemplateService.save(specTemplate);
+                    newSpecTemplateId = specTemplate.getSpecTemplateId();
 
+                }
+
+                //新增关联
+                List<GoodsSpec> specList = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>()
+                        .eq(GoodsSpec::getSpecTemplateId, oldSpecTemplateId));
+                if (CollectionUtils.isNotEmpty(specList)){
+                    for (GoodsSpec item : specList) {
+                        Long oldSpecId = item.getSpecId();
+                        item.setSpecId(null);
+                        item.setSpecTemplateId(newSpecTemplateId);
+                        item.setTenantId(newTenantId);
+                        goodsSpecService.save(item);
+                        List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService
+                                .list(new LambdaQueryWrapper<GoodsSpecAttribute>()
+                                        .eq(GoodsSpecAttribute::getSpecId, oldSpecId));
+                        if (CollectionUtils.isNotEmpty(specAttributeList)){
+                            List<GoodsSpecAttribute> collect = specAttributeList.stream().map(attrItem -> {
+                                attrItem.setSpecAttributeId(null);
+                                attrItem.setSpecId(item.getSpecId());
+                                attrItem.setTenantId(newTenantId);
+                                return attrItem;
+                            }).collect(Collectors.toList());
+                            goodsSpecAttributeService.saveBatch(collect);
+                        }
                     }
                 }
+                //模板属性值关联
+                List<GoodsSpecAttributeRelation> relationList = goodsSpecAttributeRelationService
+                        .list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
+                                .eq(GoodsSpecAttributeRelation::getSpecTemplateId,oldSpecTemplateId));
+                if (CollectionUtils.isNotEmpty(relationList)){
+                    newRelationList.addAll(relationList);
+                }
+                goods.setSpecTemplateId(newSpecTemplateId);
+            }
 
+            if (ObjectUtils.isNull(goods.getGoodsId())){
+                //新增
+                save(goods);
+            }else {
+                //修改
+                baseMapper.updateByTenant(goods);
             }
+            newGoodsId = goods.getGoodsId();
 
             //商品课程
+            List<CourseMenuExam> newCourseMenuExamList = new ArrayList<>();
+            disposeGoodsCourse(oldGoodsId,newGoodsId,newTenantId,newCourseMenuExamList);
+            //商品试卷
+            disposeGoodsAttached(oldGoodsId,newGoodsId,newTenantId);
+
+            //处理商品试卷
+            if (CollectionUtils.isNotEmpty(newCourseMenuExamList)){
+                for (CourseMenuExam menuExam : newCourseMenuExamList) {
+                    menuExam.setExamId(getNewExamId(menuExam.getExamId(),newTenantId));
+                }
+                iCourseMenuExamService.saveBatch(newCourseMenuExamList);
+            }
+        }
+
+        //规格模板商品重新绑定
+        if (CollectionUtils.isNotEmpty(newRelationList)){
+            for (GoodsSpecAttributeRelation relation : newRelationList) {
+                relation.setId(null);
+                relation.setTenantId(newTenantId);
+                //模板ID
+                if (ObjectUtils.isNotNull(relation.getSpecTemplateId())){
+                    GoodsSpecTemplate specTemplate = goodsSpecTemplateService.getById(relation.getSpecTemplateId());
+                    GoodsSpecTemplate newSpecTemplate = goodsSpecTemplateService.getSpecTpByTenant(specTemplate.getName(),specTemplate.getCreateTime(),newTenantId);
+                    if (ObjectUtils.isNotNull(newSpecTemplate)){
+                        relation.setSpecTemplateId(newSpecTemplate.getSpecTemplateId());
+                    }else {
+                        relation.setSpecTemplateId(null);
+                    }
+                }
 
+                //商品ID
+                if (ObjectUtils.isNotNull(relation.getGoodsId())){
+                    Goods goods = getById(relation.getGoodsId());
+                    Goods newGoods = baseMapper.queryGoodsByTenant(goods.getCode(),newTenantId);
+                    if (ObjectUtils.isNotNull(newGoods)){
+                        relation.setGoodsId(newGoods.getGoodsId());
+                    }else {
+                        relation.setGoodsId(null);
+                    }
+                }
+
+                //规格属性IDS
+                if (StringUtils.isNotBlank(relation.getSpecAttributeIds())){
+                    List<Long> ids = Arrays.asList(relation.getSpecAttributeIds().split(",")).stream().map(x -> Long.valueOf(x)).collect(Collectors.toList());
+                    List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService.listByIds(ids);
+                    if (CollectionUtils.isNotEmpty(specAttributeList)){
+                        List<Long> newIds = new ArrayList<>();
+                        specAttributeList.forEach(item -> {
+                            GoodsSpecAttribute newSpecAttribute = goodsSpecAttributeService.getSpecAttrByTenant(item.getName(),item.getCreateTime(),newTenantId);
+                            if (ObjectUtils.isNotNull(newSpecAttribute)){
+                                newIds.add(newSpecAttribute.getSpecAttributeId());
+                            }
+                        });
+                        if (CollectionUtils.isNotEmpty(newIds)){
+                            relation.setSpecAttributeIds(newIds.stream().map(x -> x.toString()).collect(Collectors.joining(",")));
+                        }
+                    }
+                }
+            }
+
+            goodsSpecAttributeRelationService.saveBatch(newRelationList);
         }
-        return false;
+
+        return true;
+    }
+
+    private void disposeGoodsAttached(Long oldGoodsId,Long newGoodsId,Long newTenantId){
+        List<GoodsAttached> goodsAttached = iGoodsAttachedService
+                .list(new LambdaQueryWrapper<GoodsAttached>()
+                .eq(GoodsAttached::getGoodsId, oldGoodsId));
+        if (CollectionUtils.isEmpty(goodsAttached)){
+          return;
+        }
+
+        iGoodsAttachedService.deleteByIdTenant(newGoodsId,newTenantId);
+        //题库
+        for (GoodsAttached attached : goodsAttached) {
+            attached.setId(null);
+            attached.setTenantId(newTenantId);
+            attached.setGoodsId(newGoodsId);
+            Long majorId = attached.getMajorId();
+            switch (attached.getType()){
+                case 1:
+                    //模块卷
+                    attached.setMajorId(getNewModuleExamId(majorId,newTenantId));
+                    break;
+                case 2:
+                    //章卷
+                    attached.setMajorId(getNewChapterExamId(majorId,newTenantId));
+                    break;
+                case 3:
+                    //试卷
+                    attached.setMajorId(getNewExamId(majorId,newTenantId));
+                    break;
+            }
+        }
+        iGoodsAttachedService.saveBatch(goodsAttached);
+
     }
 
-    private void disposeGoodsCourse(Goods goods,Long newTenantId){
+    private void disposeGoodsCourse(Long oldGoodsId,Long newGoodsId,Long newTenantId,List<CourseMenuExam> menuExamList){
         List<GoodsCourse> goodsCourseList = iGoodsCourseService
                 .list(new LambdaQueryWrapper<GoodsCourse>()
-                .eq(GoodsCourse::getGoodsId, goods.getGoodsId()));
+                .eq(GoodsCourse::getGoodsId, oldGoodsId));
+        if (CollectionUtils.isEmpty(goodsCourseList)){
+            return;
+        }
+        //删除之前关联重新添加
+        iGoodsCourseService.deleteByIdTenant(newGoodsId,newTenantId);
         for (GoodsCourse goodsCourse : goodsCourseList) {
             Course course = iCourseService.getById(goodsCourse.getCourseId());
             if(ObjectUtils.isNotNull(course)){
@@ -1591,31 +1581,409 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
                     iCourseService.save(course);
                     newCourseId = course.getCourseId();
                 }
-                List<CourseMenu> courseMenuList = iCourseMenuService.list(new LambdaQueryWrapper<CourseMenu>()
-                        .eq(CourseMenu::getCourseId, oldCourseId));
+                //商品课程关联
+                iCourseMenuService.deleteByIdTenant(newCourseId,newTenantId);
+                List<CourseMenu> courseMenuList = iCourseMenuService
+                        .list(new LambdaQueryWrapper<CourseMenu>()
+                        .eq(CourseMenu::getCourseId, oldCourseId)
+                        .eq(CourseMenu::getStatus,1));
                 if (CollectionUtils.isNotEmpty(courseMenuList)){
                     for (CourseMenu courseMenu : courseMenuList) {
+                        courseMenu.setId(null);
+                        courseMenu.setTenantId(newTenantId);
                         courseMenu.setCourseId(newCourseId);
                         Long menuId = courseMenu.getMenuId();
                         switch (courseMenu.getType()){
                             case 1:
                                 //模块
-                                CourseModule module = iCourseModuleService.getById(menuId);
-                                if (ObjectUtils.isNotNull(module)){
-                                    CourseModule newModule = iCourseModuleService.getModuleByTenant(module.getCode(),newTenantId);
-                                    if (ObjectUtils.isNotNull(newModule)){
-                                        courseMenu.setMenuId(newModule.getTenantId());
-                                    }
-                                }
-
+                                courseMenu.setMenuId(getNewModuleId(menuId,newTenantId));
+                                break;
+                            case 2:
+                                //章
+                                courseMenu.setMenuId(getNewChapterId(menuId,newTenantId));
+                                break;
+                            case 3:
+                                //节
+                                courseMenu.setMenuId(getNewSectionId(menuId,newTenantId));
+                                break;
                         }
                     }
+                    iCourseMenuService.saveBatch(courseMenuList);
+                }
+
+                goodsCourse.setId(null);
+                goodsCourse.setCourseId(newCourseId);
+                goodsCourse.setGoodsId(newGoodsId);
+                goodsCourse.setTenantId(newTenantId);
+                iGoodsCourseService.save(goodsCourse);
+
+                //课程试卷
+                iCourseMenuExamService.deleteByIdTenant(newCourseId,newTenantId);
+                List<CourseMenuExam> courseMenuExamList = iCourseMenuExamService
+                        .list(new LambdaQueryWrapper<CourseMenuExam>()
+                        .eq(CourseMenuExam::getCourseId, oldCourseId));
+                if (CollectionUtils.isNotEmpty(courseMenuExamList)){
+                    for (CourseMenuExam item : courseMenuExamList) {
+                        item.setId(null);
+                        item.setCourseId(newCourseId);
+                        item.setModuleId(getNewModuleId(item.getModuleId(),newTenantId));
+                        item.setChapterId(getNewChapterId(item.getChapterId(),newTenantId));
+                        item.setSectionId(getNewSectionId(item.getSectionId(),newTenantId));
+                        item.setTenantId(newTenantId);
+                    }
+                    menuExamList.addAll(courseMenuExamList);
                 }
             }
         }
 
     }
 
+    private Long getNewModuleExamId(Long moduleExamId,Long newTenantId){
+        QuestionModule questionModule = iQuestionModuleService.getById(moduleExamId);
+        if (ObjectUtils.isNotNull(questionModule)){
+            Long oldModuleExamId = questionModule.getModuleExamId();
+            Long newModuleExamId = 0L;
+            QuestionModule newQuestionModule = iQuestionModuleService.getModuleByTenant(questionModule.getCode(),newTenantId);
+            if (ObjectUtils.isNotNull(newQuestionModule)){
+                newModuleExamId = newQuestionModule.getTenantId();
+            }else {
+                questionModule.setModuleExamId(null);
+                questionModule.setTenantId(newTenantId);
+                iQuestionModuleService.save(questionModule);
+                newModuleExamId = questionModule.getModuleExamId();
+            }
+
+            //删除之前的关联
+            iQuestionBusinessService.deleteByIdAndTenant(newModuleExamId,newTenantId,4);
+            //新关联
+            List<QuestionBusiness> questionBusinessList = iQuestionBusinessService
+                    .list(new LambdaQueryWrapper<QuestionBusiness>()
+                            .eq(QuestionBusiness::getMajorId, oldModuleExamId)
+                            .eq(QuestionBusiness::getType,4));
+            if (CollectionUtils.isNotEmpty(questionBusinessList)){
+                for (QuestionBusiness item : questionBusinessList) {
+                    item.setId(null);
+                    item.setTenantId(newTenantId);
+                    item.setEducationTypeId(getNewEducationTypeId(item.getEducationTypeId(), newTenantId));
+                    item.setBusinessId(getNewBusinessId(item.getBusinessId(), newTenantId));
+                    item.setSubjectId(getNewSubjectId(item.getSubjectId(), newTenantId));
+                    item.setProjectId(getNewProjectTypeId(item.getProjectId(), newTenantId));
+                    item.setMajorId(newModuleExamId);
+                }
+                iQuestionBusinessService.saveBatch(questionBusinessList);
+            }
+
+            //模块章卷
+            iQuestionModuleChapterService.deleteByIdAndTenant(newModuleExamId,newTenantId);
+            List<QuestionModuleChapter> questionModuleChapterList = iQuestionModuleChapterService
+                    .list(new LambdaQueryWrapper<QuestionModuleChapter>()
+                            .eq(QuestionModuleChapter::getModuleExamId, oldModuleExamId));
+            if (CollectionUtils.isNotEmpty(questionModuleChapterList)){
+                for (QuestionModuleChapter item : questionModuleChapterList) {
+                    item.setId(null);
+                    item.setModuleExamId(newModuleExamId);
+                    item.setTenantId(newTenantId);
+                    item.setChapterExamId(getNewChapterExamId(item.getChapterExamId(),newTenantId));
+                }
+                iQuestionModuleChapterService.saveBatch(questionModuleChapterList);
+            }
+            return newModuleExamId;
+        }
+        return null;
+    }
+    private Long getNewChapterExamId(Long oldChapterExamId,Long newTenantId){
+        QuestionChapter questionChapter = iQuestionChapterService.getOne(new LambdaQueryWrapper<QuestionChapter>().eq(QuestionChapter::getChapterExamId,oldChapterExamId));
+        if (ObjectUtils.isNotNull(questionChapter)){
+            Long newChapterExamId = 0L;
+            QuestionChapter newQuestionChapter = iQuestionChapterService.getChaptereExamByTenant(questionChapter.getCode(),newTenantId);
+            if (ObjectUtils.isNotNull(newQuestionChapter)){
+                newChapterExamId = newQuestionChapter.getChapterExamId();
+            }else {
+                questionChapter.setChapterExamId(null);
+                questionChapter.setTenantId(newTenantId);
+                iQuestionChapterService.save(questionChapter);
+                newChapterExamId = questionChapter.getChapterExamId();
+            }
+
+            //删除之前的关联
+            iQuestionBusinessService.deleteByIdAndTenant(newChapterExamId,newTenantId,3);
+            //新关联
+            List<QuestionBusiness> questionBusinessList = iQuestionBusinessService
+                    .list(new LambdaQueryWrapper<QuestionBusiness>()
+                            .eq(QuestionBusiness::getMajorId, oldChapterExamId)
+                            .eq(QuestionBusiness::getType,3));
+            if (CollectionUtils.isNotEmpty(questionBusinessList)){
+                for (QuestionBusiness item : questionBusinessList) {
+                    item.setId(null);
+                    item.setMajorId(newChapterExamId);
+                    item.setTenantId(newTenantId);
+                    item.setEducationTypeId(getNewEducationTypeId(item.getEducationTypeId(), newTenantId));
+                    item.setBusinessId(getNewBusinessId(item.getBusinessId(), newTenantId));
+                    item.setSubjectId(getNewSubjectId(item.getSubjectId(), newTenantId));
+                    item.setProjectId(getNewProjectTypeId(item.getProjectId(), newTenantId));
+                }
+                iQuestionBusinessService.saveBatch(questionBusinessList);
+            }
+
+            //章试卷
+            iQuestionChapterExamService.deleteByIdAndTenant(newChapterExamId,newTenantId);
+            List<QuestionChapterExam> questionChapterExamList = iQuestionChapterExamService
+                    .list(new LambdaQueryWrapper<QuestionChapterExam>()
+                            .eq(QuestionChapterExam::getChapterExamId, oldChapterExamId));
+            if (CollectionUtils.isNotEmpty(questionChapterExamList)){
+                for (QuestionChapterExam item : questionChapterExamList) {
+                    item.setId(null);
+                    item.setChapterExamId(newChapterExamId);
+                    item.setTenantId(newTenantId);
+                    item.setExamId(getNewExamId(item.getExamId(),newTenantId));
+                }
+                iQuestionChapterExamService.saveBatch(questionChapterExamList);
+            }
+            return newChapterExamId;
+        }
+        return null;
+    }
+    private Long getNewExamId(Long oldExamId,Long newTenantId){
+        Exam exam = iExamService.getById(oldExamId);
+        if (ObjectUtils.isNotNull(exam)){
+            Long newExamId = 0L;
+            Exam newExam = iExamService.getExamByTenant(exam.getCode(),newTenantId);
+            if (ObjectUtils.isNotNull(newExam)){
+                newExamId = newExam.getExamId();
+            }else {
+                //试卷类型
+                ExamPaper examPaper = iExamPaperService.getById(exam.getExamPaperId());
+                if (ObjectUtils.isNotNull(examPaper)){
+                    ExamPaper newExamPaper = iExamPaperService.getExamPaperByTenant(examPaper.getEncoder(),newTenantId);
+                    if (ObjectUtils.isNotNull(newExamPaper)){
+                        exam.setExamPaperId(newExamPaper.getPaperId());
+                    }else {
+                        examPaper.setPaperId(null);
+                        examPaper.setTenantId(newTenantId);
+                        iExamPaperService.save(examPaper);
+                        exam.setExamPaperId(examPaper.getPaperId());
+                    }
+                }
+                exam.setExamId(null);
+                exam.setTenantId(newTenantId);
+                iExamService.save(exam);
+                newExamId = exam.getExamId();
+            }
+
+            //删除之前的关联
+            iQuestionBusinessService.deleteByIdAndTenant(newExamId,newTenantId,2);
+            //新关联
+            List<QuestionBusiness> questionBusinessList = iQuestionBusinessService
+                    .list(new LambdaQueryWrapper<QuestionBusiness>()
+                            .eq(QuestionBusiness::getMajorId, oldExamId)
+                            .eq(QuestionBusiness::getMajorId,2));
+            if (CollectionUtils.isNotEmpty(questionBusinessList)){
+                for (QuestionBusiness item : questionBusinessList) {
+                    item.setId(null);
+                    item.setMajorId(newExamId);
+                    item.setTenantId(newTenantId);
+                    item.setEducationTypeId(getNewEducationTypeId(item.getEducationTypeId(), newTenantId));
+                    item.setBusinessId(getNewBusinessId(item.getBusinessId(), newTenantId));
+                    item.setSubjectId(getNewSubjectId(item.getSubjectId(), newTenantId));
+                    item.setProjectId(getNewProjectTypeId(item.getProjectId(), newTenantId));
+                }
+                iQuestionBusinessService.saveBatch(questionBusinessList);
+            }
+
+            //试卷题目关联
+            iExamQuestionService.deleteByIdAndTenant(newExamId,newTenantId);
+            List<ExamQuestion> examQuestionList = iExamQuestionService
+                    .list(new LambdaQueryWrapper<ExamQuestion>()
+                            .eq(ExamQuestion::getExamId, oldExamId));
+            if (CollectionUtils.isNotEmpty(examQuestionList)){
+                for (ExamQuestion item : examQuestionList) {
+                    item.setId(null);
+                    item.setExamId(newExamId);
+                    item.setTenantId(newTenantId);
+                    item.setQuestionId(getNewQuestionId(item.getQuestionId(),newTenantId));
+                }
+                iExamQuestionService.saveBatch(examQuestionList);
+            }
+
+            return newExamId;
+        }
+        return null;
+    }
+    private Long getNewQuestionId(Long oldQuestionId,Long newTenantId){
+        Question question = iQuestionService.getById(oldQuestionId);
+        if (ObjectUtils.isNotNull(question)){
+            Long newQuestionId = 0L;
+            Question newQuestion = iQuestionService.getQuestionByTenant(question.getCode(),newTenantId);
+            if (ObjectUtils.isNotNull(newQuestion)){
+                newQuestionId = newQuestion.getQuestionId();
+            }else {
+                //新增
+                question.setQuestionId(null);
+                question.setTenantId(newTenantId);
+                iQuestionService.save(question);
+                newQuestionId = question.getQuestionId();
+            }
+            //删除之前的关联
+            iQuestionBusinessService.deleteByIdAndTenant(newQuestionId,newTenantId,1);
+            //新关联
+            List<QuestionBusiness> questionBusinessList = iQuestionBusinessService
+                    .list(new LambdaQueryWrapper<QuestionBusiness>()
+                            .eq(QuestionBusiness::getMajorId, oldQuestionId)
+                            .eq(QuestionBusiness::getType,1));
+            if (CollectionUtils.isNotEmpty(questionBusinessList)){
+                for (QuestionBusiness item : questionBusinessList) {
+                    item.setId(null);
+                    item.setMajorId(newQuestionId);
+                    item.setTenantId(newTenantId);
+                    item.setEducationTypeId(getNewEducationTypeId(item.getEducationTypeId(), newTenantId));
+                    item.setBusinessId(getNewBusinessId(item.getBusinessId(), newTenantId));
+                    item.setSubjectId(getNewSubjectId(item.getSubjectId(), newTenantId));
+                    item.setProjectId(getNewProjectTypeId(item.getProjectId(), newTenantId));
+                }
+                iQuestionBusinessService.saveBatch(questionBusinessList);
+            }
+            return newQuestionId;
+        }
+        return null;
+    }
+    private Long getNewModuleId(Long oldModuleId,Long newTenantId){
+        CourseModule module = iCourseModuleService.getById(oldModuleId);
+        if (ObjectUtils.isNotNull(module)){
+            Long newModuleId = 0L;
+            CourseModule newModule = iCourseModuleService.getModuleByTenant(module.getCode(),newTenantId);
+            if (ObjectUtils.isNotNull(newModule)){
+                newModuleId = newModule.getModuleId();
+            }else {
+                module.setModuleId(null);
+                module.setTenantId(newTenantId);
+                iCourseModuleService.save(module);
+                newModuleId = module.getModuleId();
+            }
+
+            //删除之前的关联
+            iCourseModuleBusinessService.deleteByIdAndTenant(newModuleId,newTenantId);
+            //新关联
+            List<CourseModuleBusiness> moduleBusinessList = iCourseModuleBusinessService
+                    .list(new LambdaQueryWrapper<CourseModuleBusiness>()
+                            .eq(CourseModuleBusiness::getModuleId, oldModuleId));
+            if (CollectionUtils.isNotEmpty(moduleBusinessList)){
+                for (CourseModuleBusiness item : moduleBusinessList) {
+                    item.setId(null);
+                    item.setTenantId(newTenantId);
+                    item.setModuleId(newModuleId);
+                    item.setEducationTypeId(getNewEducationTypeId(item.getEducationTypeId(), newTenantId));
+                    item.setBusinessId(getNewBusinessId(item.getBusinessId(), newTenantId));
+                    item.setSubjectId(getNewSubjectId(item.getSubjectId(), newTenantId));
+                    item.setProjectId(getNewProjectTypeId(item.getProjectId(), newTenantId));
+                }
+                iCourseModuleBusinessService.saveBatch(moduleBusinessList);
+            }
+
+            //模块章
+            iCourseModuleChapterService.deleteByIdAndTenant(newModuleId,newTenantId);
+            List<CourseModuleChapter> moduleChapterList = iCourseModuleChapterService
+                    .list(new LambdaQueryWrapper<CourseModuleChapter>()
+                    .eq(CourseModuleChapter::getModuleId, oldModuleId));
+            if (CollectionUtils.isNotEmpty(moduleChapterList)){
+                for (CourseModuleChapter item : moduleChapterList) {
+                    item.setId(null);
+                    item.setModuleId(newModuleId);
+                    item.setTenantId(newTenantId);
+                    item.setChapterId(getNewChapterId(item.getChapterId(),newTenantId));
+                }
+                iCourseModuleChapterService.saveBatch(moduleChapterList);
+            }
+            return newModuleId;
+        }
+        return null;
+    }
+    private Long getNewChapterId(Long oldChapterId,Long newTenantId){
+        CourseChapter chapter = iCourseChapterService.getById(oldChapterId);
+        if (ObjectUtils.isNotNull(chapter)){
+            Long newChapterId = 0L;
+            CourseChapter newChapter = iCourseChapterService.getChapterByTenant(chapter.getCode(),newTenantId);
+            if (ObjectUtils.isNotNull(newChapter)){
+                newChapterId = newChapter.getChapterId();
+            }else {
+                chapter.setChapterId(null);
+                chapter.setTenantId(newTenantId);
+                iCourseChapterService.save(chapter);
+                newChapterId = chapter.getChapterId();
+            }
+            //删除之前的关联
+            iCourseChapterBusinessService.deleteByIdAndTenant(newChapterId,newTenantId);
+            //新关联
+            List<CourseChapterBusiness> chapterBusinessList = iCourseChapterBusinessService
+                    .list(new LambdaQueryWrapper<CourseChapterBusiness>()
+                            .eq(CourseChapterBusiness::getChapterId, oldChapterId));
+            if (CollectionUtils.isNotEmpty(chapterBusinessList)){
+                for (CourseChapterBusiness item : chapterBusinessList) {
+                    item.setId(null);
+                    item.setChapterId(newChapterId);
+                    item.setTenantId(newTenantId);
+                    item.setEducationTypeId(getNewEducationTypeId(item.getEducationTypeId(), newTenantId));
+                    item.setBusinessId(getNewBusinessId(item.getBusinessId(), newTenantId));
+                    item.setSubjectId(getNewSubjectId(item.getSubjectId(), newTenantId));
+                    item.setProjectId(getNewProjectTypeId(item.getProjectId(), newTenantId));
+                }
+                iCourseChapterBusinessService.saveBatch(chapterBusinessList);
+            }
+
+            //章节关联
+            iCourseChapterSectionService.deleteByIdAndTenant(newChapterId,newTenantId);
+            List<CourseChapterSection> chapterSectionList = iCourseChapterSectionService
+                    .list(new LambdaQueryWrapper<CourseChapterSection>()
+                            .eq(CourseChapterSection::getChapterId, oldChapterId));
+            if (CollectionUtils.isNotEmpty(chapterSectionList)){
+                for (CourseChapterSection item : chapterSectionList) {
+                    item.setId(null);
+                    item.setChapterId(newChapterId);
+                    item.setTenantId(newTenantId);
+                    item.setSectionId(getNewSectionId(item.getSectionId(),newTenantId));
+                }
+                iCourseChapterSectionService.saveBatch(chapterSectionList);
+            }
+
+            return newChapterId;
+        }
+        return null;
+    }
+    private Long getNewSectionId(Long oldSectionId,Long newTenantId){
+        CourseSection section = iCourseSectionService.getById(oldSectionId);
+        if (ObjectUtils.isNotNull(section)){
+            Long newSectionId = 0L;
+            CourseSection newSection = iCourseSectionService.getSectionByTenant(section.getCode(),newTenantId);
+            if (ObjectUtils.isNotNull(newSection)){
+                newSectionId = newSection.getSectionId();
+            }else {
+                //新增
+                section.setSectionId(null);
+                section.setTenantId(newTenantId);
+                iCourseSectionService.save(section);
+                newSectionId = section.getSectionId();
+            }
+            //删除之前的关联
+            iCourseSectionBusinessService.deleteByIdAndTenant(newSectionId,newTenantId);
+            //新关联
+            List<CourseSectionBusiness> sectionBusinessList = iCourseSectionBusinessService
+                    .list(new LambdaQueryWrapper<CourseSectionBusiness>()
+                            .eq(CourseSectionBusiness::getSectionId, oldSectionId));
+            if (CollectionUtils.isNotEmpty(sectionBusinessList)){
+                for (CourseSectionBusiness item : sectionBusinessList) {
+                    item.setId(null);
+                    item.setSectionId(newSectionId);
+                    item.setTenantId(newTenantId);
+                    item.setEducationTypeId(getNewEducationTypeId(item.getEducationTypeId(), newTenantId));
+                    item.setBusinessId(getNewBusinessId(item.getBusinessId(), newTenantId));
+                    item.setSubjectId(getNewSubjectId(item.getSubjectId(), newTenantId));
+                    item.setProjectId(getNewProjectTypeId(item.getProjectId(), newTenantId));
+                }
+                iCourseSectionBusinessService.saveBatch(sectionBusinessList);
+            }
+            return newSectionId;
+        }
+        return null;
+    }
     private Long getNewCertificateId(Long certificateId,Long newTenantId){
         CertificateCommon certificateCommon = iCertificateCommonService.getById(certificateId);
         if (ObjectUtils.isNotNull(certificateCommon)){
@@ -1637,6 +2005,24 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         return null;
     }
 
+    private Long getNewCertificateTpId(Long certificateTpId,Long newTenantId){
+        CertificateTp certificateTp = iCertificateTpService.getById(certificateTpId);
+        if (ObjectUtils.isNotNull(certificateTp)){
+            CertificateTp newCertificateTp =iCertificateTpService.getCertificateTpByTenant(certificateTp.getCode(),newTenantId);
+            if (ObjectUtils.isNotNull(newCertificateTp)){
+               return newCertificateTp.getTpId();
+            }else {
+                certificateTp.setTpId(null);
+                certificateTp.setTenantId(newTenantId);
+                certificateTp.setCertificateId(getNewCertificateId(certificateTp.getCertificateId(),newTenantId));
+                certificateTp.setTypeId(getNewCertificateTypeId(certificateTp.getTypeId(),newTenantId));
+                iCertificateTpService.save(certificateTp);
+                return certificateTp.getTpId();
+            }
+        }
+        return null;
+    }
+
     private Long getNewCertificateTypeId(Long certificateTypeId,Long newTenantId){
         Certificate certificate = iCertificateService.getById(certificateTypeId);
         if (ObjectUtils.isNotNull(certificate)){
@@ -1652,7 +2038,6 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         }
         return null;
     }
-
     private Long getNewEducationTypeId(Long oldEducationTypeId,Long newTenantId){
         //教育类型
         CourseEducationType educationType = iCourseEducationTypeService.getById(oldEducationTypeId);
@@ -1697,16 +2082,34 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         if (ObjectUtils.isNull(major)){
             return null;
         }
+        Long newMajorId = 0L;
         Major newMajor = iMajorService.getMajorByTenant(major.getEncoder(), newTenantId);
         if (ObjectUtil.isNull(newMajor)){
             //新增专业
             major.setId(null);
             major.setTenantId(newTenantId);
             iMajorService.save(major);
+            newMajorId = major.getId();
+        }else {
+            newMajorId = newMajor.getId();
+        }
 
-            return major.getId();
+        //专业项目关联
+        iMajorProjectService.deleteByIdTenant(newMajorId,newTenantId);
+        List<MajorProject> majorProjectList = iMajorProjectService
+                .list(new LambdaQueryWrapper<MajorProject>()
+                .eq(MajorProject::getMajorId, majorId));
+        if (CollectionUtil.isNotEmpty(majorProjectList)){
+            for (MajorProject item : majorProjectList) {
+                item.setId(null);
+                item.setTenantId(newTenantId);
+                item.setMajorId(newMajorId);
+                item.setProjectId(getNewProjectTypeId(item.getProjectId(),newTenantId));
+            }
+            iMajorProjectService.saveBatch(majorProjectList);
         }
-        return newMajor.getId();
+
+        return newMajorId;
     }
 
     private Long getNewBusinessId(Long businessId,Long newTenantId){
@@ -1720,6 +2123,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
             //新增业务层次
             business.setId(null);
             business.setTenantId(newTenantId);
+            business.setProjectId(getNewProjectTypeId(business.getProjectId().longValue(),newTenantId).intValue());
             iCourseBusinessService.save(business);
             return business.getId();
         }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsSpecAttributeServiceImpl.java

@@ -115,4 +115,9 @@ public class GoodsSpecAttributeServiceImpl extends ServiceImpl<GoodsSpecAttribut
     public void deleteByIdsTenant(List<Long> specAttrIds) {
         baseMapper.deleteByIdsTenant(specAttrIds);
     }
+
+    @Override
+    public GoodsSpecAttribute getSpecAttrByTenant(String name, Long createTime, Long newTenantId) {
+        return baseMapper.getSpecAttrByTenant(name, createTime, newTenantId);
+    }
 }

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/ExamMapper.xml

@@ -195,4 +195,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND e.`status` = 1 AND e.exam_paper_id = #{paperId}  GROUP BY
             e.exam_id
     </select>
+    <select id="getExamByTenant" parameterType="map" resultType="com.zhongzheng.modules.bank.domain.Exam">
+        select * from exam where `code` = #{code} and tenant_id = #{newTenantId}
+    </select>
+
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/ExamQuestionMapper.xml

@@ -154,5 +154,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     </select>
 
+    <delete id="deleteByIdAndTenant" parameterType="map">
+        delete from exam_question where exam_id = #{newExamId} and tenant_id = #{newTenantId}
+    </delete>
+
 
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionBusinessMapper.xml

@@ -48,4 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             type = #{type} and qb.major_id =#{majorId}
     </select>
 
+    <delete id="deleteByIdAndTenant" parameterType="map">
+        delete from question_business where major_id = #{majorId} and `type` = #{type} and tenant_id = #{newTenantId}
+    </delete>
+
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionChapterExamMapper.xml

@@ -123,4 +123,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             qce.chapter_exam_id =#{chapterExamId}
           AND e.status = 1 AND  e.exam_id IN ( SELECT exam_id FROM user_exam_record WHERE user_id = #{userId} AND goods_id = #{goodsId} AND module_exam_id = #{moduleExamId} AND chapter_exam_id = #{chapterExamId} GROUP BY exam_id )
     </select>
+    
+    <delete id="deleteByIdAndTenant" parameterType="map">
+        delete from question_chapter_exam where chapter_exam_id = #{newChapterExamId} and tenant_id = #{newTenantId}
+    </delete>
 </mapper>

+ 5 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionChapterMapper.xml

@@ -141,4 +141,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     </select>
+
+    <select id="getChaptereExamByTenant" parameterType="map" resultType="com.zhongzheng.modules.bank.domain.QuestionChapter">
+        select * from question_chapter where `code` = #{code} and tenant_id = #{newTenantId}
+    </select>
+
 </mapper>

+ 4 - 1
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionMapper.xml

@@ -636,6 +636,9 @@
         WHERE
             ga.goods_id = #{goodsId} AND ga.type = 3
     </select>
-
+    
+    <select id="getQuestionByTenant" parameterType="map" resultType="com.zhongzheng.modules.bank.domain.Question">
+        select * from question where `code` = #{code} and tenant_id = #{newTenantId}
+    </select>
 
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionModuleChapterMapper.xml

@@ -78,4 +78,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND mc.chapter_exam_id IN ( SELECT chapter_exam_id FROM user_exam_record WHERE user_id = #{userId} AND goods_id = #{goodsId} AND module_exam_id = #{moduleExamId} AND chapter_exam_id > 0 GROUP BY chapter_exam_id)
 
     </select>
+
+    <delete id="deleteByIdAndTenant" parameterType="map">
+        delete * from question_module_chapter where module_exam_id = #{newModuleExamId} and tenant_id = #{newTenantId}
+    </delete>
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionModuleMapper.xml

@@ -108,4 +108,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
         ORDER BY qm.module_exam_id DESC
     </select>
+
+    <select id="getModuleByTenant" parameterType="map" resultType="com.zhongzheng.modules.bank.domain.QuestionModule">
+        select * from question_module where code = #{code} and tenant_id = #{newTenantId}
+    </select>
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterBusinessMapper.xml

@@ -39,5 +39,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             ccb.chapter_id =#{id}
     </select>
 
+    <delete id="deleteByIdAndTenant" parameterType="map" >
+        delete from course_chapter_business where chapter_id = #{chapterId} and tenant_id = #{newTenantId}
+    </delete>
+
 
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterMapper.xml

@@ -171,6 +171,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     </select>
 
+    <select id="getChapterByTenant" parameterType="map" resultType="com.zhongzheng.modules.course.domain.CourseChapter">
+        select * from course_chapter where code = #{code} and tenant_id = #{newTenantId}
+    </select>
+
     <select id="selectList_COUNT" resultType="Long">
         SELECT
         count(distinct c.chapter_id )

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterSectionMapper.xml

@@ -329,4 +329,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND ups.period_status =1
           and ups.`status` = 1
     </select>
+
+    <delete id="deleteByIdAndTenant" parameterType="map" >
+        delete from course_chapter_section where chapter_id = #{chapterId} and tenant_id = #{newTenantId}
+    </delete>
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMenuExamMapper.xml

@@ -45,4 +45,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
     </select>
 
+    <delete id="deleteByIdTenant" parameterType="map">
+        delete from course_menu_exam where course_id = #{newCourseId} and tenant_id = #{newTenantId}
+    </delete>
+
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMenuMapper.xml

@@ -269,6 +269,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           and (ups.`status` = 0 or ups.`status` = 3)
     </select>
 
+    <delete id="deleteByIdTenant" parameterType="map">
+        delete from course_menu where course_id = #{newCourseId} and tenant_id = #{newTenantId}
+    </delete>
+
     <select id="rebuildSectionCheck" parameterType="map"  resultType="Integer">
         SELECT
             COUNT(up.id)

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseModuleBusinessMapper.xml

@@ -41,4 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             cmb.module_id  =#{module_id}
     </select>
 
+    <delete id="deleteByIdAndTenant" parameterType="map" >
+        delete from course_module_business where module_id = #{moduleId}  and tenant_id = #{newTenantId}
+    </delete>
+
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseModuleChapterMapper.xml

@@ -162,4 +162,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             LIMIT 1
     </select>
 
+    <delete id="deleteByIdAndTenant" parameterType="map">
+       delete from course_module_chapter where module_id = #{newModuleId} and tenant_id = #{newTenantId}
+    </delete>
+
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseSectionBusinessMapper.xml

@@ -38,4 +38,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         WHERE
             csb.section_id =#{id}
     </select>
+
+    <delete id="deleteByIdAndTenant" parameterType="map" >
+        delete from course_section_business where section_id = #{sectionId} and tenant_id = #{newTenantId}
+    </delete>
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseSectionMapper.xml

@@ -250,4 +250,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         AND cs.live_url = #{liveUrl}
         AND cs.`status` != -1
     </select>
+
+    <select id="getSectionByTenant" parameterType="map" resultType="com.zhongzheng.modules.course.domain.CourseSection">
+        SELECT * from course_section where code = #{code} and teacher_id = #{newTenantId}
+    </select>
 </mapper>

+ 1 - 1
zhongzheng-system/src/main/resources/mapper/modules/course/MajorMapper.xml

@@ -104,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
     </select>
 
-    <select id="getMajorByTenant" parameterType="com.zhongzheng.modules.course.bo.MajorQueryBo"  resultType="Integer">
+    <select id="getMajorByTenant" parameterType="map"  resultType="com.zhongzheng.modules.course.domain.Major">
         SELECT * FROM major where encoder = #{encoder} and tenant_id = #{newTenantId}
     </select>
 </mapper>

+ 3 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/MajorProjectMapper.xml

@@ -12,5 +12,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateTime" column="update_time"/>
     </resultMap>
 
+    <delete id="deleteByIdTenant" parameterType="map">
+        delete from major_project where major_id = #{newMajorId} and tenant_id = #{newTenantId}
+    </delete>
 
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamPaperMapper.xml

@@ -192,4 +192,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id
         WHERE ga.type = 3  AND ga.goods_id = #{goodsId}
     </select>
+
+    <select id="getExamPaperByTenant" parameterType="map" resultType="com.zhongzheng.modules.exam.domain.ExamPaper">
+        select * from exam_paper where encoder = #{encoder} and tenant_id = #{newTenantId}
+    </select>
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsAttachedMapper.xml

@@ -352,4 +352,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		WHERE
 			ga.goods_id = #{goodsId} AND ga.type = 3
 	</select>
+	
+	<delete id="deleteByIdTenant" parameterType="map">
+		delete * from goods_attached where goods_id = #{newGoodsId} and tenant_id = #{newTenantId}
+	</delete>
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsCourseMapper.xml

@@ -138,4 +138,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="getCourseIdsByGoodsAndTenant" parameterType="map" resultType="java.lang.Long">
         SELECT course_id FROM goods_course WHERE goods_id = #{goodsId} AND tenant_id = #{tenantId}
     </select>
+
+    <delete id="deleteByIdTenant" parameterType="map" >
+        delete from goods_course WHERE goods_id = #{newGoodsId} AND tenant_id = #{newTenantId}
+    </delete>
 </mapper>

+ 25 - 1
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -734,7 +734,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND og.tenant_id = #{tenantId}
     </select>
 
-    <select id="queryGoodsByIdTenant" parameterType="Long" resultType="com.zhongzheng.modules.goods.vo.GoodsVo">
+    <select id="queryGoodsByIdTenant" parameterType="map" resultType="com.zhongzheng.modules.goods.domain.Goods">
         SELECT
             *
         FROM
@@ -743,4 +743,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             goods_id = #{goodsId} AND tenant_id = #{tenantId}
     </select>
 
+    <select id="queryGoodsByTenant" parameterType="map" resultType="com.zhongzheng.modules.goods.domain.Goods">
+        SELECT
+            *
+        FROM
+            `goods`
+        WHERE
+            `code` = #{code} AND tenant_id = #{tenantId}
+    </select>
+
+
+    <update id="updateByTenant" parameterType="com.zhongzheng.modules.goods.domain.Goods">
+        UPDATE goods SET`year` = #{year},supply_id = #{supplyId},goods_type = #{goodsType},education_type_id = #{educationTypeId},business_id = #{businessId},
+                         school_id = #{schoolId},major_id = #{majorId},goods_name = #{goodsName},stand_price = #{standPrice},lowest_price = #{lowestPrice},create_time = #{createTime},
+                         update_time = #{updateTime},`status` = #{status},validity_start_time = #{validityStartTime},validity_end_time = #{validityEndTime},study_start_time = #{studyStartTime},
+                         study_end_time = #{studyEndTime},certificate_ids = #{certificateIds},introduce = #{introduce},suitable_object = #{suitableObject},buy_note = #{buyNote},pc_detail_html = #{pcDetailHtml},
+                         mobile_detail_html = #{mobileDetailHtml},goods_status = #{goodsStatus},cover_url = #{coverUrl},class_hours = #{classHours},stand_price_json =  #{standPriceJson},tenant_id = #{tenantId},
+                         `code` = #{code},project_id = #{projectId},goods_audition_config = #{goodsAuditionConfig},goods_photograph_config = #{goodsPhotographConfig},goods_play_config = #{goodsPlayConfig},
+                         goods_exam_config = #{goodsExamConfig},handouts_id = #{handoutsId},make_start_time = #{makeStartTime},make_end_time = #{makeEndTime},study_count = #{studyCount},
+                         goods_photo_exam_config = #{goodsPhotoExamConfig},make_goods_id = #{makeGoodsId},service_time_type = #{serviceTimeType},service_time_num = #{serviceTimeNum},section_max_num = #{sectionMaxNum},
+                         exam_number = #{examNumber},do_number = #{doNumber},teacher_id = #{teacherId},subject_ids = #{subjectIds},certificate_type_id = #{certificateTypeId},certificate_id = #{certificateId},
+                         certificate_tp_id = #{certificateTpId},line_price = #{linePrice},spec_template_id = #{specTemplateId},show_status = #{showStatus},show_sort = #{showSort}
+        WHERE goods_id = #{goodsId} and tenant_id = #{tenantId}
+    </update>
+
 </mapper>

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsSpecAttributeMapper.xml

@@ -33,4 +33,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
     </delete>
 
+    <select id="getSpecAttrByTenant" parameterType="map" resultType="com.zhongzheng.modules.goods.domain.GoodsSpecAttribute">
+        select * from goods_spec_attribute where `name` = #{name} and create_time = #{createTime} and tenant_id = #{newTenantId}
+    </select>
+
 </mapper>