Commit febade2d by 吴迪

【新增】首页接口提交

parent 48484d07
......@@ -137,7 +137,24 @@ public class IndexCarouselManageController extends AbstractController {
}
}
@Login
@PostMapping("/api/smallImages")
// @RequiresPermissions("generator:indexcarouselmanage:bigImages")
public R smallImages() {
try {
QueryWrapper<IndexCarouselManageEntity> newsEntityQueryWrapper = new QueryWrapper<>();
newsEntityQueryWrapper.eq("classnum","小轮播");
newsEntityQueryWrapper.eq("checkflag_index","1");
newsEntityQueryWrapper.gt("levels","0");
newsEntityQueryWrapper.orderByDesc("levels_index");
List<IndexCarouselManageEntity> list = indexCarouselManageService.list(newsEntityQueryWrapper);
return R.ok().put("data", list);
} catch (Exception e) {
log.error("verifyIndexCarouselManage error:", e);
return R.error(e.getMessage());
}
}
......
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.List;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.TopicnewsEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.service.TopicnewsService;
import io.office.modules.manage.vo.request.TopicNewsPartyRequestVo;
import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -81,7 +80,7 @@ public class TopicnewsController extends AbstractController {
R r = this.topicnewsService.updateHdbd(news, getUser());
return r;
} catch (Exception e) {
log.error("update error:", e);
log.error("update error: {}", e);
return R.error(e.getMessage());
}
}
......@@ -96,7 +95,7 @@ public class TopicnewsController extends AbstractController {
R r = this.topicnewsService.deleteHdbd(ids, getUser());
return r;
} catch (Exception e) {
log.error("delete error:", e);
log.error("delete error: {}", e);
return R.error(e.getMessage());
}
}
......@@ -111,9 +110,23 @@ public class TopicnewsController extends AbstractController {
R r = this.topicnewsService.verifyTopic(news,getUser());
return r;
} catch (Exception e) {
log.error("verifyTopic error:", e);
log.error("verifyTopic error: {}", e);
return R.error(e.getMessage());
}
}
@Login
@PostMapping("/api/get4PartyTopNews")
// @RequiresPermissions("generator:indexcarouselmanage:pictureImageList")
public R get4PartyTopNews(@RequestBody TopicNewsPartyRequestVo topicNewsPartyRequestVo) {
try {
return R.ok().put("data", topicnewsService.getTopicNewsByCondition(topicNewsPartyRequestVo));
} catch (Exception e) {
log.error("get4PartyTopNews error: {}", e);
return R.error(e.getMessage());
}
}
}
......@@ -5,6 +5,8 @@ import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.TopicnewsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.vo.request.TopicNewsPartyRequestVo;
import io.office.modules.manage.vo.response.TopicNewsPartyVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -21,4 +23,8 @@ import java.util.List;
public interface TopicnewsDao extends BaseMapper<TopicnewsEntity> {
List<NewsEntity> selectTopicList(@Param("newsParams") NewsParams newsParams, Page page);
List<TopicNewsPartyVo>getTopicNewsByCondition(TopicNewsPartyRequestVo topicNewsPartyRequestVo);
}
......@@ -7,6 +7,8 @@ import io.office.common.utils.R;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.TopicnewsEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.vo.request.TopicNewsPartyRequestVo;
import io.office.modules.manage.vo.response.TopicNewsPartyVo;
import io.office.modules.sys.entity.SysUserEntity;
import java.util.List;
......@@ -32,5 +34,9 @@ public interface TopicnewsService extends IService<TopicnewsEntity> {
R verifyTopic(NewsEntity news, SysUserEntity user);
Page<NewsEntity> selectTopicList(NewsParams newsParams, Page page);
List<TopicNewsPartyVo>getTopicNewsByCondition(TopicNewsPartyRequestVo topicNewsPartyRequestVo);
}
......@@ -11,6 +11,8 @@ import io.office.modules.manage.entity.TopicnewsEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.service.NewsService;
import io.office.modules.manage.service.TopicnewsService;
import io.office.modules.manage.vo.request.TopicNewsPartyRequestVo;
import io.office.modules.manage.vo.response.TopicNewsPartyVo;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -103,4 +105,10 @@ public class TopicnewsServiceImpl extends ServiceImpl<TopicnewsDao, TopicnewsEnt
return page;
}
@Override
public List<TopicNewsPartyVo> getTopicNewsByCondition(TopicNewsPartyRequestVo topicNewsPartyRequestVo) {
return topicnewsDao.getTopicNewsByCondition(topicNewsPartyRequestVo);
}
}
\ No newline at end of file
package io.office.modules.manage.vo.request;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* 
 @description:
*
* @author wudi
* @date 15:26 2021/11/13
*/
@Data
public class TopicNewsPartyRequestVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer id;
/**
* $column.comments
*/
private Integer classid;
/**
* $column.comments
*/
private Integer newsid;
/**
* $column.comments
*/
private Integer newslevels;
/**
* $column.comments
*/
private Date time;
private int count;
}
package io.office.modules.manage.vo.response;
import lombok.Data;
import java.io.Serializable;
/**
*
* 
 @description:
*
* @author wudi
* @date 15:26 2021/11/13
*/
@Data
public class TopicNewsPartyVo implements Serializable {
private String classid;
private String newsid;
private String yid;
private String newslevels;
private String time;
private String title;
private String author;
private String updatedate;
private String levels;
private String id;
}
......@@ -38,4 +38,31 @@
levels DESC,
releasedate DESC
</select>
<select id="getTopicNewsByCondition" parameterType="io.office.modules.manage.vo.request.TopicNewsPartyRequestVo" resultType="io.office.modules.manage.vo.response.TopicNewsPartyVo">
SELECT
top ${count} a.classid,
a.newsid,
a.id AS yid,
a.newslevels,
a.time,
b.title,
b.author,
b.updatedate,
b.levels,
b.id
FROM
TopIcNews AS a
LEFT JOIN news AS b ON a.newsid = b.id
WHERE
STATUS = 1
AND a.classid = #{classid}
ORDER BY
levels DESC,
releasedate DESC
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment