|
@@ -7,6 +7,7 @@ import com.yonge.cooleshow.cms.dal.entity.NewsStatusEnum;
|
|
|
import com.yonge.cooleshow.cms.dal.entity.SysNewsInformation;
|
|
|
import com.yonge.cooleshow.cms.dto.SysNewsInformationDto;
|
|
|
import com.yonge.cooleshow.cms.service.SysNewsInformationService;
|
|
|
+import com.yonge.cooleshow.common.exception.BizException;
|
|
|
import com.yonge.toolset.mybatis.dal.BaseDAO;
|
|
|
import com.yonge.toolset.base.page.PageInfo;
|
|
|
import com.yonge.toolset.base.page.QueryInfo;
|
|
@@ -176,8 +177,23 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public boolean updateStatus(Long id) {
|
|
|
- sysNewsInformationDao.updateStatus(id);
|
|
|
+ SysNewsInformationDto sysNewsInformationDto = sysNewsInformationDao.queryById(id);
|
|
|
+ if (sysNewsInformationDto.getType() != 2) {
|
|
|
+ sysNewsInformationDao.updateStatus(id);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sysNewsInformationDto.getStatus().getCode().equals(NewsStatusEnum.SHOW.getCode())) {
|
|
|
+ sysNewsInformationDao.updateStatus(id);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
+ Integer count = sysNewsInformationDao.selectByVersionAndStatus(sysNewsInformationDto.getAttribute1(),NewsStatusEnum.SHOW.getCode());
|
|
|
+
|
|
|
+ if (count >0) {
|
|
|
+ throw new BizException("有正在启用的公告");
|
|
|
+ }
|
|
|
+ sysNewsInformationDao.updateStatus(id);
|
|
|
return true;
|
|
|
}
|
|
|
|