|
|
|
@ -39,12 +39,11 @@ public class InviteServieImpl extends ServiceImpl<InviteMapper, Invite> implemen
|
|
|
|
|
@Override
|
|
|
|
|
public PageVO<InviteVo> queryInvite(Integer page, Integer limit) {
|
|
|
|
|
|
|
|
|
|
PageHelper.startPage(page,limit);
|
|
|
|
|
PageHelper.startPage(page, limit);
|
|
|
|
|
//查询所有课程
|
|
|
|
|
List<InviteVo> inviteVoList = inviteMapper.queryInvite();
|
|
|
|
|
if (inviteVoList.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
throw new ServiceException("400","课程数据为空");
|
|
|
|
|
if (inviteVoList.isEmpty()) {
|
|
|
|
|
throw new ServiceException("400", "课程数据为空");
|
|
|
|
|
}
|
|
|
|
|
PageInfo<InviteVo> pageInfo = new PageInfo<InviteVo>(inviteVoList);
|
|
|
|
|
PageVO<InviteVo> inviteVoPageVO = new PageVO<>();
|
|
|
|
@ -58,6 +57,7 @@ public class InviteServieImpl extends ServiceImpl<InviteMapper, Invite> implemen
|
|
|
|
|
return inviteVoPageVO;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 根据id查询就业
|
|
|
|
|
* */
|
|
|
|
@ -69,7 +69,7 @@ public class InviteServieImpl extends ServiceImpl<InviteMapper, Invite> implemen
|
|
|
|
|
Directory directory = directoryMapper.selectById(invite.getDirId());
|
|
|
|
|
InviteVo inviteVo = new InviteVo();
|
|
|
|
|
//复制给vo
|
|
|
|
|
BeanUtils.copyProperties(invite,inviteVo);
|
|
|
|
|
BeanUtils.copyProperties(invite, inviteVo);
|
|
|
|
|
inviteVo.setDirName(directory.getDirName());
|
|
|
|
|
return inviteVo;
|
|
|
|
|
}
|
|
|
|
@ -80,54 +80,48 @@ public class InviteServieImpl extends ServiceImpl<InviteMapper, Invite> implemen
|
|
|
|
|
@Override
|
|
|
|
|
public int addInvite(InviteVo vo) {
|
|
|
|
|
/*判断目录名是否为空*/
|
|
|
|
|
if (vo.getInviteName().isEmpty())
|
|
|
|
|
{
|
|
|
|
|
throw new ServiceException("400","就业名不能为空");
|
|
|
|
|
if (vo.getInviteName().isEmpty()) {
|
|
|
|
|
throw new ServiceException("400", "就业名不能为空");
|
|
|
|
|
}
|
|
|
|
|
//查询就业名称是否已经存在
|
|
|
|
|
int count = inviteMapper.selectByName(vo.getInviteName());
|
|
|
|
|
if (count>0)
|
|
|
|
|
{
|
|
|
|
|
throw new ServiceException("403","就业名已存在");
|
|
|
|
|
if (count > 0) {
|
|
|
|
|
throw new ServiceException("403", "就业名已存在");
|
|
|
|
|
}
|
|
|
|
|
//将vo值传给就业
|
|
|
|
|
Invite invite = new Invite();
|
|
|
|
|
BeanUtils.copyProperties(vo,invite);
|
|
|
|
|
BeanUtils.copyProperties(vo, invite);
|
|
|
|
|
//查询归属目录id
|
|
|
|
|
Integer dirId = directoryMapper.selectByName(vo.getDirName(),"8");
|
|
|
|
|
if (dirId==null){
|
|
|
|
|
throw new ServiceException("400","目录不存在");
|
|
|
|
|
Integer dirId = directoryMapper.selectByName(vo.getDirName(), "8");
|
|
|
|
|
if (dirId == null) {
|
|
|
|
|
throw new ServiceException("400", "目录不存在");
|
|
|
|
|
}
|
|
|
|
|
invite.setDirId(dirId);
|
|
|
|
|
invite.setInviteUpdatetime(new Date());
|
|
|
|
|
//添加就业
|
|
|
|
|
int insert = inviteMapper.insert(invite);
|
|
|
|
|
if (insert>0)
|
|
|
|
|
{
|
|
|
|
|
if (insert > 0) {
|
|
|
|
|
return insert;
|
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
throw new ServiceException("400","添加就业失败");
|
|
|
|
|
} else {
|
|
|
|
|
throw new ServiceException("400", "添加就业失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 根据id删除数据
|
|
|
|
|
* */
|
|
|
|
|
@Override
|
|
|
|
|
public int delInviteById(Integer id) {
|
|
|
|
|
if (id == null)
|
|
|
|
|
{
|
|
|
|
|
throw new ServiceException("400","查询id值为空");
|
|
|
|
|
if (id == null) {
|
|
|
|
|
throw new ServiceException("400", "查询id值为空");
|
|
|
|
|
}
|
|
|
|
|
//根据id删除
|
|
|
|
|
int count = inviteMapper.deleteById(id);
|
|
|
|
|
|
|
|
|
|
if (count>0)
|
|
|
|
|
{
|
|
|
|
|
if (count > 0) {
|
|
|
|
|
return count;
|
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
throw new ServiceException("400","删除失败");
|
|
|
|
|
} else {
|
|
|
|
|
throw new ServiceException("400", "删除失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -145,48 +139,45 @@ public class InviteServieImpl extends ServiceImpl<InviteMapper, Invite> implemen
|
|
|
|
|
|
|
|
|
|
//将vo值传给download
|
|
|
|
|
Invite invite = new Invite();
|
|
|
|
|
BeanUtils.copyProperties(vo,invite);
|
|
|
|
|
BeanUtils.copyProperties(vo, invite);
|
|
|
|
|
//查询归属目录id
|
|
|
|
|
Integer dirId = directoryMapper.selectByName(vo.getDirName(),"8");
|
|
|
|
|
Integer dirId = directoryMapper.selectByName(vo.getDirName(), "8");
|
|
|
|
|
invite.setDirId(dirId);
|
|
|
|
|
invite.setInviteUpdatetime(new Date());
|
|
|
|
|
//添加download
|
|
|
|
|
int updated = inviteMapper.updateDownloadById(invite);
|
|
|
|
|
if (updated>0)
|
|
|
|
|
{
|
|
|
|
|
if (updated > 0) {
|
|
|
|
|
return updated;
|
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
throw new ServiceException("400","更新失败");
|
|
|
|
|
} else {
|
|
|
|
|
throw new ServiceException("400", "更新失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*添加目录*/
|
|
|
|
|
|
|
|
|
|
/*添加目录*/
|
|
|
|
|
@Override
|
|
|
|
|
public void addInviteDirectory(Directory directory) {
|
|
|
|
|
if (directory.getDirName().isEmpty())
|
|
|
|
|
{
|
|
|
|
|
throw new ServiceException("400","目录名称不能为空");
|
|
|
|
|
if (directory.getDirName().isEmpty()) {
|
|
|
|
|
throw new ServiceException("400", "目录名称不能为空");
|
|
|
|
|
}
|
|
|
|
|
if (directory.getDirImg().isEmpty())
|
|
|
|
|
{
|
|
|
|
|
throw new ServiceException("400","请选择一个icon");
|
|
|
|
|
if (directory.getDirImg().isEmpty()) {
|
|
|
|
|
throw new ServiceException("400", "请选择一个icon");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Integer count = directoryMapper.selectByName(directory.getDirName(),"8");
|
|
|
|
|
if (count!=null)
|
|
|
|
|
{
|
|
|
|
|
throw new ServiceException("400","目录已存在");
|
|
|
|
|
Integer count = directoryMapper.selectByName(directory.getDirName(), "8");
|
|
|
|
|
if (count != null) {
|
|
|
|
|
throw new ServiceException("400", "目录已存在");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int uuid= UUID.randomUUID().hashCode();
|
|
|
|
|
if(uuid<0){
|
|
|
|
|
uuid=-uuid;
|
|
|
|
|
int uuid = UUID.randomUUID().hashCode();
|
|
|
|
|
if (uuid < 0) {
|
|
|
|
|
uuid = -uuid;
|
|
|
|
|
}
|
|
|
|
|
directory.setDirAddtime(new Date());
|
|
|
|
|
directory.setId(uuid);
|
|
|
|
|
directoryMapper.addInviteDirectory(directory);
|
|
|
|
|
}
|
|
|
|
|
/*查询目录*/
|
|
|
|
|
|
|
|
|
|
/*查询目录*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<DirectoryVo> queryInviteDirectory() {
|
|
|
|
|
|
|
|
|
|