添加外校老师住宿信息设置功能
This commit is contained in:
parent
201c5d378e
commit
fc68d7d918
|
@ -1,11 +1,14 @@
|
|||
package org.jeecg.modules.contoller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSON;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
|
@ -19,8 +22,9 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Description: 宿舍信息表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-03-03
|
||||
|
@ -84,6 +88,15 @@ public class CeesDormitoryInfoController extends JeecgController<CeesDormitoryIn
|
|||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据性别查询宿舍信息
|
||||
* @param sex
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/selectBySex")
|
||||
public Result<JSONArray> selectBySex(@RequestParam(name="sex",required=true) String sex) {
|
||||
return ceesDormitoryInfoService.selectBySex(sex);
|
||||
}
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
|
|
|
@ -36,6 +36,14 @@ public class CeesWaiTeacherController extends JeecgController<CeesWaiTeacher, IC
|
|||
@Autowired
|
||||
private ICeesWaiTeacherService ceesWaiTeacherService;
|
||||
|
||||
|
||||
@GetMapping("updataDormitory")
|
||||
public Result updataDormitory(@RequestParam String id, @RequestParam String dormitory){
|
||||
return ceesWaiTeacherService.updataDormitory(id,dormitory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
|
|
|
@ -72,7 +72,7 @@ public class CeesUser implements Serializable {
|
|||
/**组id*/
|
||||
@Excel(name = "组id", width = 15)
|
||||
@ApiModelProperty(value = "组id")
|
||||
private Integer groupId;
|
||||
private String groupId;
|
||||
/**身份:管理员1 学生2,老师 3 ,外校老师4*/
|
||||
@Excel(name = "身份:管理员1 学生2,老师 3 ,外校老师4", width = 15)
|
||||
@ApiModelProperty(value = "身份:管理员1 学生2,老师 3 ,外校老师4")
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.CeesDormitoryInfo;
|
||||
|
||||
/**
|
||||
|
@ -11,4 +14,5 @@ import org.jeecg.modules.entity.CeesDormitoryInfo;
|
|||
*/
|
||||
public interface ICeesDormitoryInfoService extends IService<CeesDormitoryInfo> {
|
||||
|
||||
Result<JSONArray> selectBySex(String sex);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.service;
|
|||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.CeesWaiTeacher;
|
||||
|
||||
/**
|
||||
|
@ -12,4 +13,5 @@ import org.jeecg.modules.entity.CeesWaiTeacher;
|
|||
*/
|
||||
public interface ICeesWaiTeacherService extends IService<CeesWaiTeacher> {
|
||||
|
||||
Result updataDormitory(String id, String dormitory);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.CeesDormitoryInfo;
|
||||
import org.jeecg.modules.mapper.CeesDormitoryInfoMapper;
|
||||
import org.jeecg.modules.service.ICeesDormitoryInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 宿舍信息表
|
||||
* @Author: jeecg-boot
|
||||
|
@ -16,4 +25,31 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class CeesDormitoryInfoServiceImpl extends ServiceImpl<CeesDormitoryInfoMapper, CeesDormitoryInfo> implements ICeesDormitoryInfoService {
|
||||
|
||||
@Autowired
|
||||
private CeesDormitoryInfoMapper ceesDormitoryInfoMapper;
|
||||
|
||||
@Override
|
||||
public Result<JSONArray> selectBySex(String sex) {
|
||||
//todo: 未添加宿舍满员的情况和宿舍是否正常使用
|
||||
Integer type = Integer.parseInt(sex);
|
||||
LambdaQueryWrapper<CeesDormitoryInfo> wrapper = new LambdaQueryWrapper<>();
|
||||
if (sex != null) {
|
||||
wrapper.eq(CeesDormitoryInfo::getDormitoryType, type);
|
||||
}
|
||||
List<CeesDormitoryInfo> list = ceesDormitoryInfoMapper.selectList(wrapper);
|
||||
JSONArray resultArray = new JSONArray();
|
||||
for(CeesDormitoryInfo dorm :list){
|
||||
JSONObject resultData = new JSONObject();
|
||||
resultData.put("sysOrgCode", dorm.getSysOrgCode());
|
||||
resultData.put("dormitory", dorm.getDormitory());
|
||||
resultData.put("dormitoryType", dorm.getDormitoryType());
|
||||
resultData.put("dormitoryNum", dorm.getDormitoryNum());
|
||||
resultData.put("dormitoryStatus", dorm.getDormitoryStatus());
|
||||
resultArray.add(resultData);
|
||||
}
|
||||
// 将整个数组封装为最终结果
|
||||
Result<JSONArray> result = new Result<>();
|
||||
result.setResult(resultArray);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.CeesWaiTeacher;
|
||||
import org.jeecg.modules.mapper.CeesWaiTeacherMapper;
|
||||
import org.jeecg.modules.service.ICeesWaiTeacherService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
|
@ -15,5 +18,15 @@ import org.springframework.stereotype.Service;
|
|||
*/
|
||||
@Service
|
||||
public class CeesWaiTeacherServiceImpl extends ServiceImpl<CeesWaiTeacherMapper, CeesWaiTeacher> implements ICeesWaiTeacherService {
|
||||
|
||||
@Autowired
|
||||
private CeesWaiTeacherMapper ceesWaiTeacherMapper;
|
||||
@Override
|
||||
public Result updataDormitory(String id, String dormitory) {
|
||||
LambdaQueryWrapper<CeesWaiTeacher> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(CeesWaiTeacher::getUserId,id);
|
||||
CeesWaiTeacher ceesWaiTeacher = ceesWaiTeacherMapper.selectOne(wrapper);
|
||||
ceesWaiTeacher.setDormitory(dormitory);
|
||||
int result = ceesWaiTeacherMapper.updateById(ceesWaiTeacher);
|
||||
return Result.ok("更新成功");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue