Merge branch 'develop' of https://gitee.com/likeadmin/likeadmin_java into develop

This commit is contained in:
damonyuan 2024-10-19 01:11:31 +08:00
commit 9a99d79439
26 changed files with 320 additions and 116 deletions

View File

@ -24,14 +24,14 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
@RestController @RestController
@RequestMapping("api/system/admin") @RequestMapping("/adminapi/auth/admin")
@Api(tags = "系统用户管理") @Api(tags = "系统用户管理")
public class SystemAuthAdminController { public class SystemAuthAdminController {
@Resource @Resource
IAdminService iSystemAuthAdminService; IAdminService iSystemAuthAdminService;
@GetMapping("/list") @GetMapping("/lists")
@ApiOperation(value="管理员列表") @ApiOperation(value="管理员列表")
public AjaxResult<PageResult<SystemAuthAdminListedVo>> list(@Validated PageValidate pageValidate, public AjaxResult<PageResult<SystemAuthAdminListedVo>> list(@Validated PageValidate pageValidate,
@Validated SystemAdminSearchValidate searchValidate) { @Validated SystemAdminSearchValidate searchValidate) {
@ -83,7 +83,7 @@ public class SystemAuthAdminController {
} }
@Log(title = "管理员删除") @Log(title = "管理员删除")
@PostMapping("/del") @PostMapping("/delete")
@ApiOperation(value="管理员删除") @ApiOperation(value="管理员删除")
public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) { public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) {
Integer adminId = LikeAdminThreadLocal.getAdminId(); Integer adminId = LikeAdminThreadLocal.getAdminId();

View File

@ -69,7 +69,7 @@ public class SystemAuthMenuController {
} }
@Log(title = "菜单删除") @Log(title = "菜单删除")
@PostMapping("/del") @PostMapping("/delete")
@ApiOperation(value="菜单删除") @ApiOperation(value="菜单删除")
public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) { public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) {
iSystemAuthMenuService.del(idValidate.getId()); iSystemAuthMenuService.del(idValidate.getId());

View File

@ -14,4 +14,16 @@ public interface IAdminDeptService {
*/ */
List<Integer> getDeptIdAttr(Integer adminId); List<Integer> getDeptIdAttr(Integer adminId);
/**
* 批量添加部门
* @param adminId
* @param deptIds
*/
void batchInsert(Integer adminId, List<Integer> deptIds);
/**
* 删除关联部门
* @param adminId
*/
void deleteByAdminId(Integer adminId);
} }

View File

@ -14,4 +14,16 @@ public interface IAdminJobsService {
*/ */
List<Integer> getJobIdAttr(Integer adminId); List<Integer> getJobIdAttr(Integer adminId);
/**
* 批量添加岗位
* @param adminId
* @param jobsIds
*/
void batchInsert(Integer adminId, List<Integer> jobsIds);
/**
* 删除关联岗位
* @param adminId
*/
void deleteByAdminId(Integer adminId);
} }

View File

@ -14,4 +14,17 @@ public interface IAdminRoleService {
*/ */
List<Integer> getRoleIdAttr(Integer adminId); List<Integer> getRoleIdAttr(Integer adminId);
/**
* 批量设置部门
* @param adminId
* @param deptIds
*/
void batchInsert(Integer adminId, List<Integer> deptIds);
/**
* 删除关联角色
* @param adminId
*/
void deleteByAdminId(Integer adminId);
} }

View File

@ -160,7 +160,6 @@ public class ArtCateServiceImpl implements IArtCateService {
ArticleCate model = articleCategoryMapper.selectOne( ArticleCate model = articleCategoryMapper.selectOne(
new QueryWrapper<ArticleCate>() new QueryWrapper<ArticleCate>()
.select(ArticleCate.class, info-> .select(ArticleCate.class, info->
!info.getColumn().equals("is_delete") &&
!info.getColumn().equals("delete_time")) !info.getColumn().equals("delete_time"))
.eq("id", updateValidate.getId()) .eq("id", updateValidate.getId())
.isNull("delete_time")); .isNull("delete_time"));

View File

@ -143,7 +143,7 @@ public class ChannelOaCallBackServiceImpl implements IChannelOaCallBackService {
List<OfficialAccountReply> oaReplyList = officialAccountReplyMapper.selectList( List<OfficialAccountReply> oaReplyList = officialAccountReplyMapper.selectList(
new QueryWrapper<OfficialAccountReply>() new QueryWrapper<OfficialAccountReply>()
.eq("reply_type", 2) .eq("reply_type", 2)
.eq("is_delete", 0) .isNull("delete_time")
.eq("status", 1) .eq("status", 1)
.orderByAsc("id")); .orderByAsc("id"));
@ -170,7 +170,7 @@ public class ChannelOaCallBackServiceImpl implements IChannelOaCallBackService {
private String defaultMsg() { private String defaultMsg() {
OfficialAccountReply officialAccountReply = officialAccountReplyMapper.selectOne(new QueryWrapper<OfficialAccountReply>() OfficialAccountReply officialAccountReply = officialAccountReplyMapper.selectOne(new QueryWrapper<OfficialAccountReply>()
.eq("reply_type", 3) .eq("reply_type", 3)
.eq("is_delete", 0) .isNull("delete_time")
.eq("status", 1) .eq("status", 1)
.last("limit 1")); .last("limit 1"));
if (officialAccountReply == null) { if (officialAccountReply == null) {
@ -187,7 +187,7 @@ public class ChannelOaCallBackServiceImpl implements IChannelOaCallBackService {
private String subMsg() { private String subMsg() {
OfficialAccountReply officialAccountReply = officialAccountReplyMapper.selectOne(new QueryWrapper<OfficialAccountReply>() OfficialAccountReply officialAccountReply = officialAccountReplyMapper.selectOne(new QueryWrapper<OfficialAccountReply>()
.eq("reply_type", 1) .eq("reply_type", 1)
.eq("is_delete", 0) .isNull("delete_time")
.eq("status", 1) .eq("status", 1)
.last("limit 1")); .last("limit 1"));
if (officialAccountReply == null) { if (officialAccountReply == null) {

View File

@ -46,7 +46,7 @@ public class CrontabServiceImpl implements ICrontabService {
@PostConstruct @PostConstruct
public void init() throws SchedulerException { public void init() throws SchedulerException {
scheduler.clear(); scheduler.clear();
List<Crontab> jobs = crontabMapper.selectList(new QueryWrapper<Crontab>().eq("is_delete", 0)); List<Crontab> jobs = crontabMapper.selectList(new QueryWrapper<Crontab>().isNull("delete_time"));
for (Crontab crontab : jobs) { for (Crontab crontab : jobs) {
QuartzUtils.createScheduleJob(scheduler, crontab); QuartzUtils.createScheduleJob(scheduler, crontab);
} }
@ -66,7 +66,7 @@ public class CrontabServiceImpl implements ICrontabService {
IPage<Crontab> iPage = crontabMapper.selectPage(new Page<>(pageNo, pageSize), IPage<Crontab> iPage = crontabMapper.selectPage(new Page<>(pageNo, pageSize),
new QueryWrapper<Crontab>() new QueryWrapper<Crontab>()
.eq("is_delete", 0) .isNull("delete_time")
.orderByDesc("id")); .orderByDesc("id"));
List<CrontabListedVo> list = new LinkedList<>(); List<CrontabListedVo> list = new LinkedList<>();
@ -94,7 +94,7 @@ public class CrontabServiceImpl implements ICrontabService {
Crontab crontab = crontabMapper.selectOne( Crontab crontab = crontabMapper.selectOne(
new QueryWrapper<Crontab>() new QueryWrapper<Crontab>()
.eq("id", id) .eq("id", id)
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")); .last("limit 1"));
Assert.notNull(crontab, "数据不存在!"); Assert.notNull(crontab, "数据不存在!");
@ -141,7 +141,7 @@ public class CrontabServiceImpl implements ICrontabService {
Crontab crontab = crontabMapper.selectOne( Crontab crontab = crontabMapper.selectOne(
new QueryWrapper<Crontab>() new QueryWrapper<Crontab>()
.eq("id", updateValidate.getId()) .eq("id", updateValidate.getId())
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")); .last("limit 1"));
Assert.notNull(crontab, "数据不存在!"); Assert.notNull(crontab, "数据不存在!");
@ -172,7 +172,7 @@ public class CrontabServiceImpl implements ICrontabService {
Crontab crontab = crontabMapper.selectOne( Crontab crontab = crontabMapper.selectOne(
new QueryWrapper<Crontab>() new QueryWrapper<Crontab>()
.eq("id", id) .eq("id", id)
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")); .last("limit 1"));
Assert.notNull(crontab, "数据不存在!"); Assert.notNull(crontab, "数据不存在!");

View File

@ -45,14 +45,14 @@ public class SettingDictDataServiceImpl implements ISettingDictDataService {
public List<SettingDictDataVo> all(Map<String, String> params) { public List<SettingDictDataVo> all(Map<String, String> params) {
DictType dictType = dictTypeMapper.selectOne(new QueryWrapper<DictType>() DictType dictType = dictTypeMapper.selectOne(new QueryWrapper<DictType>()
.eq("dict_type", params.get("dictType")) .eq("dict_type", params.get("dictType"))
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")); .last("limit 1"));
Assert.notNull(dictType, "该字典类型不存在!"); Assert.notNull(dictType, "该字典类型不存在!");
QueryWrapper<DictData> queryWrapper = new QueryWrapper<>(); QueryWrapper<DictData> queryWrapper = new QueryWrapper<>();
queryWrapper.select("id,type_id,name,value,remark,sort,status,create_time,update_time"); queryWrapper.select("id,type_id,name,value,remark,sort,status,create_time,update_time");
queryWrapper.eq("is_delete", 0); queryWrapper.isNull("delete_time");
queryWrapper.eq("type_id", dictType.getId()); queryWrapper.eq("type_id", dictType.getId());
queryWrapper.orderByDesc("id"); queryWrapper.orderByDesc("id");
@ -91,7 +91,7 @@ public class SettingDictDataServiceImpl implements ISettingDictDataService {
Integer limit = pageValidate.getPage_size(); Integer limit = pageValidate.getPage_size();
DictType dictType = dictTypeMapper.selectOne(new QueryWrapper<DictType>() DictType dictType = dictTypeMapper.selectOne(new QueryWrapper<DictType>()
.eq("is_delete", 0) .isNull("delete_time")
.eq("dict_type", params.get("dictType")) .eq("dict_type", params.get("dictType"))
.last("limit 1")); .last("limit 1"));
@ -100,7 +100,7 @@ public class SettingDictDataServiceImpl implements ISettingDictDataService {
QueryWrapper<DictData> queryWrapper = new QueryWrapper<>(); QueryWrapper<DictData> queryWrapper = new QueryWrapper<>();
queryWrapper.select("id,type_id,name,value,remark,sort,status,create_time,update_time"); queryWrapper.select("id,type_id,name,value,remark,sort,status,create_time,update_time");
queryWrapper.eq("type_id", dictType.getId()); queryWrapper.eq("type_id", dictType.getId());
queryWrapper.eq("is_delete", 0); queryWrapper.isNull("delete_time");
queryWrapper.orderByDesc("id"); queryWrapper.orderByDesc("id");
dictDataMapper.setSearch(queryWrapper, params, new String[]{ dictDataMapper.setSearch(queryWrapper, params, new String[]{
@ -136,7 +136,7 @@ public class SettingDictDataServiceImpl implements ISettingDictDataService {
DictData dictData = dictDataMapper.selectOne(new QueryWrapper<DictData>() DictData dictData = dictDataMapper.selectOne(new QueryWrapper<DictData>()
.select("id,type_id,name,value,remark,sort,status,create_time,update_time") .select("id,type_id,name,value,remark,sort,status,create_time,update_time")
.eq("id", id) .eq("id", id)
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")); .last("limit 1"));
Assert.notNull(dictData, "字典数据不存在!"); Assert.notNull(dictData, "字典数据不存在!");
@ -159,7 +159,7 @@ public class SettingDictDataServiceImpl implements ISettingDictDataService {
Assert.isNull(dictDataMapper.selectOne(new QueryWrapper<DictData>() Assert.isNull(dictDataMapper.selectOne(new QueryWrapper<DictData>()
.select("id") .select("id")
.eq("name", createValidate.getName()) .eq("name", createValidate.getName())
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")), "字典数据已存在!"); .last("limit 1")), "字典数据已存在!");
DictData model = new DictData(); DictData model = new DictData();
@ -184,7 +184,7 @@ public class SettingDictDataServiceImpl implements ISettingDictDataService {
public void edit(DictDataUpdateValidate updateValidate) { public void edit(DictDataUpdateValidate updateValidate) {
DictData model = dictDataMapper.selectOne(new QueryWrapper<DictData>() DictData model = dictDataMapper.selectOne(new QueryWrapper<DictData>()
.eq("id", updateValidate.getId()) .eq("id", updateValidate.getId())
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")); .last("limit 1"));
Assert.notNull(model, "字典数据不存在!"); Assert.notNull(model, "字典数据不存在!");
@ -193,7 +193,7 @@ public class SettingDictDataServiceImpl implements ISettingDictDataService {
.select("id") .select("id")
.ne("id", updateValidate.getId()) .ne("id", updateValidate.getId())
.eq("name", updateValidate.getName()) .eq("name", updateValidate.getName())
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")), "字典数据已存在!"); .last("limit 1")), "字典数据已存在!");
model.setName(updateValidate.getName()); model.setName(updateValidate.getName());

View File

@ -40,7 +40,7 @@ public class SettingDictTypeServiceImpl implements ISettingDictTypeService {
public List<SettingDictTypeVo> all() { public List<SettingDictTypeVo> all() {
QueryWrapper<DictType> queryWrapper = new QueryWrapper<>(); QueryWrapper<DictType> queryWrapper = new QueryWrapper<>();
queryWrapper.select("id,dict_name,dict_type,dict_remark,dict_status,create_time,update_time"); queryWrapper.select("id,dict_name,dict_type,dict_remark,dict_status,create_time,update_time");
queryWrapper.eq("is_delete", 0); queryWrapper.isNull("delete_time");
queryWrapper.orderByDesc("id"); queryWrapper.orderByDesc("id");
List<DictType> dictTypeList = dictTypeMapper.selectList(queryWrapper); List<DictType> dictTypeList = dictTypeMapper.selectList(queryWrapper);
@ -73,7 +73,7 @@ public class SettingDictTypeServiceImpl implements ISettingDictTypeService {
QueryWrapper<DictType> queryWrapper = new QueryWrapper<>(); QueryWrapper<DictType> queryWrapper = new QueryWrapper<>();
queryWrapper.select("id,dict_name,dict_type,dict_remark,dict_status,create_time,update_time"); queryWrapper.select("id,dict_name,dict_type,dict_remark,dict_status,create_time,update_time");
queryWrapper.eq("is_delete", 0); queryWrapper.isNull("delete_time");
queryWrapper.orderByDesc("id"); queryWrapper.orderByDesc("id");
dictTypeMapper.setSearch(queryWrapper, params, new String[]{ dictTypeMapper.setSearch(queryWrapper, params, new String[]{
@ -109,7 +109,7 @@ public class SettingDictTypeServiceImpl implements ISettingDictTypeService {
DictType dictType = dictTypeMapper.selectOne(new QueryWrapper<DictType>() DictType dictType = dictTypeMapper.selectOne(new QueryWrapper<DictType>()
.select("id,dict_name,dict_type,dict_remark,dict_status,create_time,update_time") .select("id,dict_name,dict_type,dict_remark,dict_status,create_time,update_time")
.eq("id", id) .eq("id", id)
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")); .last("limit 1"));
Assert.notNull(dictType, "字典类型不存在!"); Assert.notNull(dictType, "字典类型不存在!");
@ -132,13 +132,13 @@ public class SettingDictTypeServiceImpl implements ISettingDictTypeService {
Assert.isNull(dictTypeMapper.selectOne(new QueryWrapper<DictType>() Assert.isNull(dictTypeMapper.selectOne(new QueryWrapper<DictType>()
.select("id") .select("id")
.eq("dict_name", createValidate.getDictName()) .eq("dict_name", createValidate.getDictName())
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")), "字典名称已存在!"); .last("limit 1")), "字典名称已存在!");
Assert.isNull(dictTypeMapper.selectOne(new QueryWrapper<DictType>() Assert.isNull(dictTypeMapper.selectOne(new QueryWrapper<DictType>()
.select("id") .select("id")
.eq("dict_type", createValidate.getDictType()) .eq("dict_type", createValidate.getDictType())
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")), "字典类型已存在!"); .last("limit 1")), "字典类型已存在!");
DictType model = new DictType(); DictType model = new DictType();
@ -161,7 +161,7 @@ public class SettingDictTypeServiceImpl implements ISettingDictTypeService {
public void edit(DictTypeUpdateValidate updateValidate) { public void edit(DictTypeUpdateValidate updateValidate) {
DictType model = dictTypeMapper.selectOne(new QueryWrapper<DictType>() DictType model = dictTypeMapper.selectOne(new QueryWrapper<DictType>()
.eq("id", updateValidate.getId()) .eq("id", updateValidate.getId())
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")); .last("limit 1"));
Assert.notNull(model, "字典类型不存在!"); Assert.notNull(model, "字典类型不存在!");
@ -169,13 +169,13 @@ public class SettingDictTypeServiceImpl implements ISettingDictTypeService {
Assert.isNull(dictTypeMapper.selectOne(new QueryWrapper<DictType>() Assert.isNull(dictTypeMapper.selectOne(new QueryWrapper<DictType>()
.ne("id", updateValidate.getId()) .ne("id", updateValidate.getId())
.eq("dict_name", updateValidate.getDictName()) .eq("dict_name", updateValidate.getDictName())
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")), "字典类型已存在!"); .last("limit 1")), "字典类型已存在!");
Assert.isNull(dictTypeMapper.selectOne(new QueryWrapper<DictType>() Assert.isNull(dictTypeMapper.selectOne(new QueryWrapper<DictType>()
.ne("id", updateValidate.getId()) .ne("id", updateValidate.getId())
.eq("dict_type", updateValidate.getDictType()) .eq("dict_type", updateValidate.getDictType())
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")), "字典类型已存在!"); .last("limit 1")), "字典类型已存在!");
model.setDictName(updateValidate.getDictName()); model.setDictName(updateValidate.getDictName());

View File

@ -5,6 +5,7 @@ import com.mdd.admin.service.admin.IAdminDeptService;
import com.mdd.admin.service.admin.IAdminJobsService; import com.mdd.admin.service.admin.IAdminJobsService;
import com.mdd.common.entity.admin.AdminDept; import com.mdd.common.entity.admin.AdminDept;
import com.mdd.common.entity.admin.AdminJobs; import com.mdd.common.entity.admin.AdminJobs;
import com.mdd.common.entity.admin.AdminRole;
import com.mdd.common.mapper.admin.AdminDeptMapper; import com.mdd.common.mapper.admin.AdminDeptMapper;
import com.mdd.common.mapper.admin.AdminJobsMapper; import com.mdd.common.mapper.admin.AdminJobsMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -32,4 +33,22 @@ public class AdminDeptServiceImpl implements IAdminDeptService {
} }
return ret; return ret;
} }
@Override
public void batchInsert(Integer adminId, List<Integer> deptIds) {
this.deleteByAdminId(adminId);
if (deptIds != null && !deptIds.isEmpty()) {
deptIds.forEach(item-> {
this.adminDeptMapper.insert(new AdminDept(){{
setAdminId(adminId);
setDeptId(item);
}});
});
}
}
@Override
public void deleteByAdminId(Integer adminId) {
this.adminDeptMapper.delete(new QueryWrapper<AdminDept>().eq("admin_id", adminId));
}
} }

View File

@ -32,4 +32,22 @@ public class AdminJobsServiceImpl implements IAdminJobsService {
} }
return ret; return ret;
} }
@Override
public void batchInsert(Integer adminId, List<Integer> jobsIds) {
this.deleteByAdminId(adminId);
if (jobsIds != null && !jobsIds.isEmpty()) {
jobsIds.forEach(item-> {
this.adminJobsMapper.insert(new AdminJobs(){{
setAdminId(adminId);
setJobsId(item);
}});
});
}
}
@Override
public void deleteByAdminId(Integer adminId) {
this.adminJobsMapper.delete(new QueryWrapper<AdminJobs>().eq("admin_id", adminId));
}
} }

View File

@ -3,6 +3,7 @@ package com.mdd.admin.service.impl.admin;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mdd.admin.service.admin.IAdminRoleService; import com.mdd.admin.service.admin.IAdminRoleService;
import com.mdd.common.entity.admin.Admin; import com.mdd.common.entity.admin.Admin;
import com.mdd.common.entity.admin.AdminJobs;
import com.mdd.common.entity.admin.AdminRole; import com.mdd.common.entity.admin.AdminRole;
import com.mdd.common.mapper.admin.AdminRoleMapper; import com.mdd.common.mapper.admin.AdminRoleMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -20,7 +21,7 @@ public class AdminRoleServiceImpl implements IAdminRoleService {
AdminRoleMapper adminRoleMapper; AdminRoleMapper adminRoleMapper;
@Override @Override
public List<Integer> getRoleIdAttr(Integer adminId) { public List<Integer> getRoleIdAttr(Integer adminId) {
List<Integer> ret = new ArrayList<Integer>(); List<Integer> ret = new ArrayList<>();
List<AdminRole> rolesList = adminRoleMapper.selectList(new QueryWrapper<AdminRole>().eq("admin_id", adminId).select("role_id")); List<AdminRole> rolesList = adminRoleMapper.selectList(new QueryWrapper<AdminRole>().eq("admin_id", adminId).select("role_id"));
if (rolesList.size() > 0) { if (rolesList.size() > 0) {
for (AdminRole adminRole : rolesList) { for (AdminRole adminRole : rolesList) {
@ -29,4 +30,22 @@ public class AdminRoleServiceImpl implements IAdminRoleService {
} }
return ret; return ret;
} }
@Override
public void batchInsert(Integer adminId, List<Integer> roleIds) {
this.deleteByAdminId(adminId);
if (roleIds != null && !roleIds.isEmpty()) {
roleIds.forEach(item-> {
this.adminRoleMapper.insert(new AdminRole(){{
setAdminId(adminId);
setRoleId(item);
}});
});
}
}
@Override
public void deleteByAdminId(Integer adminId) {
this.adminRoleMapper.delete(new QueryWrapper<AdminRole>().eq("admin_id", adminId));
}
} }

View File

@ -20,10 +20,15 @@ import com.mdd.admin.vo.auth.AuthMySelfVo;
import com.mdd.admin.vo.system.*; import com.mdd.admin.vo.system.*;
import com.mdd.common.core.PageResult; import com.mdd.common.core.PageResult;
import com.mdd.common.entity.admin.Admin; import com.mdd.common.entity.admin.Admin;
import com.mdd.common.entity.admin.AdminDept;
import com.mdd.common.entity.admin.Dept;
import com.mdd.common.entity.system.Jobs;
import com.mdd.common.entity.system.SystemMenu; import com.mdd.common.entity.system.SystemMenu;
import com.mdd.common.entity.system.SystemRole; import com.mdd.common.entity.system.SystemRole;
import com.mdd.common.exception.OperateException; import com.mdd.common.exception.OperateException;
import com.mdd.common.mapper.admin.AdminMapper; import com.mdd.common.mapper.admin.AdminMapper;
import com.mdd.common.mapper.admin.DeptMapper;
import com.mdd.common.mapper.admin.JobsMapper;
import com.mdd.common.mapper.system.SystemMenuMapper; import com.mdd.common.mapper.system.SystemMenuMapper;
import com.mdd.common.mapper.system.SystemRoleMapper; import com.mdd.common.mapper.system.SystemRoleMapper;
import com.mdd.common.util.*; import com.mdd.common.util.*;
@ -56,6 +61,13 @@ public class AdminServiceImpl implements IAdminService {
IAdminDeptService iAdminDeptService; IAdminDeptService iAdminDeptService;
@Resource @Resource
IAdminJobsService iAdminJobsService; IAdminJobsService iAdminJobsService;
@Resource
JobsMapper jobsMapper;
@Resource
DeptMapper deptMapper;
@Resource @Resource
IAuthService iAuthService; IAuthService iAuthService;
@ -76,20 +88,21 @@ public class AdminServiceImpl implements IAdminService {
Integer limit = pageValidate.getPage_size(); Integer limit = pageValidate.getPage_size();
MPJQueryWrapper<Admin> mpjQueryWrapper = new MPJQueryWrapper<>(); MPJQueryWrapper<Admin> mpjQueryWrapper = new MPJQueryWrapper<>();
mpjQueryWrapper.select("t.id,t.username,t.nickname,t.avatar," + mpjQueryWrapper.select("distinct t.id,t.account,t.name,t.avatar," +
"t.role_ids as role,t.dept_ids as dept,t.is_multipoint," + "t.multipoint_login," +
"t.is_disable,t.last_login_ip,t.last_login_time,t.create_time,t.update_time") "t.disable,t.login_ip,t.login_time,t.create_time,t.update_time")
.eq("t.is_delete", 0) .leftJoin("la_admin_role lar ON lar.admin_id = t.id")
.orderByDesc(Arrays.asList("t.id", "t.sort")); .isNull("t.delete_time")
.orderByDesc(Arrays.asList("t.id"));
systemAuthAdminMapper.setSearch(mpjQueryWrapper, searchValidate, new String[]{ systemAuthAdminMapper.setSearch(mpjQueryWrapper, searchValidate, new String[]{
"like:username:str", "like:account:str",
"like:nickname:str" "like:name:str"
}); });
if (StringUtils.isNotNull(searchValidate.getRole())) { if (StringUtils.isNotNull(searchValidate.getRole())) {
mpjQueryWrapper.in("role_ids", Collections.singletonList(searchValidate.getRole())); mpjQueryWrapper.in("lar.role_id", searchValidate.getRole());
} }
IPage<SystemAuthAdminListedVo> iPage = systemAuthAdminMapper.selectJoinPage( IPage<SystemAuthAdminListedVo> iPage = systemAuthAdminMapper.selectJoinPage(
@ -99,25 +112,55 @@ public class AdminServiceImpl implements IAdminService {
for (SystemAuthAdminListedVo vo : iPage.getRecords()) { for (SystemAuthAdminListedVo vo : iPage.getRecords()) {
if (vo.getId().equals(1)) { if (vo.getId().equals(1)) {
vo.setRole("系统管理员"); vo.setRoleName("系统管理员");
vo.setDeptName("-");
} else { } else {
List<String> role = new LinkedList<>();
List<Integer> roleIds = ListUtils.stringToListAsInt(vo.getRole(), ","); List<SystemRole> roles = systemAuthRoleMapper.getByAdminId(vo.getId());
if (!roleIds.isEmpty()) { List<Integer> roleIds = new ArrayList<>();
List<SystemRole> roleList = systemAuthRoleMapper.selectList(new QueryWrapper<SystemRole>() List<String> roleNames = new ArrayList<>();
.select("id,name") if (!roles.isEmpty()) {
.in("id", roleIds)); roles.forEach(item-> {
for (SystemRole d : roleList) { roleIds.add(item.getId());
role.add(d.getName()); roleNames.add(item.getName());
}
});
vo.setRoleId(roleIds);
vo.setRoleName(StringUtils.join(roleNames, ","));
}
List<Jobs> jobs = jobsMapper.getByAdminId(vo.getId());
List<Integer> jobsId = new ArrayList<>();
List<String> jobsNames = new ArrayList<>();
if (!jobs.isEmpty()) {
roles.forEach(item-> {
jobsId.add(item.getId());
jobsNames.add(item.getName());
});
vo.setJobsId(jobsId);
vo.setJobsName(StringUtils.join(jobsNames, ","));
}
List<Dept> depts = deptMapper.getByAdminId(vo.getId());
List<Integer> deptIds = new ArrayList<>();
List<String> deptNames = new ArrayList<>();
if (!depts.isEmpty()) {
roles.forEach(item-> {
deptIds.add(item.getId());
deptNames.add(item.getName());
});
vo.setDeptId(deptIds);
vo.setDeptName(StringUtils.join(deptNames, ","));
} }
vo.setRole(ListUtils.listToStringByStr(role, ","));
} }
vo.setAvatar(UrlUtils.toAbsoluteUrl(vo.getAvatar())); vo.setAvatar(UrlUtils.toAbsoluteUrl(vo.getAvatar()));
vo.setCreateTime(TimeUtils.timestampToDate(vo.getCreateTime())); vo.setCreateTime(TimeUtils.timestampToDate(vo.getCreateTime()));
vo.setUpdateTime(TimeUtils.timestampToDate(vo.getUpdateTime())); vo.setUpdateTime(TimeUtils.timestampToDate(vo.getUpdateTime()));
vo.setLastLoginTime(TimeUtils.timestampToDate(vo.getLastLoginTime())); vo.setLoginTime(TimeUtils.timestampToDate(vo.getLoginTime()));
} }
return PageResult.iPageHandle(iPage); return PageResult.iPageHandle(iPage);
@ -135,11 +178,9 @@ public class AdminServiceImpl implements IAdminService {
// 管理员信息 // 管理员信息
Admin sysAdmin = systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>() Admin sysAdmin = systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>()
.select(Admin.class, info-> .select(Admin.class, info->
!info.getColumn().equals("salt") &&
!info.getColumn().equals("password") && !info.getColumn().equals("password") &&
!info.getColumn().equals("is_delete") &&
!info.getColumn().equals("delete_time")) !info.getColumn().equals("delete_time"))
.eq("is_delete", 0) .isNull("delete_time")
.eq("id", adminId) .eq("id", adminId)
.last("limit 1")); .last("limit 1"));
@ -195,10 +236,6 @@ public class AdminServiceImpl implements IAdminService {
@Override @Override
public SystemAuthAdminDetailVo detail(Integer id) { public SystemAuthAdminDetailVo detail(Integer id) {
Admin sysAdmin = systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>() Admin sysAdmin = systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>()
.select(Admin.class, info->
!info.getColumn().equals("salt") &&
!info.getColumn().equals("password") &&
!info.getColumn().equals("delete_time"))
.eq("id", id) .eq("id", id)
.isNull("delete_time") .isNull("delete_time")
.last("limit 1")); .last("limit 1"));
@ -211,9 +248,9 @@ public class AdminServiceImpl implements IAdminService {
vo.setCreateTime(TimeUtils.timestampToDate(sysAdmin.getCreateTime())); vo.setCreateTime(TimeUtils.timestampToDate(sysAdmin.getCreateTime()));
vo.setUpdateTime(TimeUtils.timestampToDate(sysAdmin.getUpdateTime())); vo.setUpdateTime(TimeUtils.timestampToDate(sysAdmin.getUpdateTime()));
vo.setLoginTime(TimeUtils.timestampToDate(sysAdmin.getLoginTime())); vo.setLoginTime(TimeUtils.timestampToDate(sysAdmin.getLoginTime()));
vo.setRoleIds(iAdminRoleService.getRoleIdAttr(sysAdmin.getId())); vo.setRoleId(iAdminRoleService.getRoleIdAttr(sysAdmin.getId()));
vo.setJobIds(iAdminJobsService.getJobIdAttr(sysAdmin.getId())); vo.setJobsId(iAdminJobsService.getJobIdAttr(sysAdmin.getId()));
vo.setDeptIds(iAdminDeptService.getDeptIdAttr(sysAdmin.getId())); vo.setDeptId(iAdminDeptService.getDeptIdAttr(sysAdmin.getId()));
return vo; return vo;
} }
@ -225,17 +262,17 @@ public class AdminServiceImpl implements IAdminService {
*/ */
@Override @Override
public void add(SystemAdminCreateValidate createValidate) { public void add(SystemAdminCreateValidate createValidate) {
String[] field = {"id", "username", "nickname"}; String[] field = {"id", "account", "name"};
Assert.isNull(systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>() Assert.isNull(systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>()
.select(field) .select(field)
.eq("is_delete", 0) .isNull("delete_time")
.eq("username", createValidate.getUsername()) .eq("account", createValidate.getAccount())
.last("limit 1")), "账号已存在换一个吧!"); .last("limit 1")), "账号已存在换一个吧!");
Assert.isNull(systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>() Assert.isNull(systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>()
.select(field) .select(field)
.eq("is_delete", 0) .isNull("delete_time")
.eq("nickname", createValidate.getNickname()) .eq("name", createValidate.getName())
.last("limit 1")), "昵称已存在换一个吧!"); .last("limit 1")), "昵称已存在换一个吧!");
String pwd = ToolUtils.makePassword(createValidate.getPassword().trim()); String pwd = ToolUtils.makePassword(createValidate.getPassword().trim());
@ -245,15 +282,26 @@ public class AdminServiceImpl implements IAdminService {
String avatar = StringUtils.isNotEmpty(createValidate.getAvatar()) ? UrlUtils.toRelativeUrl(createAvatar) : defaultAvatar; String avatar = StringUtils.isNotEmpty(createValidate.getAvatar()) ? UrlUtils.toRelativeUrl(createAvatar) : defaultAvatar;
Admin model = new Admin(); Admin model = new Admin();
model.setAccount(createValidate.getUsername()); model.setAccount(createValidate.getAccount());
model.setName(createValidate.getNickname()); model.setName(createValidate.getName());
model.setAvatar(avatar); model.setAvatar(avatar);
model.setPassword(pwd); model.setPassword(pwd);
model.setMultipointLogin(createValidate.getIsMultipoint()); model.setMultipointLogin(createValidate.getMultipointLogin());
model.setDisable(createValidate.getIsDisable()); model.setDisable(createValidate.getDisable());
model.setCreateTime(System.currentTimeMillis() / 1000); model.setCreateTime(System.currentTimeMillis() / 1000);
model.setUpdateTime(System.currentTimeMillis() / 1000); model.setUpdateTime(System.currentTimeMillis() / 1000);
systemAuthAdminMapper.insert(model); systemAuthAdminMapper.insert(model);
List<Integer> deptIds = createValidate.getDeptId();
List<Integer> jobsIds = createValidate.getJobsId();
List<Integer> roleIds = createValidate.getRoleId();
this.iAdminDeptService.batchInsert(model.getId(), deptIds);
this.iAdminJobsService.batchInsert(model.getId(), jobsIds);
this.iAdminRoleService.batchInsert(model.getId(), roleIds);
} }
/** /**
@ -269,41 +317,41 @@ public class AdminServiceImpl implements IAdminService {
throw new OperateException("您无权限编辑系统管理员!"); throw new OperateException("您无权限编辑系统管理员!");
} }
String[] field = {"id", "username", "nickname"}; String[] field = {"id", "account", "name"};
Assert.notNull(systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>() Assert.notNull(systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>()
.select(field) .select(field)
.eq("id", updateValidate.getId()) .eq("id", updateValidate.getId())
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")), "账号不存在了!"); .last("limit 1")), "账号不存在了!");
Assert.isNull(systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>() Assert.isNull(systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>()
.select(field) .select(field)
.eq("is_delete", 0) .isNull("delete_time")
.eq("username", updateValidate.getUsername()) .eq("account", updateValidate.getAccount())
.ne("id", updateValidate.getId()) .ne("id", updateValidate.getId())
.last("limit 1")), "账号已存在换一个吧!"); .last("limit 1")), "账号已存在换一个吧!");
Assert.isNull(systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>() Assert.isNull(systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>()
.select(field) .select(field)
.eq("is_delete", 0) .isNull("delete_time")
.eq("nickname", updateValidate.getNickname()) .eq("name", updateValidate.getName())
.ne("id", updateValidate.getId()) .ne("id", updateValidate.getId())
.last("limit 1")), "昵称已存在换一个吧!"); .last("limit 1")), "昵称已存在换一个吧!");
Admin model = new Admin(); Admin model = new Admin();
model.setId(updateValidate.getId()); model.setId(updateValidate.getId());
model.setName(updateValidate.getNickname()); model.setName(updateValidate.getName());
model.setAvatar(UrlUtils.toRelativeUrl(updateValidate.getAvatar())); model.setAvatar(UrlUtils.toRelativeUrl(updateValidate.getAvatar()));
model.setMultipointLogin(updateValidate.getIsMultipoint()); model.setMultipointLogin(updateValidate.getMultipointLogin());
model.setDisable(updateValidate.getIsDisable()); model.setDisable(updateValidate.getDisable());
model.setUpdateTime(System.currentTimeMillis() / 1000); model.setUpdateTime(System.currentTimeMillis() / 1000);
if (!updateValidate.getId().equals(1)) { if (!updateValidate.getId().equals(1)) {
model.setAccount(updateValidate.getUsername()); model.setAccount(updateValidate.getAccount());
} }
if (StringUtils.isNotNull(updateValidate.getPassword()) && StringUtils.isNotEmpty(updateValidate.getPassword())) { if (StringUtils.isNotNull(updateValidate.getPassword()) && StringUtils.isNotEmpty(updateValidate.getPassword())) {
String pwd = ToolUtils.makePassword( updateValidate.getPassword().trim()); String pwd = ToolUtils.makePassword(updateValidate.getPassword().trim());
model.setPassword(pwd); model.setPassword(pwd);
} }
@ -311,6 +359,17 @@ public class AdminServiceImpl implements IAdminService {
if (StringUtils.isNotNull(updateValidate.getPassword()) && StringUtils.isNotEmpty(updateValidate.getPassword())) { if (StringUtils.isNotNull(updateValidate.getPassword()) && StringUtils.isNotEmpty(updateValidate.getPassword())) {
StpUtil.kickout(updateValidate.getId()); StpUtil.kickout(updateValidate.getId());
} }
List<Integer> deptIds = updateValidate.getDeptId();
List<Integer> jobsIds = updateValidate.getJobsId();
List<Integer> roleIds = updateValidate.getRoleId();
this.iAdminDeptService.batchInsert(updateValidate.getId(), deptIds);
this.iAdminJobsService.batchInsert(updateValidate.getId(), jobsIds);
this.iAdminRoleService.batchInsert(updateValidate.getId(), roleIds);
} }
/** /**
@ -324,7 +383,7 @@ public class AdminServiceImpl implements IAdminService {
Admin model = systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>() Admin model = systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>()
.select("id,username,nickname,password,salt") .select("id,username,nickname,password,salt")
.eq("id", adminId) .eq("id", adminId)
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")); .last("limit 1"));
Assert.notNull(model, "账号不存在了!"); Assert.notNull(model, "账号不存在了!");
@ -362,11 +421,11 @@ public class AdminServiceImpl implements IAdminService {
*/ */
@Override @Override
public void del(Integer id, Integer adminId) { public void del(Integer id, Integer adminId) {
String[] field = {"id", "username", "nickname"}; String[] field = {"id", "account", "name"};
Assert.notNull(systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>() Assert.notNull(systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>()
.select(field) .select(field)
.eq("id", id) .eq("id", id)
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")), "账号已不存在!"); .last("limit 1")), "账号已不存在!");
Assert.isFalse(id.equals(1), "系统管理员不允许删除!"); Assert.isFalse(id.equals(1), "系统管理员不允许删除!");
@ -377,6 +436,9 @@ public class AdminServiceImpl implements IAdminService {
model.setDeleteTime(System.currentTimeMillis() / 1000); model.setDeleteTime(System.currentTimeMillis() / 1000);
systemAuthAdminMapper.updateById(model); systemAuthAdminMapper.updateById(model);
this.iAdminRoleService.deleteByAdminId(id);
this.iAdminJobsService.deleteByAdminId(id);
this.iAdminDeptService.deleteByAdminId(id);
StpUtil.kickout(id); StpUtil.kickout(id);
} }
@ -392,7 +454,7 @@ public class AdminServiceImpl implements IAdminService {
Admin systemAuthAdmin = systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>() Admin systemAuthAdmin = systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>()
.select("id,username,nickname,is_disable") .select("id,username,nickname,is_disable")
.eq("id", id) .eq("id", id)
.eq("is_delete", 0) .isNull("delete_time")
.last("limit 1")); .last("limit 1"));
Assert.notNull(systemAuthAdmin, "账号已不存在!"); Assert.notNull(systemAuthAdmin, "账号已不存在!");
@ -418,9 +480,9 @@ public class AdminServiceImpl implements IAdminService {
SystemAuthAdminDetailVo admin = detail(id); SystemAuthAdminDetailVo admin = detail(id);
AuthMySelfVo user = new AuthMySelfVo(); AuthMySelfVo user = new AuthMySelfVo();
BeanUtils.copyProperties(admin, user); BeanUtils.copyProperties(admin, user);
user.setDeptId(admin.getDeptIds()); user.setDeptId(admin.getDeptId());
user.setJobsId(admin.getJobIds()); user.setJobsId(admin.getJobsId());
user.setRoleId(admin.getRoleIds()); user.setRoleId(admin.getRoleId());
ret.setUser(user); ret.setUser(user);
return ret; return ret;
} }

View File

@ -45,7 +45,7 @@ public class JobsServiceImpl implements IJobsService {
@Override @Override
public List<JobsVo> all() { public List<JobsVo> all() {
List<Jobs> jobs = jobsMapper.selectList(new QueryWrapper<Jobs>() List<Jobs> jobs = jobsMapper.selectList(new QueryWrapper<Jobs>()
.eq("is_delete", 0) .isNull("delete_time")
.orderByDesc((Arrays.asList("sort", "id")))); .orderByDesc((Arrays.asList("sort", "id"))));
List<JobsVo> adminVoArrayList = new ArrayList<>(); List<JobsVo> adminVoArrayList = new ArrayList<>();

View File

@ -190,7 +190,7 @@ public class SystemMenuServiceImpl implements ISystemMenuService {
public void del(Integer id) { public void del(Integer id) {
SystemMenu model = systemAuthMenuMapper.selectOne( SystemMenu model = systemAuthMenuMapper.selectOne(
new QueryWrapper<SystemMenu>() new QueryWrapper<SystemMenu>()
.select("id,pid,menu_name") .select("id,pid,name")
.eq("id", id) .eq("id", id)
.last("limit 1")); .last("limit 1"));

View File

@ -209,7 +209,7 @@ public class SystemRoleServiceImpl implements ISystemRoleService {
Assert.isNull(adminMapper.selectOne(new QueryWrapper<Admin>() Assert.isNull(adminMapper.selectOne(new QueryWrapper<Admin>()
.select("id", "role_ids", "nickname") .select("id", "role_ids", "nickname")
.apply("find_in_set({0}, role_ids)", id) .apply("find_in_set({0}, role_ids)", id)
.eq("is_delete", 0)), .isNull("delete_time")),
"角色已被管理员使用,请先移除"); "角色已被管理员使用,请先移除");
systemRoleMapper.deleteById(id); systemRoleMapper.deleteById(id);

View File

@ -22,12 +22,12 @@ public class SystemAdminCreateValidate implements Serializable {
@NotEmpty(message = "账号不能为空") @NotEmpty(message = "账号不能为空")
@Length(min = 2, max = 20, message = "账号必须在2~20个字符内") @Length(min = 2, max = 20, message = "账号必须在2~20个字符内")
@ApiModelProperty(value = "登录账号", required = true) @ApiModelProperty(value = "登录账号", required = true)
private String username; private String account;
@NotEmpty(message = "昵称不能为空") @NotEmpty(message = "昵称不能为空")
@Length(min = 2, max = 30, message = "昵称必须在2~30个字符内") @Length(min = 2, max = 30, message = "昵称必须在2~30个字符内")
@ApiModelProperty(value = "用户昵称", required = true) @ApiModelProperty(value = "用户昵称", required = true)
private String nickname; private String name;
@NotEmpty(message = "密码不能为空") @NotEmpty(message = "密码不能为空")
@Length(min = 6, max = 32, message = "密码必须在6~32个字符内") @Length(min = 6, max = 32, message = "密码必须在6~32个字符内")
@ -37,12 +37,12 @@ public class SystemAdminCreateValidate implements Serializable {
@NotNull(message = "请选择是否禁用") @NotNull(message = "请选择是否禁用")
@IntegerContains(values = {0, 1}) @IntegerContains(values = {0, 1})
@ApiModelProperty(value = "是否禁用", required = true) @ApiModelProperty(value = "是否禁用", required = true)
private Integer isDisable; private Integer disable;
@NotNull(message = "请选择是否支持多端登录") @NotNull(message = "请选择是否支持多端登录")
@IntegerContains(values = {0, 1}) @IntegerContains(values = {0, 1})
@ApiModelProperty(value = "支持多端", required = true) @ApiModelProperty(value = "支持多端", required = true)
private Integer isMultipoint; private Integer multipointLogin;
@NotNull(message = "排序号不能为空") @NotNull(message = "排序号不能为空")
@DecimalMin(value = "0", message = "排序号值不能少于0") @DecimalMin(value = "0", message = "排序号值不能少于0")
@ -55,12 +55,12 @@ public class SystemAdminCreateValidate implements Serializable {
@NotNull(message = "请选择角色") @NotNull(message = "请选择角色")
@ApiModelProperty(value = "角色ID", required = true) @ApiModelProperty(value = "角色ID", required = true)
private List<Integer> roleIds; private List<Integer> roleId;
@ApiModelProperty(value = "部门ID") @ApiModelProperty(value = "部门ID")
private List<Integer> deptIds; private List<Integer> deptId;
@ApiModelProperty(value = "岗位ID") @ApiModelProperty(value = "岗位ID")
private List<Integer> postIds; private List<Integer> jobsId;
} }

View File

@ -26,12 +26,12 @@ public class SystemAdminUpdateValidate implements Serializable {
@NotEmpty(message = "账号不能为空") @NotEmpty(message = "账号不能为空")
@Length(min = 2, max = 20, message = "账号必须在2~20个字符内") @Length(min = 2, max = 20, message = "账号必须在2~20个字符内")
@ApiModelProperty(value = "登录账号", required = true) @ApiModelProperty(value = "登录账号", required = true)
private String username; private String account;
@NotEmpty(message = "昵称不能为空") @NotEmpty(message = "昵称不能为空")
@Length(min = 2, max = 30, message = "昵称必须在2~30个字符内") @Length(min = 2, max = 30, message = "昵称必须在2~30个字符内")
@ApiModelProperty(value = "用户昵称", required = true) @ApiModelProperty(value = "用户昵称", required = true)
private String nickname; private String name;
@ApiModelProperty(value = "登录密码") @ApiModelProperty(value = "登录密码")
private String password; private String password;
@ -39,12 +39,12 @@ public class SystemAdminUpdateValidate implements Serializable {
@NotNull(message = "请选择是否禁用") @NotNull(message = "请选择是否禁用")
@IntegerContains(values = {0, 1}) @IntegerContains(values = {0, 1})
@ApiModelProperty(value = "是否禁用", required = true) @ApiModelProperty(value = "是否禁用", required = true)
private Integer isDisable; private Integer disable;
@NotNull(message = "请选择是否支持多端登录") @NotNull(message = "请选择是否支持多端登录")
@IntegerContains(values = {0, 1}) @IntegerContains(values = {0, 1})
@ApiModelProperty(value = "支持多端", required = true) @ApiModelProperty(value = "支持多端", required = true)
private Integer isMultipoint; private Integer multipointLogin;
@NotNull(message = "排序号不能为空") @NotNull(message = "排序号不能为空")
@DecimalMin(value = "0", message = "排序号值不能少于0") @DecimalMin(value = "0", message = "排序号值不能少于0")
@ -57,12 +57,14 @@ public class SystemAdminUpdateValidate implements Serializable {
@NotNull(message = "请选择角色") @NotNull(message = "请选择角色")
@ApiModelProperty(value = "角色ID") @ApiModelProperty(value = "角色ID")
private List<Integer> roleIds; private List<Integer> roleId;
@ApiModelProperty(value = "部门ID") @ApiModelProperty(value = "部门ID")
private List<Integer> deptIds; private List<Integer> deptId;
@ApiModelProperty(value = "岗位ID") @ApiModelProperty(value = "岗位ID")
private List<Integer> postIds; private List<Integer> jobsId;
private Integer root;
} }

View File

@ -20,13 +20,13 @@ public class SystemAuthAdminDetailVo implements Serializable {
private Integer root; private Integer root;
@ApiModelProperty(value = "角色ID") @ApiModelProperty(value = "角色ID")
private List<Integer> roleIds; private List<Integer> roleId;
@ApiModelProperty(value = "部门ID") @ApiModelProperty(value = "部门ID")
private List<Integer> deptIds; private List<Integer> deptId;
@ApiModelProperty(value = "岗位ID") @ApiModelProperty(value = "岗位ID")
private List<Integer> jobIds; private List<Integer> jobsId;
@ApiModelProperty(value = "账号") @ApiModelProperty(value = "账号")
private String account; private String account;

View File

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
@Data @Data
@ApiModel("管理员列表Vo") @ApiModel("管理员列表Vo")
@ -16,31 +17,44 @@ public class SystemAuthAdminListedVo implements Serializable {
private Integer id; private Integer id;
@ApiModelProperty(value = "账号") @ApiModelProperty(value = "账号")
private String username; private String account;
@ApiModelProperty(value = "昵称") @ApiModelProperty(value = "昵称")
private String nickname; private String name;
@ApiModelProperty(value = "头像") @ApiModelProperty(value = "头像")
private String avatar; private String avatar;
@ApiModelProperty(value = "部门") @ApiModelProperty(value = "部门")
private String dept; private String deptName;
@ApiModelProperty(value = "角色") @ApiModelProperty(value = "角色")
private String role; private String roleName;
@ApiModelProperty(value = "岗位")
private String jobsName;
private List<Integer> roleId;
private List<Integer> deptId;
private List<Integer> jobsId;
@ApiModelProperty(value = "多端登录: [0=否, 1=是]") @ApiModelProperty(value = "多端登录: [0=否, 1=是]")
private Integer isMultipoint; private Integer multipointLogin;
@ApiModelProperty(value = "是否禁用: [0=否, 1=是]") @ApiModelProperty(value = "是否禁用: [0=否, 1=是]")
private Integer isDisable; private Integer disable;
private String disableDesc;
private Integer root;
@ApiModelProperty(value = "最后登录IP") @ApiModelProperty(value = "最后登录IP")
private String lastLoginIp; private String loginIp;
@ApiModelProperty(value = "最后登录时间") @ApiModelProperty(value = "最后登录时间")
private String lastLoginTime; private String loginTime;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private String createTime; private String createTime;

View File

@ -3,7 +3,12 @@ package com.mdd.common.mapper.admin;
import com.mdd.common.core.basics.IBaseMapper; import com.mdd.common.core.basics.IBaseMapper;
import com.mdd.common.entity.admin.AdminJobs; import com.mdd.common.entity.admin.AdminJobs;
import com.mdd.common.entity.admin.AdminRole; import com.mdd.common.entity.admin.AdminRole;
import com.mdd.common.entity.system.SystemRole;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/** /**
* 角色关联表Mapper * 角色关联表Mapper
@ -11,4 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface AdminJobsMapper extends IBaseMapper<AdminJobs> { public interface AdminJobsMapper extends IBaseMapper<AdminJobs> {
} }

View File

@ -3,6 +3,10 @@ package com.mdd.common.mapper.admin;
import com.mdd.common.core.basics.IBaseMapper; import com.mdd.common.core.basics.IBaseMapper;
import com.mdd.common.entity.admin.Dept; import com.mdd.common.entity.admin.Dept;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/** /**
* 部门表Mapper * 部门表Mapper
@ -10,4 +14,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface DeptMapper extends IBaseMapper<Dept> { public interface DeptMapper extends IBaseMapper<Dept> {
@Select("SELECT * FROM la_dept dept INNER JOIN la_admin_dept lad ON lad.dept_id = dept.id WHERE lad.admin_id = #{adminId} AND dept.delete_time IS NULL")
List<Dept> getByAdminId(@Param("adminId") Integer adminId);
} }

View File

@ -1,9 +1,14 @@
package com.mdd.common.mapper.admin; package com.mdd.common.mapper.admin;
import com.mdd.common.core.basics.IBaseMapper; import com.mdd.common.core.basics.IBaseMapper;
import com.mdd.common.entity.admin.AdminJobs;
import com.mdd.common.entity.admin.Dept; import com.mdd.common.entity.admin.Dept;
import com.mdd.common.entity.system.Jobs; import com.mdd.common.entity.system.Jobs;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/** /**
* 岗位表Mapper * 岗位表Mapper
@ -11,4 +16,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface JobsMapper extends IBaseMapper<Jobs> { public interface JobsMapper extends IBaseMapper<Jobs> {
@Select("SELECT * FROM la_jobs jobs INNER JOIN la_admin_jobs laj ON laj.jobs_id = jobs.id WHERE laj.admin_id = #{adminId} AND jobs.delete_time IS NULL")
List<Jobs> getByAdminId(@Param("adminId") Integer adminId);
} }

View File

@ -3,10 +3,19 @@ package com.mdd.common.mapper.system;
import com.mdd.common.core.basics.IBaseMapper; import com.mdd.common.core.basics.IBaseMapper;
import com.mdd.common.entity.system.SystemRole; import com.mdd.common.entity.system.SystemRole;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/** /**
* 系统角色Mapper * 系统角色Mapper
*/ */
@Mapper @Mapper
public interface SystemRoleMapper extends IBaseMapper<SystemRole> { public interface SystemRoleMapper extends IBaseMapper<SystemRole> {
@Select("SELECT * FROM la_system_role role INNER JOIN la_admin_role lar ON lar.role_id = role.id WHERE lar.admin_id = #{adminId} AND role.delete_time IS NULL")
List<SystemRole> getByAdminId(@Param("adminId") Integer adminId);
} }

View File

@ -18,7 +18,10 @@ public class TimeUtils {
* @return String * @return String
*/ */
public static String timestampToDate(Long time) { public static String timestampToDate(Long time) {
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(time * 1000)); if (time != null) {
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(time * 1000));
}
return "-";
} }
/** /**