修复部分功能

master
星期八 5 years ago
parent ca09811d79
commit be1e22f8ae
  1. 2
      src/main/java/com/lq/cms/web/sys/UserController.java
  2. 19
      src/main/java/com/lq/code/service/BaseService.java

@ -92,7 +92,7 @@ public class UserController {
Date nowTime =new Date(); Date nowTime =new Date();
AjaxResult ajaxResult = new AjaxResult(); AjaxResult ajaxResult = new AjaxResult();
SysUser sysUser = new SysUser(); SysUser sysUser = new SysUser();
BeanUtil.copyNotNull(vo,sysUser); BeanUtil.copyNotNull(sysUser,vo);
sysUser.setCreateTime(nowTime); sysUser.setCreateTime(nowTime);
sysUser.setPassword(Md5Util.getMd5(sysUser.getPassword())); sysUser.setPassword(Md5Util.getMd5(sysUser.getPassword()));
sysUser.setUpdateTime(nowTime); sysUser.setUpdateTime(nowTime);

@ -10,8 +10,17 @@ import java.util.List;
*/ */
public interface BaseService<T> { public interface BaseService<T> {
BaseDao<T> getBaseDao(); /**
* 注入 baseDao
* @return
*/
BaseDao<T> getBaseDao();
/**
* 通过ID查找数据
* @param id
* @return
*/
default T findOne(Long id){ default T findOne(Long id){
return getBaseDao().findOne(id); return getBaseDao().findOne(id);
} }
@ -32,17 +41,17 @@ public interface BaseService<T> {
getBaseDao().delete(id); getBaseDao().delete(id);
} }
@Transactional @Transactional(rollbackFor = Exception.class)
default void batchSave(List<T> entitylist){ default void batchSave(List<T> entitylist){
getBaseDao().batchSave(entitylist); getBaseDao().batchSave(entitylist);
} }
@Transactional @Transactional(rollbackFor = Exception.class)
default void batchUpdate(List<T> entitylist){ default void batchUpdate(List<T> entitylist){
getBaseDao().batchSave(entitylist); getBaseDao().batchSave(entitylist);
} }
@Transactional @Transactional(rollbackFor = Exception.class)
default void batchDelete(List<T> entitylist){ default void batchDelete(List<T> entitylist){
getBaseDao().batchDelete(entitylist); getBaseDao().batchDelete(entitylist);
} }

Loading…
Cancel
Save