Browse Source

新增默认表单隐藏功能

lvy 1 month ago
parent
commit
abcdf6155a

+ 15 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreePrivateController.java

@@ -1230,7 +1230,7 @@ public class WbsTreePrivateController extends BladeController {
 
 
     /**
-     * wbs私有树懒加载获取项目私有节点树形结构--(表单类型划分树)
+     * 设置/取消 表单默认隐藏
      */
     @GetMapping("/showTable")
     @ApiOperationSupport(order = 41)
@@ -1238,9 +1238,21 @@ public class WbsTreePrivateController extends BladeController {
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "pKeyId", value = "表单的pKeyId", required = true)})
     public R<Boolean> showTable(Long pKeyId) {
-        boolean update = wbsTreePrivateService.update(Wrappers.<WbsTreePrivate>lambdaUpdate().eq(WbsTreePrivate::getPKeyId, pKeyId).ne(WbsTreePrivate::getType, 1).setSql(" default_conceal = 1 - default_conceal"));
+        if (pKeyId == null) {
+            return R.fail("参数错误");
+        }
+        WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>lambdaQuery().select(WbsTreePrivate::getPKeyId, WbsTreePrivate::getDefaultConceal, WbsTreePrivate::getProjectId)
+                .eq(WbsTreePrivate::getPKeyId, pKeyId).ne(WbsTreePrivate::getType, 1));
+        if (wbsTreePrivate == null) {
+            return R.fail("选择的表单不存在");
+        }
+        int isDefaultConceal = 0;
+        if (wbsTreePrivate.getDefaultConceal() == null || wbsTreePrivate.getDefaultConceal() == 0) {
+            isDefaultConceal = 1;
+        }
+        boolean update = wbsTreePrivateService.update(Wrappers.<WbsTreePrivate>lambdaUpdate().eq(WbsTreePrivate::getPKeyId, pKeyId).set(WbsTreePrivate::getDefaultConceal, isDefaultConceal).set(WbsTreePrivate::getIsBussShow, isDefaultConceal + 1));
         if ( update) {
-            // todo 是否同步到客户端
+            jdbcTemplate.execute("update m_wbs_tree_contract set is_buss_show =  " + (isDefaultConceal + 1) + " where is_deleted = 0 and is_type_private_pid = " + pKeyId + " and project_id = " + wbsTreePrivate.getProjectId());
         }
         return R.data(update);
     }