Просмотр исходного кода

设置批量删除事务护理2.0

ljx 3 лет назад
Родитель
Сommit
f730c2dfc1

+ 6 - 0
src/main/java/com/imed/costaccount/service/MenuService.java

@@ -49,5 +49,11 @@ public interface MenuService extends IService<Menu> {
      * @return
      */
     List<NavVO> getNav(User user);
+
+    /**
+     *  批量删除菜单
+     * @param idList 菜单Id的集合
+     */
+    void deleteByIds(List<Long> idList);
 }
 

+ 6 - 0
src/main/java/com/imed/costaccount/service/ProductService.java

@@ -58,5 +58,11 @@ public interface ProductService extends IService<Product> {
      * @return
      */
     Result importProduct(List<List<Object>> read, Long hospId);
+
+    /**
+     * 批量删除收入成本数据
+     * @param asList 成本的Id集合
+     */
+    void deleteByIds(List<Integer> asList);
 }
 

+ 7 - 2
src/main/java/com/imed/costaccount/service/ReportRelationService.java

@@ -1,10 +1,9 @@
 package com.imed.costaccount.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.imed.costaccount.model.dto.CopyReportDTO;
+import com.imed.costaccount.model.ReportRelation;
 import com.imed.costaccount.model.dto.ReportRelationDTO;
 import com.imed.costaccount.model.vo.RelationVO;
-import com.imed.costaccount.model.ReportRelation;
 
 import java.util.List;
 
@@ -58,5 +57,11 @@ public interface ReportRelationService extends IService<ReportRelation> {
      * @return {@link RelationVO}
      */
     List<RelationVO> getResponsibilities(Long reportId, Long hospId);
+
+    /**
+     *  批量删除分摊层级的数据
+     * @param asList 分摊层级的Id集合
+     */
+    void deleteByIds(List<Long> asList);
 }
 

+ 7 - 0
src/main/java/com/imed/costaccount/service/RoleService.java

@@ -7,6 +7,8 @@ import com.imed.costaccount.model.dto.RoleEditDTO;
 import com.imed.costaccount.model.dto.RoleSaveDTO;
 import com.imed.costaccount.model.Role;
 
+import java.util.List;
+
 /**
  * 角色
  *
@@ -41,5 +43,10 @@ public interface RoleService extends IService<Role> {
      */
     void updateRole(RoleEditDTO roleEditDTO, Long userId);
 
+    /**
+     * 批量删除角色信息
+     * @param asList 角色的Id集合
+     */
+    void deleteByIds(List<Long> asList);
 }
 

+ 6 - 0
src/main/java/com/imed/costaccount/service/ShareParamValueService.java

@@ -83,5 +83,11 @@ public interface ShareParamValueService extends IService<ShareParamValue> {
      * @return 某月成本分摊参数值
      */
     List<ShareParamValue> getListByYearAndMonth(Integer year, Integer month, Long hospId);
+
+    /**
+     * 成本分摊参数值批量删除
+     * @param asList id集合
+     */
+    void deleteByIds(List<Long> asList);
 }
 

+ 6 - 0
src/main/java/com/imed/costaccount/service/UserService.java

@@ -76,5 +76,11 @@ public interface UserService extends IService<User> {
      * @return 用户名称,如果不存在返回空字符串
      */
     String getUsernameByIdAndHospId(Long createUserId, Long hospId);
+
+    /**
+     * 批量删除用户集合
+     * @param asList idList
+     */
+    void deleteByIds(List<Integer> asList);
 }
 

+ 11 - 0
src/main/java/com/imed/costaccount/service/impl/MenuServiceImpl.java

@@ -195,6 +195,17 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
         return vos;
     }
 
+    /**
+     * 批量删除菜单
+     *
+     * @param idList 菜单Id的集合
+     */
+    @Override
+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
+    public void deleteByIds(List<Long> idList) {
+        this.removeByIds(idList);
+    }
+
     private List<NavVO> getSon(NavVO parentNavVO, List<NavVO> list) {
         return list.stream().filter(o -> parentNavVO.getMenuId().equals(o.getParentId()))
                 .peek(i -> {

+ 11 - 0
src/main/java/com/imed/costaccount/service/impl/ProductServiceImpl.java

@@ -217,4 +217,15 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
             return Result.build(200, "有" + realProducts.size() + "条数据已存在,未被导入", null);
         }
     }
+
+    /**
+     * 批量删除收入成本数据
+     *
+     * @param idList 成本的Id集合
+     */
+    @Override
+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
+    public void deleteByIds(List<Integer> idList) {
+        this.removeByIds(idList);
+    }
 }

+ 12 - 0
src/main/java/com/imed/costaccount/service/impl/ReportRelationServiceImpl.java

@@ -85,10 +85,22 @@ public class ReportRelationServiceImpl extends ServiceImpl<ReportRelationMapper,
      * @param hospId   医院id
      * @return {@link RelationVO}
      */
+    @Override
     public List<RelationVO> getResponsibilities(Long reportId, Long hospId) {
         return baseMapper.getResponsibilities(reportId, hospId);
     }
 
+    /**
+     * 批量删除分摊层级的数据
+     *
+     * @param asList 分摊层级的Id集合
+     */
+    @Override
+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
+    public void deleteByIds(List<Long> asList) {
+        this.removeByIds(asList);
+    }
+
     /**
      * 编辑相关关系
      *

+ 11 - 0
src/main/java/com/imed/costaccount/service/impl/RoleServiceImpl.java

@@ -114,4 +114,15 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
         log.info("byId:{}", byId);
         this.updateById(byId);
     }
+
+    /**
+     * 批量删除角色信息
+     *
+     * @param asList 角色的Id集合
+     */
+    @Override
+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
+    public void deleteByIds(List<Long> asList) {
+        this.removeByIds(asList);
+    }
 }

+ 11 - 0
src/main/java/com/imed/costaccount/service/impl/ShareParamValueServiceImpl.java

@@ -515,4 +515,15 @@ public class ShareParamValueServiceImpl extends ServiceImpl<ShareParamValueMappe
     public List<ShareParamValue> getListByYearAndMonth(Integer year, Integer month, Long hospId) {
         return baseMapper.getListByYearAndMonth(year, month, hospId);
     }
+
+    /**
+     * 成本分摊参数值批量删除
+     *
+     * @param asList id集合
+     */
+    @Override
+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
+    public void deleteByIds(List<Long> asList) {
+        this.removeByIds(asList);
+    }
 }

+ 11 - 0
src/main/java/com/imed/costaccount/service/impl/UserServiceImpl.java

@@ -300,4 +300,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         }
         return one.getName();
     }
+
+    /**
+     * 批量删除用户集合
+     *
+     * @param asList idList
+     */
+    @Override
+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
+    public void deleteByIds(List<Integer> asList) {
+        this.removeByIds(asList);
+    }
 }

+ 1 - 1
src/main/java/com/imed/costaccount/web/MenuController.java

@@ -65,7 +65,7 @@ public class MenuController extends AbstractController {
     @ApiOperation("删除某个菜单")
     @PostMapping("/delete")
     public Result delete(@RequestBody Long[] menuIds) {
-        menuService.removeByIds(Arrays.asList(menuIds));
+        menuService.deleteByIds(Arrays.asList(menuIds));
         return Result.ok();
     }
 

+ 1 - 1
src/main/java/com/imed/costaccount/web/ProductController.java

@@ -72,7 +72,7 @@ public class ProductController {
     @ApiOperation("删除成本项目")
     @PostMapping("/delete")
     public Result delete(@RequestBody Integer[] ids){
-		productService.removeByIds(Arrays.asList(ids));
+        productService.deleteByIds(Arrays.asList(ids));
         return Result.ok();
     }
 

+ 5 - 11
src/main/java/com/imed/costaccount/web/ReportRelationController.java

@@ -1,20 +1,14 @@
 package com.imed.costaccount.web;
 
-import java.util.Arrays;
-import java.util.Map;
-
 import com.imed.costaccount.common.util.Result;
+import com.imed.costaccount.model.ReportRelation;
 import com.imed.costaccount.model.User;
+import com.imed.costaccount.service.ReportRelationService;
 import org.apache.shiro.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
-import com.imed.costaccount.model.ReportRelation;
-import com.imed.costaccount.service.ReportRelationService;
+import java.util.Arrays;
 
 
 /**
@@ -72,7 +66,7 @@ public class ReportRelationController {
      */
     @RequestMapping("/delete")
     public Result delete(@RequestBody Long[] ids){
-		reportRelationService.removeByIds(Arrays.asList(ids));
+        reportRelationService.deleteByIds(Arrays.asList(ids));
         return Result.ok();
     }
 

+ 1 - 1
src/main/java/com/imed/costaccount/web/RoleController.java

@@ -65,7 +65,7 @@ public class RoleController extends AbstractController {
     @ApiOperation("删除")
     @PostMapping("/delete")
     public Result delete(@RequestBody Long[] roleIds) {
-        roleService.removeByIds(Arrays.asList(roleIds));
+        roleService.deleteByIds(Arrays.asList(roleIds));
         return Result.ok();
     }
 

+ 1 - 4
src/main/java/com/imed/costaccount/web/ShareParamValueController.java

@@ -2,15 +2,12 @@ package com.imed.costaccount.web;
 
 import com.imed.costaccount.common.util.PageUtils;
 import com.imed.costaccount.common.util.Result;
-import com.imed.costaccount.model.ShareParamValue;
-import com.imed.costaccount.model.User;
 import com.imed.costaccount.model.dto.CopyShareParamValueDTO;
 import com.imed.costaccount.model.dto.ShareParamValueEditDTO;
 import com.imed.costaccount.model.dto.ShareParamValueSaveDTO;
 import com.imed.costaccount.service.ShareParamValueService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.apache.shiro.SecurityUtils;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
@@ -82,7 +79,7 @@ public class ShareParamValueController extends AbstractController {
     @ApiOperation("删除某条数据")
     @PostMapping("/delete")
     public Result delete(@RequestBody Long[] ids) {
-        shareParamValueService.removeByIds(Arrays.asList(ids));
+        shareParamValueService.deleteByIds(Arrays.asList(ids));
         return Result.ok();
     }
 

+ 1 - 1
src/main/java/com/imed/costaccount/web/UserController.java

@@ -91,7 +91,7 @@ public class UserController {
     @PostMapping("/delete")
     @ApiOperation("删除用户的信息")
     public Result delete(@RequestBody Integer[] ids){
-        userService.removeByIds(Arrays.asList(ids));
+        userService.deleteByIds(Arrays.asList(ids));
         return Result.ok();
     }