提交 72388b74 authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 dada582b
......@@ -7,6 +7,7 @@ package com.zrqx.resource.bg.controller.clauseLibrary;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -96,7 +97,7 @@ public class ClauseLibraryController {
@ApiOperation(value = "新增", notes = "新增一个")
@PostMapping(value = ResourceRequestPath.SAVE)
public CallBack<Boolean> save(@RequestBody SaveUpdateClauseLibraryForm form) {
public CallBack<Boolean> save(@RequestBody SaveUpdateClauseLibraryForm form) throws ParseException {
if (!service.saveOrUpdate(form)) {
throw new BaseException(ResponseCodeEnum.FAIL);
}
......@@ -105,7 +106,7 @@ public class ClauseLibraryController {
@ApiOperation(value = "更新", notes = "更新")
@PostMapping(value = ResourceRequestPath.UPDATE)
public CallBack<Boolean> update(@RequestBody SaveUpdateClauseLibraryForm form) {
public CallBack<Boolean> update(@RequestBody SaveUpdateClauseLibraryForm form) throws ParseException {
if (!service.saveOrUpdate(form)) {
throw new BaseException(ResponseCodeEnum.FAIL);
}
......
......@@ -86,16 +86,13 @@ public class AnimationLibrarySerivceImpl extends BaseServiceImpl<AnimationLibrar
@Override
public boolean saveOrUpdate(SaveUpdateAnimationLibraryForm form) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
AnimationLibrary entity = new AnimationLibrary();
BeanUtils.copyProperties(form, entity);
if(form.getDiyTypeId().size() != form.getDiyTypeCode().size()){
throw new BaseException("自定义分类数据错误");
}
if(form.getId()==null){
Integer countName = animationMapper.isRepeat(form.getName(),"");
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
AnimationLibrary entity = new AnimationLibrary();
BeanUtils.copyProperties(form, entity);
//添加动画信息
entity.setStatus(0);
entity.setResourceType(8);
......@@ -104,10 +101,8 @@ public class AnimationLibrarySerivceImpl extends BaseServiceImpl<AnimationLibrar
animationMapper.insert(entity);
}else{
Integer countName = animationMapper.isRepeat(entity.getName(),entity.getId());
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
AnimationLibrary entity = animationMapper.selectByPrimaryKey(form.getId());
BeanUtils.copyProperties(form, entity);
//修改动画资源
entity.setUpdateTime(new Date());
animationMapper.updateByPrimaryKeySelective(entity);
......@@ -124,6 +119,7 @@ public class AnimationLibrarySerivceImpl extends BaseServiceImpl<AnimationLibrar
label.setObjectId(entity.getId());
labelMapper.delete(label);
}
AnimationLibrary entity = animationMapper.selectByPrimaryKey(form.getId());
//添加商品信息
AnimationGoods goods = new AnimationGoods();
BeanUtils.copyProperties(form, goods);
......
......@@ -89,16 +89,12 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,In
@Override
public boolean saveOrUpdate(SaveUpdateArticleLibraryForm form) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
ArticleLibrary entity = new ArticleLibrary();
BeanUtils.copyProperties(form, entity);
if(form.getDiyTypeId() == null||form.getDiyTypeId().size() != form.getDiyTypeCode().size()){
throw new BaseException("自定义分类数据错误");
}
if(entity.getId() == null){
Integer countName = articleMapper.isRepeat(form.getName(),"");
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
if(form.getId() == null){
ArticleLibrary entity = new ArticleLibrary();
BeanUtils.copyProperties(form, entity);
//添加
entity.setStatus(0);
entity.setResourceType(2);
......@@ -180,10 +176,8 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,In
articleMapper.insert(entity);
}else{
//修改
Integer listName = articleMapper.isRepeat(entity.getName(),entity.getId());
if(listName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
ArticleLibrary entity = articleMapper.selectByPrimaryKey(form.getId());
BeanUtils.copyProperties(form, entity);
entity.setUpdateTime(new Date());
if(form.getPdfResourceType()!=null ){
if(form.getPdfResourceType().equals(1)){
......@@ -272,6 +266,7 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,In
label.setObjectId(entity.getId());
alcdMapper.delete(label);
}
ArticleLibrary entity = articleMapper.selectByPrimaryKey(form.getId());
// 维护合同的关联关系
if (StringUtils.isNotBlank(form.getRelatedContracts())) {
Copyright copyright = copyrightService.selectByPrimaryKey(form.getRelatedContracts());
......
......@@ -72,16 +72,12 @@ public class AudioLibrarySerivceImpl extends BaseServiceImpl<AudioLibrary,Intege
@Override
public boolean saveOrUpdate(SaveUpdateAudioLibraryForm form) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
AudioLibrary entity = new AudioLibrary();
BeanUtils.copyProperties(form, entity);
if(form.getDiyTypeId().size() > 0 &&form.getDiyTypeId().size() != form.getDiyTypeCode().size()){
throw new BaseException("自定义分类数据错误");
}
if(form.getId()==null){
List<AudioLibrary> list = audioMapper.isRepeat(form.getName());
if(list.size()>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
AudioLibrary entity = new AudioLibrary();
BeanUtils.copyProperties(form, entity);
//添加
entity.setStatus(0);
entity.setResourceType(7);
......@@ -90,10 +86,8 @@ public class AudioLibrarySerivceImpl extends BaseServiceImpl<AudioLibrary,Intege
audioMapper.insert(entity);
}else{
//修改
Integer countName = audioMapper.isRepeatById(entity.getName(),entity.getId());
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
AudioLibrary entity = audioMapper.selectByPrimaryKey(form.getId());
BeanUtils.copyProperties(form, entity);
entity.setUpdateTime(new Date());
audioMapper.updateByPrimaryKeySelective(entity);
// 商品信息
......@@ -109,6 +103,7 @@ public class AudioLibrarySerivceImpl extends BaseServiceImpl<AudioLibrary,Intege
label.setObjectId(entity.getId());
labelMapper.delete(label);
}
AudioLibrary entity = audioMapper.selectByPrimaryKey(form.getId());
// 维护合同的关联关系
if (StringUtils.isNotBlank(form.getRelatedContracts())) {
Copyright copyright = copyrightService.selectByPrimaryKey(form.getRelatedContracts());
......
......@@ -82,20 +82,12 @@ public class AuthorLibraryServiceImpl extends BaseServiceImpl<AuthorLibrary, Int
}
if(form.getId()==null){
//添加
Integer countName = authorMapper.isRepeat(form.getName(),"");
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
authorLibrary.setResourceType(16);
authorLibrary.setIsDelete(0);
authorLibrary.setStatus(0);
authorLibrary.setCreateTime(new Date());
authorMapper.insert(authorLibrary);
}else{
Integer countName = authorMapper.isRepeat(authorLibrary.getName(),authorLibrary.getId());
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
authorLibrary.setUpdateTime(new Date());
authorMapper.updateByPrimaryKeySelective(authorLibrary);
// 删除原有关系表中的关系
......
......@@ -4,6 +4,7 @@
*/
package com.zrqx.resource.bg.service.clauseLibrary;
import java.text.ParseException;
import java.util.List;
import com.zrqx.core.form.resource.bg.ImportForm;
......@@ -24,7 +25,7 @@ import com.zrqx.core.vo.resource.clauseLibrary.ClauseLibraryListVo;
public interface ClauseLibraryService extends BaseService<ClauseLibrary, Integer> {
/** 新增/更新 */
boolean saveOrUpdate(SaveUpdateClauseLibraryForm form);
boolean saveOrUpdate(SaveUpdateClauseLibraryForm form) throws ParseException;
/** 批量删除 */
String batchDelete(List<String> ids);
......
......@@ -4,6 +4,7 @@
*/
package com.zrqx.resource.bg.service.clauseLibrary;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
......@@ -88,30 +89,20 @@ public class ClauseLibraryServiceImpl extends BaseServiceImpl<ClauseLibrary, Int
return mapper;
}
/** 新增/更新 */
/** 新增/更新
* @throws ParseException */
@Override
public boolean saveOrUpdate(SaveUpdateClauseLibraryForm form) {
public boolean saveOrUpdate(SaveUpdateClauseLibraryForm form) throws ParseException {
if (form.getDiyTypeId() == null || form.getDiyTypeId().size() != form.getDiyTypeCode().size()) {
throw new BaseException(7, "自定义分类数据错误");
}
ClauseLibrary entity = new ClauseLibrary();
// 保存条文库
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
BeanUtils.copyProperties(form, entity);
} catch (Exception e) {
e.printStackTrace();
throw new BaseException(7, "复制对象时创建对象失败。");
}
// 新增/修改后,状态为未审核
entity.setStatus(ResourceStatusEnum.ENTRY.getValue());
String objectId = form.getId();
if (objectId == null) {
// 添加
Integer countName = mapper.isRepeat(form.getContent(),"");
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
ClauseLibrary entity = new ClauseLibrary();
BeanUtils.copyProperties(form, entity);
entity.setUploadTime(new Date());
entity.setIsDelete(0);
entity.setStatus(0);
......@@ -194,10 +185,8 @@ public class ClauseLibraryServiceImpl extends BaseServiceImpl<ClauseLibrary, Int
}
} else {
// 更新
Integer countName = mapper.isRepeat(entity.getContent(),entity.getId());
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
ClauseLibrary entity = mapper.selectByPrimaryKey(form.getId());
BeanUtils.copyProperties(form, entity);
entity.setId(objectId);
entity.setUpdateTime(new Date());
if(form.getPdfResourceType()!=null ){
......@@ -286,24 +275,16 @@ public class ClauseLibraryServiceImpl extends BaseServiceImpl<ClauseLibrary, Int
label.setObjectId(objectId);
labelMapper.delete(label);
}
objectId = entity.getId();
ClauseLibrary entity = mapper.selectByPrimaryKey(form.getId());
objectId = form.getId();
// 保存商品信息
ClauseGoods goods = new ClauseGoods();
try {
BeanUtils.copyProperties(form, goods);
} catch (Exception e) {
e.printStackTrace();
throw new BaseException(7, "复制对象时创建对象失败。");
BeanUtils.copyProperties(form, goods);
if (StringUtils.isNotBlank(form.getStartDate())) {
goods.setStartDate(sdf.parse(form.getStartDate()));
}
try {
if (StringUtils.isNotBlank(form.getStartDate())) {
goods.setStartDate(sdf.parse(form.getStartDate()));
}
if (StringUtils.isNotBlank(form.getEndDate())) {
goods.setEndDate(sdf.parse(form.getEndDate()));
}
} catch (Exception e) {
throw new BaseException(7, "时间格式不正确");
if (StringUtils.isNotBlank(form.getEndDate())) {
goods.setEndDate(sdf.parse(form.getEndDate()));
}
goods.setObjectId(objectId);
if (goodsMapper.insert(goods) != 1) {
......
......@@ -70,16 +70,12 @@ public class CoursewareLibrarySerivceImpl extends BaseServiceImpl<CoursewareLibr
@Override
public boolean saveOrUpdate(SaveUpdateCoursewareLibraryForm form) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
CoursewareLibrary entity = new CoursewareLibrary();
BeanUtils.copyProperties(form, entity);
if(form.getDiyTypeId().size() != form.getDiyTypeCode().size()){
throw new BaseException("自定义分类数据错误");
}
if(form.getId()==null){
Integer countName = coursewareMapper.isRepeat(form.getName(),"");
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
CoursewareLibrary entity = new CoursewareLibrary();
BeanUtils.copyProperties(form, entity);
entity.setStatus(0);
entity.setIsDelete(0);
entity.setResourceType(9);
......@@ -87,10 +83,8 @@ public class CoursewareLibrarySerivceImpl extends BaseServiceImpl<CoursewareLibr
coursewareMapper.insert(entity);
}else{
//修改
Integer countName = coursewareMapper.isRepeat(form.getName(),form.getId());
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
CoursewareLibrary entity = coursewareMapper.selectByPrimaryKey(form.getId());
BeanUtils.copyProperties(form, entity);
entity.setUpdateTime(new Date());
coursewareMapper.updateByPrimaryKeySelective(entity);
// 商品信息
......@@ -106,6 +100,7 @@ public class CoursewareLibrarySerivceImpl extends BaseServiceImpl<CoursewareLibr
label.setObjectId(entity.getId());
labelMapper.delete(label);
}
CoursewareLibrary entity = coursewareMapper.selectByPrimaryKey(form.getId());
// 维护合同的关联关系
if (StringUtils.isNotBlank(form.getRelatedContracts())) {
Copyright copyright = copyrightService.selectByPrimaryKey(form.getRelatedContracts());
......
......@@ -107,24 +107,16 @@ public class EbookServiceImpl extends BaseServiceImpl<Ebook, String> implements
public boolean saveOrUpdate(SaveUpdateEbookForm form) throws ParseException {
List<BookDiyType> dtList = new ArrayList<BookDiyType>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Book book = new Book();
BeanUtils.copyProperties(form, book);
Ebook ebook = new Ebook();
BeanUtils.copyProperties(form, ebook);
if (form.getDiyTypeId() == null || form.getDiyTypeId().size() == 0) {
throw new BaseException("参数验证失败。");
} else {
if (book.getId() == null) {
Integer listName=bookMapper.isRepeat(form.getName(),"");
if(listName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
try {
if (form.getPublishTime() != null) {
book.setPublishTime(sdf.parse(form.getPublishTime()));
}
} catch (ParseException e) {
e.printStackTrace();
if (form.getId() == null) {
Book book = new Book();
BeanUtils.copyProperties(form, book);
Ebook ebook = new Ebook();
BeanUtils.copyProperties(form, ebook);
if (form.getPublishTime() != null) {
book.setPublishTime(sdf.parse(form.getPublishTime()));
}
book.setStatus(0);
book.setIsDelete(0);
......@@ -224,10 +216,10 @@ public class EbookServiceImpl extends BaseServiceImpl<Ebook, String> implements
}
}
} else {
Integer listName=bookMapper.isRepeat(book.getName(),book.getId());
if(listName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
Book book = bookMapper.selectByPrimaryKey(form.getId());
BeanUtils.copyProperties(form, book);
Ebook ebook = ebookMapper.selectByPrimaryKey(form.getId());
BeanUtils.copyProperties(form, ebook);
book.setUpdateTime(new Date());// 图书信息
book.setDepartmentId(form.getDepartmentId());
bookMapper.updateByPrimaryKey(book);
......@@ -331,6 +323,7 @@ public class EbookServiceImpl extends BaseServiceImpl<Ebook, String> implements
issued.setObjectId(book.getId());
bookIssuedMapper.delete(issued);
}
Book book = bookMapper.selectByPrimaryKey(form.getId());
BookGoods goods = new BookGoods();
BeanUtils.copyProperties(form, goods);
//添加商品信息
......
......@@ -80,17 +80,13 @@ public class ImageLibrarySerivceImpl extends BaseServiceImpl<ImageLibrary,Intege
@Override
public boolean saveOrUpdate(SaveUpdateImageLibraryForm form) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
ImageLibrary entity = new ImageLibrary();
BeanUtils.copyProperties(form, entity);
if(form.getDiyTypeId().size() != form.getDiyTypeCode().size()){
throw new BaseException(-7,"自定义分类数据错误");
}
if(entity.getId() == null){
if(form.getId() == null){
//添加图片信息
Integer countName = imageMapper.isRepeat(form.getName(),"");
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
ImageLibrary entity = new ImageLibrary();
BeanUtils.copyProperties(form, entity);
entity.setIsDelete(0);
entity.setStatus(0);
entity.setResourceType(5);
......@@ -100,10 +96,8 @@ public class ImageLibrarySerivceImpl extends BaseServiceImpl<ImageLibrary,Intege
}
}else{
//修改
Integer countName = imageMapper.isRepeat(entity.getName(),entity.getId());
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
ImageLibrary entity = imageMapper.selectByPrimaryKey(form.getId());
BeanUtils.copyProperties(form, entity);
entity.setUpdateTime(new Date());
imageMapper.updateByPrimaryKeySelective(entity);
//删除商品信息
......@@ -119,6 +113,7 @@ public class ImageLibrarySerivceImpl extends BaseServiceImpl<ImageLibrary,Intege
label.setObjectId(entity.getId());
labelMapper.delete(label);
}
ImageLibrary entity = imageMapper.selectByPrimaryKey(form.getId());
// 维护合同的关联关系
if (StringUtils.isNotBlank(form.getRelatedContracts())) {
Copyright copyright = copyrightService.selectByPrimaryKey(form.getRelatedContracts());
......
......@@ -81,17 +81,14 @@ public class PdfLibrarySerivceImpl extends BaseServiceImpl<PdfLibrary,Integer> i
@Override
public boolean saveOrUpdate(SaveUpdatePdfLibraryForm form) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
PdfLibrary entity = new PdfLibrary();
BeanUtils.copyProperties(form, entity);
if(form.getDiyTypeId().size() != form.getDiyTypeCode().size()){
throw new BaseException("自定义分类数据错误");
}
if(form.getId()==null){
//添加
List<PdfLibrary> listName= pdfMapper.isRepeat(form.getName());
if(listName.size()>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
PdfLibrary entity = new PdfLibrary();
BeanUtils.copyProperties(form, entity);
entity.setStatus(0);
entity.setIsDelete(0);
entity.setResourceType(15);
......@@ -112,10 +109,8 @@ public class PdfLibrarySerivceImpl extends BaseServiceImpl<PdfLibrary,Integer> i
}
}else{
//修改
Integer countName= pdfMapper.isRepeatById(entity.getName(),entity.getId());
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
PdfLibrary entity = pdfMapper.selectByPrimaryKey(form.getId());
BeanUtils.copyProperties(form, entity);
entity.setUpdateTime(new Date());
pdfMapper.updateByPrimaryKeySelective(entity);
//商品信息
......@@ -144,6 +139,7 @@ public class PdfLibrarySerivceImpl extends BaseServiceImpl<PdfLibrary,Integer> i
label.setObjectId(entity.getId());
labelMapper.delete(label);
}
PdfLibrary entity = pdfMapper.selectByPrimaryKey(form.getId());
//添加商品信息
PdfGoods goods = new PdfGoods();
BeanUtils.copyProperties(form, goods);
......
......@@ -98,24 +98,18 @@ public class StatuteLibraryServiceImpl extends BaseServiceImpl<StatuteLibrary, I
if (form.getDiyTypeId() == null || form.getDiyTypeId().size() != form.getDiyTypeCode().size()) {
throw new BaseException(7, "自定义分类数据错误");
}
StatuteLibrary entity = new StatuteLibrary();
// 保存法规库
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
BeanUtils.copyProperties(form, entity);
if (StringUtils.isNotBlank(form.getIssuingTime())) {
entity.setIssuingTime(sdf.parse(form.getIssuingTime()));
}
if (StringUtils.isNotBlank(form.getImplementTime())) {
entity.setImplementTime(sdf.parse(form.getImplementTime()));
}
// 新增/修改后,状态为未审核
entity.setStatus(ResourceStatusEnum.ENTRY.getValue());
String objectId = form.getId();
if (objectId == null) {
// 添加
Integer countName= mapper.isRepeat(form.getName(),"");
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
StatuteLibrary entity = new StatuteLibrary();
BeanUtils.copyProperties(form, entity);
if (StringUtils.isNotBlank(form.getIssuingTime())) {
entity.setIssuingTime(sdf.parse(form.getIssuingTime()));
}
if (StringUtils.isNotBlank(form.getImplementTime())) {
entity.setImplementTime(sdf.parse(form.getImplementTime()));
}
entity.setUploadTime(new Date());
entity.setIsDelete(0);
......@@ -201,11 +195,8 @@ public class StatuteLibraryServiceImpl extends BaseServiceImpl<StatuteLibrary, I
}
} else {
// 更新
Integer countName= mapper.isRepeat(entity.getName(),entity.getId());
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
entity.setId(objectId);
StatuteLibrary entity = mapper.selectByPrimaryKey(form.getId());
BeanUtils.copyProperties(form, entity);
entity.setUpdateTime(new Date());
if(form.getPdfResourceType()!=null ){
if(form.getPdfResourceType().equals(1)){
......@@ -294,23 +285,15 @@ public class StatuteLibraryServiceImpl extends BaseServiceImpl<StatuteLibrary, I
label.setObjectId(objectId);
labelMapper.delete(label);
}
StatuteLibrary entity = mapper.selectByPrimaryKey(form.getId());
// 保存商品信息
StatuteGoods goods = new StatuteGoods();
try {
BeanUtils.copyProperties(form, goods);
} catch (Exception e) {
e.printStackTrace();
throw new BaseException(7, "复制对象时创建对象失败。");
BeanUtils.copyProperties(form, goods);
if (StringUtils.isNotBlank(form.getStartDate())) {
goods.setStartDate(sdf.parse(form.getStartDate()));
}
try {
if (StringUtils.isNotBlank(form.getStartDate())) {
goods.setStartDate(sdf.parse(form.getStartDate()));
}
if (StringUtils.isNotBlank(form.getEndDate())) {
goods.setEndDate(sdf.parse(form.getEndDate()));
}
} catch (Exception e) {
throw new BaseException(7, "时间格式不正确");
if (StringUtils.isNotBlank(form.getEndDate())) {
goods.setEndDate(sdf.parse(form.getEndDate()));
}
goods.setObjectId(objectId);
if (goodsMapper.insert(goods) != 1) {
......
......@@ -76,17 +76,13 @@ public class VideoLibrarySerivceImpl extends BaseServiceImpl<VideoLibrary,Intege
@Override
public boolean saveOrUpdate(SaveUpdateVideoLibraryForm form) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
VideoLibrary entity = new VideoLibrary();
BeanUtils.copyProperties(form, entity);
if(form.getDiyTypeId().size() != form.getDiyTypeCode().size()){
throw new BaseException("自定义分类数据错误");
}
if(form.getId()==null){
//添加视频信息
List<VideoLibrary> listName = videoMapper.isRepeat(form.getName());
if(listName.size()>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
VideoLibrary entity = new VideoLibrary();
BeanUtils.copyProperties(form, entity);
entity.setStatus(0);
entity.setIsDelete(0);
entity.setResourceType(6);
......@@ -94,10 +90,8 @@ public class VideoLibrarySerivceImpl extends BaseServiceImpl<VideoLibrary,Intege
videoMapper.insert(entity);
}else{
//修改
Integer countName = videoMapper.isRepeatById(entity.getName(),entity.getId());
if(countName>0){
throw new BaseException(ResponseCodeEnum.REPEST);
}
VideoLibrary entity = videoMapper.selectByPrimaryKey(form.getId());
BeanUtils.copyProperties(form, entity);
entity.setUpdateTime(new Date());
videoMapper.updateByPrimaryKeySelective(entity);
//删除商品信息
......@@ -113,6 +107,7 @@ public class VideoLibrarySerivceImpl extends BaseServiceImpl<VideoLibrary,Intege
label.setObjectId(entity.getId());
labelMapper.delete(label);
}
VideoLibrary entity = videoMapper.selectByPrimaryKey(form.getId());
//添加商品信息
VideoGoods goods = new VideoGoods();
BeanUtils.copyProperties(form, goods);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论