Commit 460f091b authored by 李博今's avatar 李博今

修改教室的数据库存储

parent b4b04873
......@@ -37,6 +37,8 @@ public interface BRoomsRepository extends BaseMapper<BRooms> {
@Select("<script>select count(*) from b_rooms where code = #{code} </script>")
int avoidRepeatCode(String code);
@Select("<script>select count(*) from b_rooms where classroom_name = #{classroomName} </script>")
int avoidRepeatCode2(String classroomName);
int addExcel(List<BRooms> list);
}
......
......@@ -69,6 +69,9 @@ public class BRooms extends IdEntity<BRooms> {
@Transient
private String transitCategory;
@Transient
private String transitBuilding;
@Transient
private String condition;//模糊查询条件
......@@ -91,6 +94,27 @@ public class BRooms extends IdEntity<BRooms> {
return this.transitCampus;
}
public String getTransitBuilding(){
if(this.building != null && !this.building.equals("")){
switch (this.building) {
case "0":
this.transitBuilding = "A区";
break;
case "1":
this.transitBuilding = "B区";
break;
case "2":
this.transitBuilding = "C区";
break;
case "3":
this.transitBuilding = "D区";
break;
}
}
return this.transitBuilding;
}
public String getTransitCategory(){
if(this.transitCategory != null && !this.transitCategory.equals("")){
switch (this.transitCategory) {
......
......@@ -50,6 +50,8 @@ public class BRoomsServiceImpl implements BRoomsService {
//判断是否存在重复编码
if(bRoomsRepository.avoidRepeatCode(bRooms.getCode()) != 0){
throw new ServiceException(ResultServiceEnums.EXISE_ROOM_CODE);
}else if(bRoomsRepository.avoidRepeatCode2(bRooms.getClassroomName()) != 0){
throw new ServiceException(ResultServiceEnums.EXISE_ROOM_NAME);
}else{
bRooms.setCommonBusinessId();
//增加操作
......@@ -88,6 +90,15 @@ public class BRoomsServiceImpl implements BRoomsService {
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel merge(BRooms bRooms){
// if((bRooms.getCode() != null && !bRooms.getCode().equals("")) && bRooms.getCode().length() > 50){
// throw new ServiceException(ResultServiceEnums.ROOM_CODE_TOO_LONG);
// }
// if((bRooms.getClassroomNo() != null && !bRooms.getClassroomNo().equals("")) && bRooms.getClassroomNo().length() > 5){
// throw new ServiceException(ResultServiceEnums.ROOM_BUILDINGNO_TOO_LONG);
// }
// if((bRooms.getClassSeat() != null && bRooms.getClassSeat() > 10000)){
// throw new ServiceException(ResultServiceEnums.ROOM_SEAT_TOO_MANY);
// }
UserUtil.setCurrentMergeOperation(bRooms);
int line = bRoomsRepository.updateByPrimaryKeySelective(bRooms);
log.info(UserUtil.getUserInfoProp(bRooms.getToken(),UserUtil.USER_USERNAME)+"修改了ID为"+
......@@ -144,6 +155,14 @@ public class BRoomsServiceImpl implements BRoomsService {
result += "表中第 " + index + " 行,编号 " + value[1] + " 在表中重复 \n";
continue;
}
// if(value[1].length() > 50){
// result += "表中第 " + index + " 行,编号 " + value[1] + " 太长 \n";
// continue;
// }
// if(value[3].length() > 50){
// result += "表中第 " + index + " 行,编号 " + value[3] + " 太长 \n";
// continue;
// }
//Int最大值为2147483648,所以不能超过9位数
if(value[5].length() >= 9){
result += "表中第 " + index + " 行,编号 " + value[1] + " 的数据座位数不合法 \n";
......
......@@ -190,7 +190,15 @@ public enum ResultServiceEnums {
CAN_NOT_OVERLAP(101,"时间区间不可重叠"),
ROLE_HAS_USED(102,"当前角色被使用,不可删除")
ROLE_HAS_USED(102,"当前角色被使用,不可删除"),
EXISE_ROOM_NAME(103,"当前教室名已存在"),
ROOM_CODE_TOO_LONG(104,"编号长度过长"),
ROOM_BUILDINGNO_TOO_LONG(105,"教室号长度过长"),
ROOM_SEAT_TOO_MANY(106,"人数过多")
;
private Integer code;
......
......@@ -6,6 +6,7 @@
<result column="campus" jdbcType="VARCHAR" property="campus"/>
<result column="campus" jdbcType="VARCHAR" property="transitCampus"/>
<result column="building" jdbcType="VARCHAR" property="building"/>
<result column="building" jdbcType="VARCHAR" property="transitBuilding"/>
<result column="classroom_no" jdbcType="VARCHAR" property="classroomNo"/>
<result column="classroom_name" jdbcType="VARCHAR" property="classroomName"/>
<result column="category" jdbcType="VARCHAR" property="category"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment