From 1176d853108beffcb1372774674a310a86967a01 Mon Sep 17 00:00:00 2001 From: qi Date: Mon, 13 Apr 2020 10:53:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cms/service/impl/SysRoleServiceImpl.java | 4 +- .../java/com/lq/code/service/BaseService.java | 41 ++++++++++++++++--- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/lq/cms/service/impl/SysRoleServiceImpl.java b/src/main/java/com/lq/cms/service/impl/SysRoleServiceImpl.java index fe988ad..73be4ee 100755 --- a/src/main/java/com/lq/cms/service/impl/SysRoleServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/SysRoleServiceImpl.java @@ -62,10 +62,10 @@ public class SysRoleServiceImpl implements SysRoleService { @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public void deleteRole(Long roleId) { //删除角色关联的权限和菜单 - Map paramsMap = new HashMap<>(); + Map paramsMap = new HashMap<>(2); paramsMap.put("roleId",roleId); paramsMap.put("status", StatusTypeEnum.STATUS_ACTIVITY_NO.getValue()); sysRoleResourcePermissionDao.updateByRoleIdAndStatus(paramsMap); diff --git a/src/main/java/com/lq/code/service/BaseService.java b/src/main/java/com/lq/code/service/BaseService.java index 724a09a..abe8904 100755 --- a/src/main/java/com/lq/code/service/BaseService.java +++ b/src/main/java/com/lq/code/service/BaseService.java @@ -25,35 +25,64 @@ public interface BaseService { return getBaseDao().findOne(id); } + /** + * 查询全部 + * @return + */ default List findAll(){ return getBaseDao().findAll(); } + /** + * 保存 + * @param entity + * @return + */ default Long save(T entity){ return getBaseDao().save(entity); } + /** + * 更新 + * @param entity + */ default void update(T entity){ getBaseDao().update(entity); } + /** + * 删除 + * @param id + */ default void delete(Long id){ getBaseDao().delete(id); } + /** + * 批量保存 + * @param entityList + */ @Transactional(rollbackFor = Exception.class) - default void batchSave(List entitylist){ - getBaseDao().batchSave(entitylist); + default void batchSave(List entityList){ + getBaseDao().batchSave(entityList); } + /** + * 批量更新 + * @param entityList + */ @Transactional(rollbackFor = Exception.class) - default void batchUpdate(List entitylist){ - getBaseDao().batchSave(entitylist); + default void batchUpdate(List entityList){ + getBaseDao().batchSave(entityList); } + /** + * 批量删除 + * @param entityList + */ @Transactional(rollbackFor = Exception.class) - default void batchDelete(List entitylist){ - getBaseDao().batchDelete(entitylist); + default void batchDelete(List entityList){ + getBaseDao().batchDelete(entityList); } }