Commit deac2c4f authored by hanshuai's avatar hanshuai

hanshuai stop/start

parent d2872de4
...@@ -389,6 +389,7 @@ ...@@ -389,6 +389,7 @@
<artifactId>eduLk</artifactId> <artifactId>eduLk</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
......
package org.rcisoft.business.bclass.controller; package org.rcisoft.business.bclass.controller;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
......
...@@ -71,4 +71,32 @@ public class BCourseCodeController extends PaginationController<BCourseCode> { ...@@ -71,4 +71,32 @@ public class BCourseCodeController extends PaginationController<BCourseCode> {
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bCourseCodeServiceImpl.findAll(bCourseCode)); bCourseCodeServiceImpl.findAll(bCourseCode));
} }
@ApiOperation(value="启用课程节点", notes="启用课程节点")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId,拼在地址栏中", required = true, dataType = "varchar")})
@PostMapping("/startFlag")
@PreAuthorize("hasRole('ROLE_1001')")
public Result startFlag(@ApiIgnore String businessId) {
BCourseCode bCourseCode = new BCourseCode();
bCourseCode.setToken(getToken());
PersistModel data = bCourseCodeServiceImpl.startFlag(businessId);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bCourseCode);
}
@ApiOperation(value="停用课程节点", notes="停用课程节点")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId,拼在地址栏中", required = true, dataType = "varchar")})
@PostMapping("/stopFlag")
@PreAuthorize("hasRole('ROLE_1001')")
public Result stopFlag(@ApiIgnore String businessId) {
BCourseCode bCourseCode = new BCourseCode();
bCourseCode.setToken(getToken());
PersistModel data = bCourseCodeServiceImpl.stopFlag(businessId);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bCourseCode);
}
} }
package org.rcisoft.business.bcoursecode.dao; package org.rcisoft.business.bcoursecode.dao;
import org.apache.ibatis.annotations.Update;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.bcoursecode.entity.BCourseCode; import org.rcisoft.business.bcoursecode.entity.BCourseCode;
import org.apache.ibatis.annotations.ResultMap; import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.rcisoft.core.model.PersistModel;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -25,5 +27,18 @@ public interface BCourseCodeRepository extends BaseMapper<BCourseCode> { ...@@ -25,5 +27,18 @@ public interface BCourseCodeRepository extends BaseMapper<BCourseCode> {
+ "</script>") + "</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BCourseCode> queryBCourseCodes(BCourseCode bCourseCode); List<BCourseCode> queryBCourseCodes(BCourseCode bCourseCode);
@Update("update b_course_code set flag = 1 where business_id = #{0}")
int startFlag(String businessId);
@Update("update b_course_code set flag = 0 where business_id = #{0}")
int stopFlag(String businessId);
@Select("select count(*) from b_course_code where business_id > #{id} and flag=1 and del_flag = 0 ")
int select_flag_stop(int id);
@Select("select count(*) from b_course_code where business_id < #{id} and flag=0 and del_flag = 0 ")
int select_flag_start(int id);
} }
...@@ -45,7 +45,7 @@ public class BCourseCode extends IdEntity<BCourseCode> { ...@@ -45,7 +45,7 @@ public class BCourseCode extends IdEntity<BCourseCode> {
@NotBlank @NotBlank
private String dateDesc; private String dateDesc;
public String getDateDesc(){ /*public String getDateDesc(){
switch (this.dateDesc) { switch (this.dateDesc) {
case "0": case "0":
return "上午"; return "上午";
...@@ -54,7 +54,7 @@ public class BCourseCode extends IdEntity<BCourseCode> { ...@@ -54,7 +54,7 @@ public class BCourseCode extends IdEntity<BCourseCode> {
default: default:
return "晚上"; return "晚上";
} }
} }*/
} }
...@@ -28,6 +28,17 @@ public interface BCourseCodeService { ...@@ -28,6 +28,17 @@ public interface BCourseCodeService {
List<BCourseCode> findAll(BCourseCode bCourseCode); List<BCourseCode> findAll(BCourseCode bCourseCode);
/**
* 启用课程节点
* @param businessId
* @return
*/
PersistModel startFlag(String businessId);
/**
* 停用课程节点
* @param businessId
* @return
*/
PersistModel stopFlag(String businessId);
} }
package org.rcisoft.business.bcoursecode.service.impl; package org.rcisoft.business.bcoursecode.service.impl;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
...@@ -56,4 +58,31 @@ public class BCourseCodeServiceImpl implements BCourseCodeService { ...@@ -56,4 +58,31 @@ public class BCourseCodeServiceImpl implements BCourseCodeService {
return bCourseCodeRepository.queryBCourseCodes(bCourseCode); return bCourseCodeRepository.queryBCourseCodes(bCourseCode);
} }
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public PersistModel startFlag(String businessId){
BCourseCode bCourseCode = new BCourseCode();
UserUtil.setCurrentMergeOperation(bCourseCode);
int id = Integer.parseInt(businessId);
int num = bCourseCodeRepository.select_flag_start(id);
if(num != 0){
throw new ServiceException(ResultServiceEnums.PERVIOUS_NOT_ENABLED);
}
bCourseCodeRepository.startFlag(String.valueOf(id));
return new PersistModel(1);
}
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public PersistModel stopFlag(String businessId){
BCourseCode bCourseCode = new BCourseCode();
UserUtil.setCurrentMergeOperation(bCourseCode);
int id = Integer.parseInt(businessId);
int num = bCourseCodeRepository.select_flag_stop(id);
if(num != 0){
throw new ServiceException(ResultServiceEnums.NEXT_NOT_DISABLED);
}
bCourseCodeRepository.stopFlag(String.valueOf(id));
return new PersistModel(1);
}
} }
...@@ -3,6 +3,8 @@ package org.rcisoft.business.bsl.dao; ...@@ -3,6 +3,8 @@ package org.rcisoft.business.bsl.dao;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import org.rcisoft.business.bsl.dto.SlDTO; import org.rcisoft.business.bsl.dto.SlDTO;
import org.rcisoft.business.bsl.dto.SlDetailDTO; import org.rcisoft.business.bsl.dto.SlDetailDTO;
import org.rcisoft.business.bsl.entity.BSl;
import org.rcisoft.core.base.BaseMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
......
...@@ -150,8 +150,11 @@ public enum ResultServiceEnums { ...@@ -150,8 +150,11 @@ public enum ResultServiceEnums {
CLASSHOUR_ERROR (81,"学时不能小于当前已添加的学时"), CLASSHOUR_ERROR (81,"学时不能小于当前已添加的学时"),
THIS_IS_FILE (82,"该目录下不能新建文件") THIS_IS_FILE (82,"该目录下不能新建文件"),
;
PERVIOUS_NOT_ENABLED (83,"启用失败,在此之前存在未启用的课程节点"),
NEXT_NOT_DISABLED (84,"停用失败,在此之后存在未停用的课程节点");
private Integer code; private Integer code;
private String message; private String message;
......
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