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

修改教室的数据库存储

parent b4b04873
...@@ -37,6 +37,8 @@ public interface BRoomsRepository extends BaseMapper<BRooms> { ...@@ -37,6 +37,8 @@ public interface BRoomsRepository extends BaseMapper<BRooms> {
@Select("<script>select count(*) from b_rooms where code = #{code} </script>") @Select("<script>select count(*) from b_rooms where code = #{code} </script>")
int avoidRepeatCode(String code); 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); int addExcel(List<BRooms> list);
} }
......
...@@ -69,6 +69,9 @@ public class BRooms extends IdEntity<BRooms> { ...@@ -69,6 +69,9 @@ public class BRooms extends IdEntity<BRooms> {
@Transient @Transient
private String transitCategory; private String transitCategory;
@Transient
private String transitBuilding;
@Transient @Transient
private String condition;//模糊查询条件 private String condition;//模糊查询条件
...@@ -91,6 +94,27 @@ public class BRooms extends IdEntity<BRooms> { ...@@ -91,6 +94,27 @@ public class BRooms extends IdEntity<BRooms> {
return this.transitCampus; 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(){ public String getTransitCategory(){
if(this.transitCategory != null && !this.transitCategory.equals("")){ if(this.transitCategory != null && !this.transitCategory.equals("")){
switch (this.transitCategory) { switch (this.transitCategory) {
......
...@@ -50,6 +50,8 @@ public class BRoomsServiceImpl implements BRoomsService { ...@@ -50,6 +50,8 @@ public class BRoomsServiceImpl implements BRoomsService {
//判断是否存在重复编码 //判断是否存在重复编码
if(bRoomsRepository.avoidRepeatCode(bRooms.getCode()) != 0){ if(bRoomsRepository.avoidRepeatCode(bRooms.getCode()) != 0){
throw new ServiceException(ResultServiceEnums.EXISE_ROOM_CODE); throw new ServiceException(ResultServiceEnums.EXISE_ROOM_CODE);
}else if(bRoomsRepository.avoidRepeatCode2(bRooms.getClassroomName()) != 0){
throw new ServiceException(ResultServiceEnums.EXISE_ROOM_NAME);
}else{ }else{
bRooms.setCommonBusinessId(); bRooms.setCommonBusinessId();
//增加操作 //增加操作
...@@ -88,6 +90,15 @@ public class BRoomsServiceImpl implements BRoomsService { ...@@ -88,6 +90,15 @@ public class BRoomsServiceImpl implements BRoomsService {
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT) @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override @Override
public PersistModel merge(BRooms bRooms){ 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); UserUtil.setCurrentMergeOperation(bRooms);
int line = bRoomsRepository.updateByPrimaryKeySelective(bRooms); int line = bRoomsRepository.updateByPrimaryKeySelective(bRooms);
log.info(UserUtil.getUserInfoProp(bRooms.getToken(),UserUtil.USER_USERNAME)+"修改了ID为"+ log.info(UserUtil.getUserInfoProp(bRooms.getToken(),UserUtil.USER_USERNAME)+"修改了ID为"+
...@@ -144,6 +155,14 @@ public class BRoomsServiceImpl implements BRoomsService { ...@@ -144,6 +155,14 @@ public class BRoomsServiceImpl implements BRoomsService {
result += "表中第 " + index + " 行,编号 " + value[1] + " 在表中重复 \n"; result += "表中第 " + index + " 行,编号 " + value[1] + " 在表中重复 \n";
continue; 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位数 //Int最大值为2147483648,所以不能超过9位数
if(value[5].length() >= 9){ if(value[5].length() >= 9){
result += "表中第 " + index + " 行,编号 " + value[1] + " 的数据座位数不合法 \n"; result += "表中第 " + index + " 行,编号 " + value[1] + " 的数据座位数不合法 \n";
......
...@@ -190,7 +190,15 @@ public enum ResultServiceEnums { ...@@ -190,7 +190,15 @@ public enum ResultServiceEnums {
CAN_NOT_OVERLAP(101,"时间区间不可重叠"), 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; private Integer code;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<result column="campus" jdbcType="VARCHAR" property="campus"/> <result column="campus" jdbcType="VARCHAR" property="campus"/>
<result column="campus" jdbcType="VARCHAR" property="transitCampus"/> <result column="campus" jdbcType="VARCHAR" property="transitCampus"/>
<result column="building" jdbcType="VARCHAR" property="building"/> <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_no" jdbcType="VARCHAR" property="classroomNo"/>
<result column="classroom_name" jdbcType="VARCHAR" property="classroomName"/> <result column="classroom_name" jdbcType="VARCHAR" property="classroomName"/>
<result column="category" jdbcType="VARCHAR" property="category"/> <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