宿舍管理添加所属学科,删除按钮单独分配权限
This commit is contained in:
parent
fcff4155b0
commit
a2c80ba34d
|
@ -54,10 +54,12 @@ public class CeesDormitoryInfoController extends JeecgController<CeesDormitoryIn
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
QueryWrapper<CeesDormitoryInfo> queryWrapper = QueryGenerator.initQueryWrapper(ceesDormitoryInfo, req.getParameterMap());
|
return Result.OK(ceesDormitoryInfoService.queryPageList(ceesDormitoryInfo,pageNo,pageSize,req));
|
||||||
Page<CeesDormitoryInfo> page = new Page<CeesDormitoryInfo>(pageNo, pageSize);
|
|
||||||
IPage<CeesDormitoryInfo> pageList = ceesDormitoryInfoService.page(page, queryWrapper);
|
// QueryWrapper<CeesDormitoryInfo> queryWrapper = QueryGenerator.initQueryWrapper(ceesDormitoryInfo, req.getParameterMap());
|
||||||
return Result.OK(pageList);
|
// Page<CeesDormitoryInfo> page = new Page<CeesDormitoryInfo>(pageNo, pageSize);
|
||||||
|
// IPage<CeesDormitoryInfo> pageList = ceesDormitoryInfoService.page(page, queryWrapper);
|
||||||
|
// return Result.OK(pageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.jeecg.modules.entity;
|
package org.jeecg.modules.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
@ -68,4 +69,14 @@ public class CeesDormitoryInfo implements Serializable {
|
||||||
@Excel(name = "宿舍状态0没满,1已满", width = 15)
|
@Excel(name = "宿舍状态0没满,1已满", width = 15)
|
||||||
@ApiModelProperty(value = "宿舍状态0没满,1已满")
|
@ApiModelProperty(value = "宿舍状态0没满,1已满")
|
||||||
private Integer dormitoryStatus;
|
private Integer dormitoryStatus;
|
||||||
|
/**
|
||||||
|
*该宿舍所属学科
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "学科id")
|
||||||
|
private Integer majorId;
|
||||||
|
/**专业id*/
|
||||||
|
@Excel(name = "学科描述", width = 15)
|
||||||
|
@ApiModelProperty(value = "专业id")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String majorIdDescription;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,13 @@ package org.jeecg.modules.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.modules.entity.CeesDormitoryInfo;
|
import org.jeecg.modules.entity.CeesDormitoryInfo;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 宿舍信息表
|
* @Description: 宿舍信息表
|
||||||
* @Author: jeecg-boot
|
* @Author: jeecg-boot
|
||||||
|
@ -15,4 +18,6 @@ import org.jeecg.modules.entity.CeesDormitoryInfo;
|
||||||
public interface ICeesDormitoryInfoService extends IService<CeesDormitoryInfo> {
|
public interface ICeesDormitoryInfoService extends IService<CeesDormitoryInfo> {
|
||||||
|
|
||||||
Result<JSONArray> selectBySex(String sex);
|
Result<JSONArray> selectBySex(String sex);
|
||||||
|
|
||||||
|
IPage<CeesDormitoryInfo> queryPageList(CeesDormitoryInfo ceesDormitoryInfo, Integer pageNo, Integer pageSize, HttpServletRequest req);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,20 +4,35 @@ package org.jeecg.modules.service.impl;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.system.vo.LoginUser;
|
||||||
import org.jeecg.modules.entity.CeesDormitoryInfo;
|
import org.jeecg.modules.entity.CeesDormitoryInfo;
|
||||||
|
import org.jeecg.modules.enums.MajorEnum;
|
||||||
import org.jeecg.modules.mapper.CeesDormitoryInfoMapper;
|
import org.jeecg.modules.mapper.CeesDormitoryInfoMapper;
|
||||||
import org.jeecg.modules.service.ICeesDormitoryInfoService;
|
import org.jeecg.modules.service.ICeesDormitoryInfoService;
|
||||||
|
import org.jeecg.modules.system.entity.SysRole;
|
||||||
|
import org.jeecg.modules.system.entity.SysUserRole;
|
||||||
|
import org.jeecg.modules.system.mapper.SysRoleMapper;
|
||||||
|
import org.jeecg.modules.system.mapper.SysUserRoleMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 宿舍信息表
|
* @Description: 宿舍信息表
|
||||||
* @Author: jeecg-boot
|
* @Author: jeecg-boot
|
||||||
* @Date: 2025-03-03
|
* @Date: 2025-03-03
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@ -25,9 +40,13 @@ public class CeesDormitoryInfoServiceImpl extends ServiceImpl<CeesDormitoryInfoM
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private CeesDormitoryInfoMapper ceesDormitoryInfoMapper;
|
private CeesDormitoryInfoMapper ceesDormitoryInfoMapper;
|
||||||
|
@Resource
|
||||||
|
SysRoleMapper sysRoleMapper;
|
||||||
|
@Resource
|
||||||
|
SysUserRoleMapper sysUserRoleMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<JSONArray> selectBySex(String sex) {
|
public Result<JSONArray> selectBySex(String sex) {
|
||||||
//todo: 未添加宿舍满员的情况和宿舍是否正常使用
|
//todo: 未添加宿舍满员的情况和宿舍是否正常使用
|
||||||
Integer type = Integer.parseInt(sex);
|
Integer type = Integer.parseInt(sex);
|
||||||
LambdaQueryWrapper<CeesDormitoryInfo> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CeesDormitoryInfo> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
@ -37,7 +56,7 @@ public class CeesDormitoryInfoServiceImpl extends ServiceImpl<CeesDormitoryInfoM
|
||||||
}
|
}
|
||||||
List<CeesDormitoryInfo> list = ceesDormitoryInfoMapper.selectList(wrapper);
|
List<CeesDormitoryInfo> list = ceesDormitoryInfoMapper.selectList(wrapper);
|
||||||
JSONArray resultArray = new JSONArray();
|
JSONArray resultArray = new JSONArray();
|
||||||
for(CeesDormitoryInfo dorm :list){
|
for (CeesDormitoryInfo dorm : list) {
|
||||||
JSONObject resultData = new JSONObject();
|
JSONObject resultData = new JSONObject();
|
||||||
resultData.put("id", dorm.getId());
|
resultData.put("id", dorm.getId());
|
||||||
resultData.put("sysOrgCode", dorm.getSysOrgCode());
|
resultData.put("sysOrgCode", dorm.getSysOrgCode());
|
||||||
|
@ -52,4 +71,36 @@ public class CeesDormitoryInfoServiceImpl extends ServiceImpl<CeesDormitoryInfoM
|
||||||
result.setResult(resultArray);
|
result.setResult(resultArray);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<CeesDormitoryInfo> queryPageList(CeesDormitoryInfo ceesDormitoryInfo, Integer pageNo, Integer pageSize, HttpServletRequest req) {
|
||||||
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
String userId = user.getId();
|
||||||
|
|
||||||
|
// 查询当前用户的角色
|
||||||
|
LambdaQueryWrapper<SysUserRole> queryUserRole = new LambdaQueryWrapper<>();
|
||||||
|
queryUserRole.eq(SysUserRole::getUserId, userId);
|
||||||
|
SysUserRole sysUserRole = sysUserRoleMapper.selectOne(queryUserRole);
|
||||||
|
String roleId = sysUserRole.getRoleId();
|
||||||
|
|
||||||
|
// 获取对应角色数据
|
||||||
|
LambdaQueryWrapper<SysRole> queryRole = new LambdaQueryWrapper<>();
|
||||||
|
queryRole.eq(SysRole::getId, roleId);
|
||||||
|
SysRole sysRole = sysRoleMapper.selectOne(queryRole);
|
||||||
|
String roleCode = sysRole.getRoleCode();
|
||||||
|
|
||||||
|
QueryWrapper<CeesDormitoryInfo> queryWrapper = QueryGenerator.initQueryWrapper(ceesDormitoryInfo, req.getParameterMap());
|
||||||
|
if (roleCode.length() == 1) {
|
||||||
|
queryWrapper.eq("major_id", roleCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
Page<CeesDormitoryInfo> page = new Page<>(pageNo, pageSize);
|
||||||
|
IPage<CeesDormitoryInfo> pageList = page(page, queryWrapper);
|
||||||
|
// 设置学科描述
|
||||||
|
pageList.convert(e -> {
|
||||||
|
e.setMajorIdDescription(MajorEnum.describe(e.getMajorId())); // 设置学科描述
|
||||||
|
return e;
|
||||||
|
});
|
||||||
|
return pageList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue