Commit 9ecd5f44 authored by YangZhaoJun1's avatar YangZhaoJun1

Merge branch 'V2.0.3' of http://103.249.252.28:90/lcy/education into V2.0.3

parents 7b27afb5 399049b7
...@@ -72,31 +72,18 @@ public class BCourseCodeController extends PaginationController<BCourseCode> { ...@@ -72,31 +72,18 @@ public class BCourseCodeController extends PaginationController<BCourseCode> {
bCourseCodeServiceImpl.findAll(bCourseCode)); bCourseCodeServiceImpl.findAll(bCourseCode));
} }
@ApiOperation(value="启用课程节点", notes="启用课程节点") @ApiOperation(value="启用/停用课程节点", notes="启用/停用课程节点")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId,拼在地址栏中", required = true, dataType = "varchar")}) @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId,拼在地址栏中", required = true, dataType = "varchar")})
@PostMapping("/startFlag") @PostMapping("/changeFlag")
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1001')")
public Result startFlag(@ApiIgnore String businessId) { public Result changeFlag(@ApiIgnore String businessId) {
BCourseCode bCourseCode = new BCourseCode(); BCourseCode bCourseCode = new BCourseCode();
bCourseCode.setToken(getToken()); bCourseCode.setToken(getToken());
PersistModel data = bCourseCodeServiceImpl.startFlag(businessId); PersistModel data = bCourseCodeServiceImpl.changeFlag(businessId);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bCourseCode); 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);
}
} }
...@@ -28,17 +28,45 @@ public interface BCourseCodeRepository extends BaseMapper<BCourseCode> { ...@@ -28,17 +28,45 @@ public interface BCourseCodeRepository extends BaseMapper<BCourseCode> {
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BCourseCode> queryBCourseCodes(BCourseCode bCourseCode); List<BCourseCode> queryBCourseCodes(BCourseCode bCourseCode);
/**
* 启用标志位
* @param businessId
* @return
*/
@Update("update b_course_code set flag = 1 where business_id = #{0}") @Update("update b_course_code set flag = 1 where business_id = #{0}")
int startFlag(String businessId); int startFlag(String businessId);
/**
* 停用标志位
* @param businessId
* @return
*/
@Update("update b_course_code set flag = 0 where business_id = #{0}") @Update("update b_course_code set flag = 0 where business_id = #{0}")
int stopFlag(String businessId); int stopFlag(String businessId);
/**
* 查询停用条数
* @param id
* @return
*/
@Select("select count(*) from b_course_code where business_id > #{id} and flag=1 and del_flag = 0 ") @Select("select count(*) from b_course_code where business_id > #{id} and flag=1 and del_flag = 0 ")
int select_flag_stop(int id); int select_flag_stop(int id);
/**
* 查询启用条数
* @param id
* @return
*/
@Select("select count(*) from b_course_code where business_id < #{id} and flag=0 and del_flag = 0 ") @Select("select count(*) from b_course_code where business_id < #{id} and flag=0 and del_flag = 0 ")
int select_flag_start(int id); int select_flag_start(int id);
/**
* 查询节点当前启用/停用状态
* @param businessId
* @return
*/
@Select("select flag from b_course_code where business_id = #{0} and del_flag = 0")
String querystatus(String businessId);
} }
...@@ -27,18 +27,25 @@ public interface BCourseCodeService { ...@@ -27,18 +27,25 @@ public interface BCourseCodeService {
*/ */
List<BCourseCode> findAll(BCourseCode bCourseCode); List<BCourseCode> findAll(BCourseCode bCourseCode);
/** /**
* 启用课程节点 * 启用课程节点
* @param businessId * @param businessId
* @return * @return
*/ */
PersistModel startFlag(String businessId); // PersistModel startFlag(String businessId);
/** /**
* 停用课程节点 * 停用课程节点
* @param businessId * @param businessId
* @return * @return
*/ */
PersistModel stopFlag(String businessId); // PersistModel stopFlag(String businessId);
/**
* 变动课程节点
* @param businessId
* @return
*/
PersistModel changeFlag(String businessId);
} }
...@@ -52,6 +52,7 @@ public class BCourseCodeServiceImpl implements BCourseCodeService { ...@@ -52,6 +52,7 @@ public class BCourseCodeServiceImpl implements BCourseCodeService {
* @param bCourseCode * @param bCourseCode
* @return * @return
*/ */
@Override
public List<BCourseCode> findAll(BCourseCode bCourseCode){ public List<BCourseCode> findAll(BCourseCode bCourseCode){
bCourseCode.setStart(); bCourseCode.setStart();
bCourseCode.setNotDeleted(); bCourseCode.setNotDeleted();
...@@ -60,29 +61,27 @@ public class BCourseCodeServiceImpl implements BCourseCodeService { ...@@ -60,29 +61,27 @@ public class BCourseCodeServiceImpl implements BCourseCodeService {
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT) @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override @Override
public PersistModel startFlag(String businessId){ public PersistModel changeFlag(String businessId){
BCourseCode bCourseCode = new BCourseCode(); BCourseCode bCourseCode = new BCourseCode();
UserUtil.setCurrentMergeOperation(bCourseCode); UserUtil.setCurrentMergeOperation(bCourseCode);
int id = Integer.parseInt(businessId); int id = Integer.parseInt(businessId);
int num = bCourseCodeRepository.select_flag_start(id); // 节点启用
if(num != 0){ if (bCourseCodeRepository.querystatus(businessId).equals("0")){
throw new ServiceException(ResultServiceEnums.PERVIOUS_NOT_ENABLED); int num = bCourseCodeRepository.select_flag_start(id);
if(num != 0){
throw new ServiceException(ResultServiceEnums.PERVIOUS_NOT_ENABLED);
}
bCourseCodeRepository.startFlag(String.valueOf(id));
} }
bCourseCodeRepository.startFlag(String.valueOf(id)); // 节点停用
return new PersistModel(1); else{
} int num = bCourseCodeRepository.select_flag_stop(id);
if(num != 0){
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT) throw new ServiceException(ResultServiceEnums.NEXT_NOT_DISABLED);
@Override }
public PersistModel stopFlag(String businessId){ bCourseCodeRepository.stopFlag(String.valueOf(id));
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); return new PersistModel(1);
} }
} }
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