|
|
@ -12,6 +12,8 @@ import com.ccsens.ptos_open.bean.po.OpenPluginWithBLOBs; |
|
|
|
import com.ccsens.ptos_open.bean.vo.PluginVo; |
|
|
|
import com.ccsens.ptos_open.persist.dao.PluginDao; |
|
|
|
import com.ccsens.ptos_open.persist.mapper.OpenPluginImgMapper; |
|
|
|
import com.ccsens.ptos_open.util.OpenCodeError; |
|
|
|
import com.ccsens.util.exception.BaseException; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
@ -45,7 +47,7 @@ public class PluginService implements IPluginService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void savePlugin(PluginDto.SavePlugin param, Long userId) { |
|
|
|
public PluginVo.PluginReturn savePlugin(PluginDto.SavePlugin param, Long userId) { |
|
|
|
//TODO 验证用户权限
|
|
|
|
//添加插件
|
|
|
|
OpenPluginWithBLOBs openPlugin = new OpenPluginWithBLOBs(); |
|
|
@ -73,5 +75,62 @@ public class PluginService implements IPluginService { |
|
|
|
openPluginImgMapper.insertSelective(pluginImg); |
|
|
|
}); |
|
|
|
} |
|
|
|
//返回插件的id和name
|
|
|
|
PluginVo.PluginReturn pluginReturn = new PluginVo.PluginReturn(); |
|
|
|
pluginReturn.setId(openPlugin.getId()); |
|
|
|
pluginReturn.setName(openPlugin.getName()); |
|
|
|
return pluginReturn; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void updatePlugin(PluginDto.UpdatePlugin param, Long userId) { |
|
|
|
//查询插件,判断插件是否存在
|
|
|
|
Boolean a = pluginDao.verifyById(param.getId()); |
|
|
|
if (a == null || !a) { |
|
|
|
throw new BaseException(OpenCodeError.NOT_PLUGIN); |
|
|
|
} |
|
|
|
//判断当前用户是否是插件的创建
|
|
|
|
OpenPluginWithBLOBs pluginWithBLOBs = new OpenPluginWithBLOBs(); |
|
|
|
pluginWithBLOBs.setId(param.getId()); |
|
|
|
//修改插件信息
|
|
|
|
if (param.getName() != null && !param.getName().equals("")) { |
|
|
|
pluginWithBLOBs.setName(param.getName()); |
|
|
|
} |
|
|
|
if (param.getVersions() != null && !param.getVersions().equals("")) { |
|
|
|
pluginWithBLOBs.setVersions(param.getVersions()); |
|
|
|
} |
|
|
|
if (param.getIntro() != null && !param.getIntro().equals("")) { |
|
|
|
pluginWithBLOBs.setIntro(param.getIntro()); |
|
|
|
} |
|
|
|
if (param.getDescription() != null && !param.getDescription().equals("")) { |
|
|
|
pluginWithBLOBs.setDescription(param.getDescription()); |
|
|
|
} |
|
|
|
if (param.getHtml() != null && !param.getHtml().equals("")) { |
|
|
|
pluginWithBLOBs.setHtml(param.getHtml()); |
|
|
|
} |
|
|
|
if (param.getCss() != null && !param.getCss().equals("")) { |
|
|
|
pluginWithBLOBs.setCss(param.getCss()); |
|
|
|
} |
|
|
|
if (param.getJs() != null && !param.getJs().equals("")) { |
|
|
|
pluginWithBLOBs.setJs(param.getJs()); |
|
|
|
} |
|
|
|
if (param.getConfig() != null && !param.getConfig().equals("")) { |
|
|
|
pluginWithBLOBs.setConfig(param.getConfig()); |
|
|
|
} |
|
|
|
pluginWithBLOBs.setPublish(param.getPublish()); |
|
|
|
//处理预览图和轮播图
|
|
|
|
if(param.getPreview() != null){ |
|
|
|
//删除之前的预览图,添加新的预览图
|
|
|
|
} |
|
|
|
pluginDao.updateByPrimaryKeySelective(pluginWithBLOBs); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|