From be1e22f8aec0b30c6703ea6ec953127858ea5c9b Mon Sep 17 00:00:00 2001 From: qi_liang Date: Wed, 11 Mar 2020 08:04:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/lq/cms/web/sys/UserController.java | 2 +- .../java/com/lq/code/service/BaseService.java | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/lq/cms/web/sys/UserController.java b/src/main/java/com/lq/cms/web/sys/UserController.java index 5e8cde3..8787bcb 100755 --- a/src/main/java/com/lq/cms/web/sys/UserController.java +++ b/src/main/java/com/lq/cms/web/sys/UserController.java @@ -92,7 +92,7 @@ public class UserController { Date nowTime =new Date(); AjaxResult ajaxResult = new AjaxResult(); SysUser sysUser = new SysUser(); - BeanUtil.copyNotNull(vo,sysUser); + BeanUtil.copyNotNull(sysUser,vo); sysUser.setCreateTime(nowTime); sysUser.setPassword(Md5Util.getMd5(sysUser.getPassword())); sysUser.setUpdateTime(nowTime); diff --git a/src/main/java/com/lq/code/service/BaseService.java b/src/main/java/com/lq/code/service/BaseService.java index e5ac2f5..724a09a 100755 --- a/src/main/java/com/lq/code/service/BaseService.java +++ b/src/main/java/com/lq/code/service/BaseService.java @@ -10,8 +10,17 @@ import java.util.List; */ public interface BaseService { - BaseDao getBaseDao(); - + /** + * 注入 baseDao + * @return + */ + BaseDao getBaseDao(); + + /** + * 通过ID查找数据 + * @param id + * @return + */ default T findOne(Long id){ return getBaseDao().findOne(id); } @@ -32,17 +41,17 @@ public interface BaseService { getBaseDao().delete(id); } - @Transactional + @Transactional(rollbackFor = Exception.class) default void batchSave(List entitylist){ getBaseDao().batchSave(entitylist); } - @Transactional + @Transactional(rollbackFor = Exception.class) default void batchUpdate(List entitylist){ getBaseDao().batchSave(entitylist); } - @Transactional + @Transactional(rollbackFor = Exception.class) default void batchDelete(List entitylist){ getBaseDao().batchDelete(entitylist); }