e83742f8 by chentao

no message

1 parent 15cd555c
......@@ -87,4 +87,29 @@ public class EntiretyController extends BaseController {
public R<Void> remove(@PathVariable String id) throws ServerException {
return toAjax(service.remove(id));
}
@RepeatSubmit()
@PutMapping("/display/{id}")
public R<Void> display(@PathVariable String id) throws ServerException {
return toAjax(service.display(id));
}
@RepeatSubmit()
@PutMapping("/batch/display/{entiretyIds}")
public R<Void> batchDisplay(@PathVariable String[] entiretyIds) throws ServerException {
return toAjax(service.batchDisplay(entiretyIds));
}
@RepeatSubmit()
@PutMapping("/hide/{id}")
public R<Void> hide(@PathVariable String id) throws ServerException {
return toAjax(service.hide(id));
}
@RepeatSubmit()
@PutMapping("/batch/hide/{entiretyIds}")
public R<Void> batchHide(@PathVariable String[] entiretyIds) throws ServerException {
return toAjax(service.batchHide(entiretyIds));
}
}
......
......@@ -79,4 +79,39 @@ public interface IEntiretyService {
* @return
*/
List<EntiretyVo> list(String language, Collection<String> buildingBlockIds);
/**
* 隐藏
*
* @param id
* @return
* @throws ServerException
*/
boolean hide(String id) throws ServerException;
/**
* 批量隐藏
*
* @param entiretyIds
* @return
* @throws ServerException
*/
boolean batchHide(String[] entiretyIds) throws ServerException;
/**
* 显示
*
* @param id
* @return
* @throws ServerException
*/
boolean display(String id) throws ServerException;
/**
* 批量显示
*
* @param entiretyIds
* @return
* @throws ServerException
*/
boolean batchDisplay(String[] entiretyIds) throws ServerException;
}
......
......@@ -17,6 +17,7 @@ import com.lego.common.utils.StreamUtils;
import com.lego.common.utils.StringUtils;
import com.lego.core.annotation.LanguageAnnotation;
import com.lego.core.domain.Course;
import com.lego.core.domain.Entirety;
import com.lego.core.domain.bo.CourseBo;
import com.lego.core.domain.bo.CourseQueryBo;
import com.lego.core.domain.vo.CourseVo;
......@@ -96,10 +97,10 @@ public class CourseServiceImpl implements ICourseService {
vo.setPptOssUrl(ossUrlService.selectUrlByIds(vo.getPptOssId()));
}
if(vo.isVisible()){
vo.setDisplay("已显示");
vo.setDisplay("【已显示】");
}
else{
vo.setDisplay("已隐藏");
vo.setDisplay("【已隐藏】");
}
}
}
......@@ -147,7 +148,7 @@ public class CourseServiceImpl implements ICourseService {
*/
@Override
public List<CourseVo> list() {
List<CourseVo> list = baseMapper.selectVoList(null);
List<CourseVo> list = baseMapper.selectVoList(Wrappers.<Course>lambdaQuery().eq(Course::isVisible, true));
for (CourseVo vo : list) {
if(StrUtil.isNotBlank(vo.getTwoDimensionalOssId())){
vo.setTwoDimensionalOssUrl(ossUrlService.selectUrlByIds(vo.getTwoDimensionalOssId()));
......@@ -306,10 +307,6 @@ public class CourseServiceImpl implements ICourseService {
@Override
public boolean batchDisplay(String[] courseIds) throws ServerException {
if(courseIds==null)
System.out.println("=============1==========");
else
System.out.println("========================"+Arrays.asList(courseIds));
for (String id : courseIds) {
CourseVo courseVo = baseMapper.selectVoById(id);
courseVo.setVisible(true);
......
......@@ -16,6 +16,7 @@ import com.lego.core.domain.Course;
import com.lego.core.domain.Entirety;
import com.lego.core.domain.bo.EntiretyBo;
import com.lego.core.domain.vo.BuildingBlockVo;
import com.lego.core.domain.vo.CourseVo;
import com.lego.core.domain.vo.EntiretyVo;
import com.lego.core.mapper.CourseMapper;
import com.lego.core.mapper.EntiretyMapper;
......@@ -93,7 +94,7 @@ public class EntiretyServiceImpl implements IEntiretyService {
*/
@Override
public List<EntiretyVo> list() {
List<EntiretyVo> list = baseMapper.selectVoList(null);
List<EntiretyVo> list = baseMapper.selectVoList(Wrappers.<Entirety>lambdaQuery().eq(Entirety::isVisible, true));
setInfo(list);
return list;
}
......@@ -188,6 +189,12 @@ public class EntiretyServiceImpl implements IEntiretyService {
if (StrUtil.isNotBlank(vo.getOssId())) {
vo.setOssUrl(ossUrlService.selectUrlByIds(vo.getOssId()));
}
if(vo.isVisible()){
vo.setDisplay("【已显示】");
}
else{
vo.setDisplay("【已隐藏】");
}
}
}
}
......@@ -203,4 +210,43 @@ public class EntiretyServiceImpl implements IEntiretyService {
throw new ServerException(MessageUtils.message("core.data.exists"));
}
}
@Override
public boolean display(String id) throws ServerException {
EntiretyVo entiretyVo = baseMapper.selectVoById(id);
entiretyVo.setVisible(true);
Entirety entirety = BeanUtil.toBean(entiretyVo, Entirety.class);
return baseMapper.updateById(entirety) > 0;
}
@Override
public boolean batchDisplay(String[] entiretyIds) throws ServerException {
for (String id : entiretyIds) {
EntiretyVo entiretyVo = baseMapper.selectVoById(id);
entiretyVo.setVisible(true);
Entirety entirety = BeanUtil.toBean(entiretyVo, Entirety.class);
baseMapper.updateById(entirety);
}
return true;
}
@Override
public boolean hide(String id) throws ServerException {
EntiretyVo entiretyVo = baseMapper.selectVoById(id);
entiretyVo.setVisible(false);
Entirety entirety = BeanUtil.toBean(entiretyVo, Entirety.class);
return baseMapper.updateById(entirety) > 0;
}
@Override
public boolean batchHide(String[] entiretyIds) throws ServerException {
for (String id : entiretyIds) {
EntiretyVo entiretyVo = baseMapper.selectVoById(id);
entiretyVo.setVisible(false);
Entirety entirety = BeanUtil.toBean(entiretyVo, Entirety.class);
baseMapper.updateById(entirety);
}
return true;
}
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!