|  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.moral.api.entity.*; | 
|---|
|  |  |  | import com.moral.api.mapper.*; | 
|---|
|  |  |  | import com.moral.api.pojo.dto.login.AccountInfoDTO; | 
|---|
|  |  |  | import com.moral.api.service.ManageRoleService; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
|---|
|  |  |  | import com.moral.api.util.LogUtils; | 
|---|
|  |  |  | import com.moral.constant.Constants; | 
|---|
|  |  |  | import com.moral.constant.ResponseCodeEnum; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.data.domain.Page; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.util.ObjectUtils; | 
|---|
|  |  |  | import org.springframework.util.StringUtils; | 
|---|
|  |  |  | import org.springframework.web.context.request.RequestContextHolder; | 
|---|
|  |  |  | import org.springframework.web.context.request.ServletRequestAttributes; | 
|---|
|  |  |  | 
|---|
|  |  |  | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | 
|---|
|  |  |  | String content = "修改了角色:"+manageRoleOld.getName()+";"; | 
|---|
|  |  |  | for (Object key:map.keySet()) { | 
|---|
|  |  |  | if (key.toString().equals("name")){ | 
|---|
|  |  |  | if (key.toString().equals("name")&&map.get(key)!=null){ | 
|---|
|  |  |  | content = content+"角色名:"+manageRoleOld.getName()+"->"+map.get(key)+";"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (key.toString().equals("desc")){ | 
|---|
|  |  |  | if (key.toString().equals("desc")&&map.get(key)!=null){ | 
|---|
|  |  |  | content = content+"备注:"+manageRoleOld.getDesc()+"->"+map.get(key)+";"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | QueryWrapper<ManageRole> wrapper = new QueryWrapper(); | 
|---|
|  |  |  | wrapper.eq("is_delete",0); | 
|---|
|  |  |  | wrapper.like("name",map.get("name")); | 
|---|
|  |  |  | wrapper.orderByDesc("create_time"); | 
|---|
|  |  |  | com.baomidou.mybatisplus.extension.plugins.pagination.Page resultpage = manageRoleMapper.selectPage(page,wrapper); | 
|---|
|  |  |  | List<ManageRole> manageRoles = resultpage.getRecords(); | 
|---|
|  |  |  | SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 
|---|
|  |  |  | 
|---|
|  |  |  | return resultMap; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public ManageRole getRoleByAccountId(Integer accountId) { | 
|---|
|  |  |  | QueryWrapper<ManageAccountRole> queryAccountRoleWrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | queryAccountRoleWrapper.eq("is_delete",Constants.NOT_DELETE); | 
|---|
|  |  |  | queryAccountRoleWrapper.eq("account_id",accountId); | 
|---|
|  |  |  | ManageAccountRole accountRole = manageAccountRoleMapper.selectOne(queryAccountRoleWrapper); | 
|---|
|  |  |  | if(ObjectUtils.isEmpty(accountRole)) | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | Integer roleId = accountRole.getRoleId(); | 
|---|
|  |  |  | QueryWrapper<ManageRole> queryRoleWrapper = new QueryWrapper(); | 
|---|
|  |  |  | queryRoleWrapper.eq("is_delete", Constants.NOT_DELETE); | 
|---|
|  |  |  | queryRoleWrapper.eq("id", roleId); | 
|---|
|  |  |  | return  manageRoleMapper.selectOne(queryRoleWrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @Description: 补充父菜单 | 
|---|
|  |  |  | * @Param: [list, menuId]list:menuId集合 | 
|---|