|
@@ -1,5 +1,6 @@
|
|
|
package com.imed.costaccount.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -13,7 +14,6 @@ import com.imed.costaccount.model.Role;
|
|
|
import com.imed.costaccount.model.User;
|
|
|
import com.imed.costaccount.model.dto.RoleEditDTO;
|
|
|
import com.imed.costaccount.model.dto.RoleSaveDTO;
|
|
|
-import com.imed.costaccount.model.vo.CommonVO;
|
|
|
import com.imed.costaccount.model.vo.RoleVO;
|
|
|
import com.imed.costaccount.service.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -44,7 +44,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
|
|
* @param user
|
|
|
*/
|
|
|
@Override
|
|
|
- @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public void saveRole(RoleSaveDTO roleSaveDTO, User user) {
|
|
|
Role role = BeanUtil.convertObj(roleSaveDTO, Role.class);
|
|
|
role.setCreateUserId(user.getId())
|
|
@@ -56,21 +56,25 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
|
|
/**
|
|
|
* 查询角色列表并分页
|
|
|
*
|
|
|
- * @param page 页码
|
|
|
- * @param pageSize 每页展示数据条数
|
|
|
- * @param keyword 模糊匹配关键字
|
|
|
- * @param user 当前登录用户
|
|
|
+ * @param page 页码
|
|
|
+ * @param pageSize 每页展示数据条数
|
|
|
+ * @param keyword 模糊匹配关键字
|
|
|
+ * @param user 当前登录用户
|
|
|
+ * @param modifyTime
|
|
|
* @return {@link PageUtils} 分页对象
|
|
|
*/
|
|
|
@Override
|
|
|
- public PageUtils selectList(Integer page, Integer pageSize, String keyword, User user) {
|
|
|
+ public PageUtils selectList(Integer page, Integer pageSize, String keyword, User user, String modifyTime) {
|
|
|
+ DateTime modifyDate = DateUtil.parseDate(modifyTime);
|
|
|
+ long startTime = DateUtil.beginOfDay(modifyDate).getTime();
|
|
|
+ long endTime = DateUtil.endOfDay(modifyDate).getTime();
|
|
|
Page<Role> rolePage = new Page<>(page, pageSize);
|
|
|
Page<Role> pages = this.page(rolePage,
|
|
|
new LambdaQueryWrapper<Role>().eq(Role::getHospId, user.getHospId())
|
|
|
- .and( StrUtil.isNotBlank(keyword), i -> i.eq( Role::getRoleName, keyword)
|
|
|
+ .and(StrUtil.isNotBlank(keyword), i -> i.eq(Role::getRoleName, keyword)
|
|
|
.or()
|
|
|
.eq(Role::getRemark, keyword))
|
|
|
-
|
|
|
+ .between(StrUtil.isNotBlank(modifyTime), Role::getCreateTime, startTime, endTime)
|
|
|
);
|
|
|
List<Role> records = pages.getRecords();
|
|
|
List<RoleVO> list = records.stream().map(i -> {
|
|
@@ -82,7 +86,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
|
|
return roleVO;
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
- return new PageUtils(list, (int) pages.getTotal(),pageSize,page);
|
|
|
+ return new PageUtils(list, (int) pages.getTotal(), pageSize, page);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -90,10 +94,10 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
|
|
* 编辑某个角色
|
|
|
*
|
|
|
* @param roleEditDTO {@link RoleEditDTO}
|
|
|
- * @param userId 当前登录人id
|
|
|
+ * @param userId 当前登录人id
|
|
|
*/
|
|
|
@Override
|
|
|
- @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public void updateRole(RoleEditDTO roleEditDTO, Long userId) {
|
|
|
Role byId = this.getById(roleEditDTO.getRoleId());
|
|
|
if (Objects.isNull(byId)) {
|
|
@@ -103,7 +107,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
|
|
byId.setCreateTime(System.currentTimeMillis());
|
|
|
byId.setCreateUserId(userId);
|
|
|
|
|
|
- log.info("byId:{}",byId);
|
|
|
+ log.info("byId:{}", byId);
|
|
|
this.updateById(byId);
|
|
|
}
|
|
|
}
|