XMTT 7 anni fa
parent
commit
f4f10d0344

+ 0 - 6
src/main/java/com/ekexiu/console/system/dao/ArticleDao.java

@ -74,12 +74,6 @@ public interface ArticleDao {
74 74
    @From(Article.class)
75 75
    int updateSubject(Connection con, String articleId, @Set String subject) throws SQLException;
76 76
77
    @Nullable
78
    @QueryVal
79
    @Column(handlerClass = StringHandler.class, value = "article_img")
80
    @From(Article.class)
81
    String queryImagePath(Connection con, String articleId) throws SQLException;
82
83 77
    @Nullable
84 78
    @QueryOne
85 79
    ArticleInfo queryInfo(Connection con, String articleId) throws SQLException;

+ 29 - 7
src/main/java/com/ekexiu/console/system/service/DiscoverBannerService.java

@ -3,6 +3,7 @@ package com.ekexiu.console.system.service;
3 3
4 4
import com.ekexiu.console.system.dao.ArticleDao;
5 5
import com.ekexiu.console.system.dao.DiscoverBannerDao;
6
import com.ekexiu.console.system.po.Article;
6 7
import com.ekexiu.console.system.po.DiscoverBanner;
7 8
import com.ekexiu.console.system.vo.ConsoleAuthUser;
8 9
import freemarker.cache.StringTemplateLoader;
@ -42,27 +43,27 @@ public class DiscoverBannerService {
42 43
43 44
    private String templatePc = "<ul id=\"slide-list\" class=\"slide-list floatL\">\n" +
44 45
            "    <li class=\"slide-item slide-item-active\" data-id=\"${banner[0].articleId}\" data-col=\"${banner[0].bannerId}\">\n" +
45
            "        <a href=\"articalShow.html?articleId=${banner[0].articleId}\" target=\"_blank\" style=\"background-image:url('/data/article/${banner[0].image}');\">\n" +
46
            "        <a href=\"/shtml/a/${banner[0].time}/${banner[0].shareId}.html\" target=\"_blank\" style=\"background-image:url('/data/article/${banner[0].image}');\">\n" +
46 47
            "            <p class=\"title\">${banner[0].title}</p>\n" +
47 48
            "        </a>\n" +
48 49
            "    </li>\n" +
49 50
            "    <li class=\"slide-item\" data-id=\"${banner[1].articleId}\" data-col=\"${banner[1].bannerId}\">\n" +
50
            "        <a href=\"articalShow.html?articleId=${banner[1].articleId}\" target=\"_blank\" style=\"background-image:url('/data/article/${banner[1].image}');\">\n" +
51
            "        <a href=\"/shtml/a/${banner[1].time}/${banner[1].shareId}.html\" target=\"_blank\" style=\"background-image:url('/data/article/${banner[1].image}');\">\n" +
51 52
            "            <p class=\"title\">${banner[1].title}</p>\n" +
52 53
            "        </a>\n" +
53 54
            "    </li>\n" +
54 55
            "    <li class=\"slide-item\" data-id=\"${banner[2].articleId}\" data-col=\"${banner[2].bannerId}\">\n" +
55
            "        <a href=\"articalShow.html?articleId=${banner[2].articleId}\" target=\"_blank\" style=\"background-image:url('/data/article/${banner[2].image}');\">\n" +
56
            "        <a href=\"/shtml/a/${banner[2].time}/${banner[2].shareId}.html\" target=\"_blank\" style=\"background-image:url('/data/article/${banner[2].image}');\">\n" +
56 57
            "            <p class=\"title\">${banner[2].title}</p>\n" +
57 58
            "        </a>\n" +
58 59
            "    </li>\n" +
59 60
            "    <li class=\"slide-item\" data-id=\"${banner[3].articleId}\" data-col=\"${banner[3].bannerId}\">\n" +
60
            "        <a href=\"articalShow.html?articleId=${banner[3].articleId}\" target=\"_blank\" style=\"background-image:url('/data/article/${banner[3].image}');\">\n" +
61
            "        <a href=\"/shtml/a/${banner[3].time}/${banner[3].shareId}.html\" target=\"_blank\" style=\"background-image:url('/data/article/${banner[3].image}');\">\n" +
61 62
            "            <p class=\"title\">${banner[3].title}</p>\n" +
62 63
            "        </a>\n" +
63 64
            "    </li>\n" +
64 65
            "    <li class=\"slide-item\" data-id=\"${banner[4].articleId}\" data-col=\"${banner[4].bannerId}\">\n" +
65
            "        <a href=\"articalShow.html?articleId=${banner[4].articleId}\" target=\"_blank\" style=\"background-image:url('/data/article/${banner[4].image}');\">\n" +
66
            "        <a href=\"/shtml/a/${banner[4].time}/${banner[4].shareId}.html\" target=\"_blank\" style=\"background-image:url('/data/article/${banner[4].image}');\">\n" +
66 67
            "            <p class=\"title\">${banner[4].title}</p>\n" +
67 68
            "        </a>\n" +
68 69
            "    </li>\n" +
@ -282,11 +283,14 @@ public class DiscoverBannerService {
282 283
        this.discoverBannerDao.update(con, discoverBanner);
283 284
        Banner b = new Banner();
284 285
        b.setArticleId(discoverBanner.getArticleId());
285
        String image = this.articleDao.queryImagePath(con, discoverBanner.getArticleId());
286
        b.setImage(image);
286
        //String image = this.articleDao.queryImagePath(con, discoverBanner.getArticleId());
287
        Article article = this.articleDao.queryBaseInfo(con, discoverBanner.getArticleId());
288
        b.setImage(article.getArticleImg());
287 289
        b.setBanner(dictBanner(discoverBanner.getBanner()));
288 290
        b.setTitle(discoverBanner.getTitle());
289 291
        b.setBannerId(id);
292
        b.setShareId(String.valueOf(article.getShareId()));
293
        b.setTime(article.getCreateTime().substring(0,8));
290 294
        banners.add(b);
291 295
    }
292 296
@ -317,6 +321,8 @@ public class DiscoverBannerService {
317 321
        private String title;
318 322
        private String banner;
319 323
        private Long bannerId;
324
        private String shareId;
325
        private String time;
320 326
321 327
        public String getArticleId() {
322 328
            return articleId;
@ -357,6 +363,22 @@ public class DiscoverBannerService {
357 363
        public void setBannerId(Long bannerId) {
358 364
            this.bannerId = bannerId;
359 365
        }
366
367
        public String getShareId() {
368
            return shareId;
369
        }
370
371
        public void setShareId(String shareId) {
372
            this.shareId = shareId;
373
        }
374
375
        public String getTime() {
376
            return time;
377
        }
378
379
        public void setTime(String time) {
380
            this.time = time;
381
        }
360 382
    }
361 383
    
362 384
}