Prechádzať zdrojové kódy

供应商文章part1

Aslee 3 rokov pred
rodič
commit
6899b5c406

+ 36 - 4
src/main/java/com/caimei365/user/controller/ShopApi.java

@@ -1,19 +1,20 @@
 package com.caimei365.user.controller;
 
 import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.dto.ShopArticleDto;
 import com.caimei365.user.model.dto.ShopBannerDto;
 import com.caimei365.user.model.dto.ShopUpdateDto;
+import com.caimei365.user.model.vo.ShopArticleVo;
 import com.caimei365.user.model.vo.ShopBannerVo;
 import com.caimei365.user.model.vo.ShopHomeVo;
 import com.caimei365.user.service.ShopService;
+import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 import java.util.Map;
@@ -169,4 +170,35 @@ public class ShopApi {
         return shopService.getShopPersonalData(userId);
     }
 
+    @ApiOperation("供应商文章表单")
+    @ApiImplicitParam(required = true, name = "articleId",value = "文章id")
+    @PostMapping("/article/form")
+    public ResponseJson<Map<String,Object>> shopArticleForm(Integer articleId) {
+        return shopService.getShopArticleById(articleId);
+    }
+
+    @ApiOperation("供应商文章保存")
+    @PostMapping("/article/save")
+    public ResponseJson<Void> saveShopArticle(ShopArticleDto shopArticleDto) {
+        return shopService.saveShopArticle(shopArticleDto);
+    }
+
+    @ApiOperation("供应商文章列表")
+    @ApiImplicitParams({
+        @ApiImplicitParam(required = true, name = "shopId",value = "供应商id"),
+        @ApiImplicitParam(name = "pageNum", required = true, value = "页码"),
+        @ApiImplicitParam(name = "pageSize", required = true, value = "每页数量")
+    })
+    @GetMapping("/article/list")
+    public ResponseJson<PageInfo<ShopArticleVo>> getShopArticleList(Integer shopId,
+                                                                    @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                    @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+        return shopService.getShopArticleList(shopId, pageNum, pageSize);
+    }
+
+    @ApiOperation("更新供应商文章状态")
+    @PostMapping("/article/status/update")
+    public ResponseJson<Void> updateArticleStatus(ShopArticleDto shopArticleDto) {
+        return shopService.updateArticleStatus(shopArticleDto);
+    }
 }

+ 24 - 0
src/main/java/com/caimei365/user/feign/CommodityFeign.java

@@ -0,0 +1,24 @@
+package com.caimei365.user.feign;
+
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/11/24
+ */
+@FeignClient("CAIMEI365-CLOUD-COMMODITY")
+public interface CommodityFeign {
+    /**
+     * 根据文章id更新文章索引
+     *
+     * @param articleId 文章id
+     * @return str
+     */
+    @PostMapping("/commodity/search/index/update/article")
+    String updateArticleIndex(@RequestParam Integer articleId);
+
+}

+ 56 - 0
src/main/java/com/caimei365/user/mapper/ArticleMapper.java

@@ -0,0 +1,56 @@
+package com.caimei365.user.mapper;
+
+import com.caimei365.user.model.po.ArticlePo;
+import com.caimei365.user.model.vo.*;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/3/16
+ */
+@Mapper
+public interface ArticleMapper {
+    /**
+     * 新增供应商文章
+     */
+    void insertShopArticle(ArticlePo articlePo);
+    /**
+     * 更新供应商文章
+     * @param articlePo
+     */
+    void updateShopArticle(ArticlePo articlePo);
+    /**
+     * 根据文章id查询供应商文章内容
+     */
+    ShopArticleVo getShopArticleById(Integer articleId);
+    /**
+     * 查询文章分类列表
+     */
+    List<ArticleTypeVo> getArticleTypeList();
+    /**
+     * 根据文章标签查询标签id
+     */
+    Integer getArticleLabelId(String label);
+    /**
+     * 新增文章标签
+     */
+    void insertArticleLabel(String label);
+    /**
+     * 新增文章浏览/点赞记录
+     */
+    void insertArticlePraise(Integer articleId);
+    /**
+     * 查询供应商文章列表
+     */
+    List<ShopArticleVo> getShopArticleList(Integer shopId);
+
+    /**
+     * 更新供应商文章状态
+     */
+    void updateArticleStatus(@Param("articleId") Integer articleId, @Param("status") String status);
+}

+ 1 - 0
src/main/java/com/caimei365/user/mapper/ShopMapper.java

@@ -1,6 +1,7 @@
 package com.caimei365.user.mapper;
 
 import com.caimei365.user.model.dto.ShopUpdateDto;
+import com.caimei365.user.model.po.ArticlePo;
 import com.caimei365.user.model.po.ShopCertPo;
 import com.caimei365.user.model.po.UserPo;
 import com.caimei365.user.model.vo.*;

+ 51 - 0
src/main/java/com/caimei365/user/model/dto/ShopArticleDto.java

@@ -0,0 +1,51 @@
+package com.caimei365.user.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * Description
+ * @author Aslee
+ * @version 2021-11-24
+ */
+@ApiModel("供应商保存文章")
+@Data
+public class ShopArticleDto{
+	@ApiModelProperty("文章id")
+	private Integer articleId;
+
+	@ApiModelProperty("文章标题")
+	private String title;
+
+	@ApiModelProperty("文章标签")
+	private String label;
+
+	@ApiModelProperty("SEO关键词")
+	private String keyword;
+
+	@ApiModelProperty("发布人")
+	private String publisher;
+
+	@ApiModelProperty("来源")
+	private String source;
+
+	@ApiModelProperty("供应商id")
+	private Integer shopId;
+
+	@ApiModelProperty("推荐语")
+	private String recommendContent;
+
+	@ApiModelProperty("文章内容")
+	private String articleContent;
+
+	@ApiModelProperty("文章分类id")
+	private Integer typeId;
+
+	@ApiModelProperty("引导图")
+	private String guidanceImage;
+
+	@ApiModelProperty("状态:0停用,1启用")
+	private String status;
+}

+ 102 - 0
src/main/java/com/caimei365/user/model/po/ArticlePo.java

@@ -0,0 +1,102 @@
+package com.caimei365.user.model.po;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * Description
+ * @author Aslee
+ * @version 2021-11-24
+ */
+@Data
+public class ArticlePo {
+	/**
+	 * 文章id
+	 */
+	private Integer articleId;
+
+	/**
+	 * 文章标题
+	 */
+	private String title;
+
+	/**
+	 * 文章标签
+	 */
+	private String label;
+
+	/**
+	 * SEO关键词
+	 */
+	private String keyword;
+
+	/**
+	 * 发布人
+	 */
+	private String publisher;
+
+	/**
+	 * 来源
+	 */
+	private String source;
+
+	/**
+	 * 供应商id
+	 */
+	private Integer shopId;
+
+	/**
+	 * 推荐语
+	 */
+	private String recommendContent;
+
+	/**
+	 * 文章内容
+	 */
+	private String articleContent;
+
+	/**
+	 * 文章分类id
+	 */
+	private Integer typeId;
+
+	/**
+	 * 引导图
+	 */
+	private String guidanceImage;
+
+	/**
+	 * 状态:0停用,1启用
+	 */
+	private String status;
+
+	/**
+	 * 文章发布来源:1采美,2供应商
+	 */
+	private Integer publishSource;
+
+	/**
+	 * 推荐状态:0不推荐,1推荐
+	 */
+	private Integer recommendStatus;
+
+	/**
+	 * 基础点赞
+	 */
+	private Integer basePraise;
+	/**
+	 * 基础阅读量
+	 */
+	private Integer basePv;
+	/**
+	 * 优先级
+	 */
+	private Integer priorityIndex;
+	/**
+	 * 文章审核状态:1待审核,2审核通过,3审核失败
+	 */
+	private Integer auditStatus;
+
+}

+ 26 - 0
src/main/java/com/caimei365/user/model/vo/ArticleTypeVo.java

@@ -0,0 +1,26 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/11/24
+ */
+@Data
+public class ArticleTypeVo implements Serializable {
+    /**
+     * 文章分类id
+     */
+    private Integer typeId;
+
+    /**
+     * 文章分类名称
+     */
+    private String typeName;
+
+    private static final long serialVersionUID = 1L;
+}

+ 99 - 0
src/main/java/com/caimei365/user/model/vo/ShopArticleVo.java

@@ -0,0 +1,99 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+
+/**
+ * Description
+ * @author Aslee
+ * @version 2021-11-24
+ */
+@Data
+public class ShopArticleVo {
+	/**
+	 * 文章id
+	 */
+	private Integer articleId;
+
+	/**
+	 * 文章标题
+	 */
+	private String title;
+
+	/**
+	 * 文章标签
+	 */
+	private String label;
+
+	/**
+	 * SEO关键词
+	 */
+	private String keyword;
+
+	/**
+	 * 发布人
+	 */
+	private String publisher;
+
+	/**
+	 * 来源
+	 */
+	private String source;
+
+	/**
+	 * 推荐语
+	 */
+	private String recommendContent;
+
+	/**
+	 * 文章内容
+	 */
+	private String articleContent;
+
+	/**
+	 * 文章分类id
+	 */
+	private Integer typeId;
+
+	/**
+	 * 文章分类名称
+	 */
+	private String typeName;
+
+	/**
+	 * 引导图
+	 */
+	private String guidanceImage;
+
+	/**
+	 * 点赞数
+	 */
+	private Integer praiseNum;
+
+	/**
+	 * 浏览量
+	 */
+	private Integer pvNum;
+
+	/**
+	 * 状态:0停用,1启用
+	 */
+	private String status;
+
+	/**
+	 * 审核状态:1待审核,2审核通过,3审核失败
+	 */
+	private Integer auditStatus;
+
+	/**
+	 * 发布时间
+	 */
+	private Date publishDate;
+
+	/**
+	 * 添加时间
+	 */
+	private Date createDate;
+}

+ 31 - 0
src/main/java/com/caimei365/user/service/ShopService.java

@@ -2,10 +2,13 @@ package com.caimei365.user.service;
 
 
 import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.dto.ShopArticleDto;
 import com.caimei365.user.model.dto.ShopBannerDto;
 import com.caimei365.user.model.dto.ShopUpdateDto;
+import com.caimei365.user.model.vo.ShopArticleVo;
 import com.caimei365.user.model.vo.ShopBannerVo;
 import com.caimei365.user.model.vo.ShopHomeVo;
+import com.github.pagehelper.PageInfo;
 
 import java.util.List;
 import java.util.Map;
@@ -102,4 +105,32 @@ public interface ShopService {
      * @param id  图片id
      */
     ResponseJson<Void> deleteShopHomeImages(Integer id);
+
+    /**
+     * 保存供应商文章
+     * @param shopArticleDto
+     * @return
+     */
+    ResponseJson<Void> saveShopArticle(ShopArticleDto shopArticleDto);
+
+    /**
+     * 获取供应商文章表单数据
+     * @param articleId     文章id
+     * @return
+     */
+    ResponseJson<Map<String, Object>> getShopArticleById(Integer articleId);
+
+    /**
+     * 根据供应商id查询供应商文章列表
+     * @param shopId    供应商id
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    ResponseJson<PageInfo<ShopArticleVo>> getShopArticleList(Integer shopId, int pageNum, int pageSize);
+
+    /**
+     * 更改供应商文章状态
+     */
+    ResponseJson<Void> updateArticleStatus(ShopArticleDto shopArticleDto);
 }

+ 1 - 0
src/main/java/com/caimei365/user/service/impl/RemoteCallServiceImpl.java

@@ -1,6 +1,7 @@
 package com.caimei365.user.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.caimei365.user.feign.CommodityFeign;
 import com.caimei365.user.feign.ToolsFeign;
 import com.caimei365.user.mapper.MessagePushMapper;
 import com.caimei365.user.service.RemoteCallService;

+ 109 - 2
src/main/java/com/caimei365/user/service/impl/ShopServiceImpl.java

@@ -1,18 +1,24 @@
 package com.caimei365.user.service.impl;
 
-import com.caimei365.user.components.RedisService;
+import com.caimei365.user.feign.CommodityFeign;
+import com.caimei365.user.mapper.ArticleMapper;
 import com.caimei365.user.mapper.BaseMapper;
 import com.caimei365.user.mapper.PersonalCenterMapper;
 import com.caimei365.user.mapper.ShopMapper;
 import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.dto.ShopArticleDto;
 import com.caimei365.user.model.dto.ShopBannerDto;
 import com.caimei365.user.model.dto.ShopUpdateDto;
+import com.caimei365.user.model.po.ArticlePo;
 import com.caimei365.user.model.po.ShopCertPo;
 import com.caimei365.user.model.po.UserPo;
 import com.caimei365.user.model.vo.*;
 import com.caimei365.user.service.ShopService;
 import com.caimei365.user.utils.DateUtil;
+import com.caimei365.user.utils.GenerateUtils;
 import com.caimei365.user.utils.ImageUtils;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.BeanUtils;
@@ -34,12 +40,14 @@ public class ShopServiceImpl implements ShopService {
     @Value("${caimei.wwwDomain}")
     private String wwwDomain;
     @Resource
-    private RedisService redisService;
+    private CommodityFeign commodityFeign;
     @Resource
     private BaseMapper baseMapper;
     @Resource
     private ShopMapper shopMapper;
     @Resource
+    private ArticleMapper articleMapper;
+    @Resource
     private PersonalCenterMapper personalCenterMapper;
 
 
@@ -400,4 +408,103 @@ public class ShopServiceImpl implements ShopService {
         return ResponseJson.success(result);
     }
 
+    @Override
+    public ResponseJson<Map<String, Object>> getShopArticleById(Integer articleId) {
+        Map<String, Object> map = new HashMap<>(2);
+        // 供应商文章
+        ShopArticleVo shopArticle = articleMapper.getShopArticleById(articleId);
+        // 文章分类列表
+        List<ArticleTypeVo> articleTypeList = articleMapper.getArticleTypeList();
+        map.put("shopArticle", shopArticle);
+        map.put("articleTypeList", articleTypeList);
+        return ResponseJson.success(map);
+    }
+
+    @Override
+    public ResponseJson<Void> saveShopArticle(ShopArticleDto shopArticleDto) {
+        // 参数校验
+        if (StringUtils.isEmpty(shopArticleDto.getTitle())) {
+            return ResponseJson.error("参数异常,文章标题不能为空", null);
+        }
+        if (StringUtils.isEmpty(shopArticleDto.getLabel())) {
+            return ResponseJson.error("参数异常,文章标签不能为空", null);
+        }
+        if (StringUtils.isEmpty(shopArticleDto.getKeyword())) {
+            return ResponseJson.error("参数异常,SEO关键词不能为空", null);
+        }
+        if (StringUtils.isEmpty(shopArticleDto.getPublisher())) {
+            return ResponseJson.error("参数异常,发布人不能为空", null);
+        }
+        if (StringUtils.isEmpty(shopArticleDto.getRecommendContent())) {
+            return ResponseJson.error("参数异常,推荐语不能为空", null);
+        }
+        if (StringUtils.isEmpty(shopArticleDto.getArticleContent())) {
+            return ResponseJson.error("参数异常,文章内容不能为空", null);
+        }
+        if (null == shopArticleDto.getTypeId()) {
+            return ResponseJson.error("参数异常,文章分类不能为空", null);
+        }
+        if (StringUtils.isEmpty(shopArticleDto.getGuidanceImage())) {
+            return ResponseJson.error("参数异常,引导图不能为空", null);
+        }
+        if (null == shopArticleDto.getStatus()) {
+            return ResponseJson.error("参数异常,状态不能为空", null);
+        }
+        // 保存新增的文章标签
+        String articleLabel = shopArticleDto.getLabel();
+        String[] labelArr = articleLabel.split(",");
+        for (String label : labelArr) {
+            Integer dbLabelId = articleMapper.getArticleLabelId(label);
+            if (null == dbLabelId) {
+                articleMapper.insertArticleLabel(label);
+            }
+        }
+        ArticlePo articlePo = new ArticlePo();
+        BeanUtils.copyProperties(shopArticleDto, articlePo);
+        // 新增文章标识
+        boolean newArticleFlag = null == articlePo.getArticleId() || 0 == articlePo.getArticleId();
+        // 保存供应商文章
+        if (newArticleFlag) {
+            articlePo.setPublishSource(2);
+            articlePo.setRecommendStatus(0);
+            articlePo.setBasePraise(0);
+            articlePo.setBasePv(0);
+            articlePo.setPriorityIndex(0);
+            articlePo.setAuditStatus(1);
+            articleMapper.insertShopArticle(articlePo);
+        } else {
+            articleMapper.updateShopArticle(articlePo);
+        }
+        // 更新文章索引
+        commodityFeign.updateArticleIndex(articlePo.getArticleId());
+        if (newArticleFlag) {
+            // 新增文章浏览/点赞记录
+            articleMapper.insertArticlePraise(articlePo.getArticleId());
+            // 新增文章 百度链接实时推送
+            GenerateUtils.pushBaiduLink("https://www.caimei365.com/info/detail-"+articlePo.getArticleId()+"-1.html");
+        }
+        return ResponseJson.success(null);
+    }
+
+    @Override
+    public ResponseJson<PageInfo<ShopArticleVo>> getShopArticleList(Integer shopId, int pageNum, int pageSize) {
+        if (null == shopId) {
+            return ResponseJson.error("参数异常", null);
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        List<ShopArticleVo> articleList = articleMapper.getShopArticleList(shopId);
+        PageInfo<ShopArticleVo> pageInfo = new PageInfo<>(articleList);
+        return ResponseJson.success(pageInfo);
+    }
+
+    @Override
+    public ResponseJson<Void> updateArticleStatus(ShopArticleDto shopArticleDto) {
+        Integer articleId = shopArticleDto.getArticleId();
+        String status = shopArticleDto.getStatus();
+        if (null == articleId || null == status) {
+            return ResponseJson.error("参数异常", null);
+        }
+        articleMapper.updateArticleStatus(articleId, status);
+        return ResponseJson.success(null);
+    }
 }

+ 73 - 0
src/main/java/com/caimei365/user/utils/GenerateUtils.java

@@ -0,0 +1,73 @@
+package com.caimei365.user.utils;
+
+import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.net.URLConnection;
+
+/**
+ * www静态页面生成utils
+ *
+ * @author : Charles
+ * @date : 2021/5/10
+ */
+@Slf4j
+public class GenerateUtils {
+    /**
+     * 百度链接实时推送
+     */
+    public static void pushBaiduLink(String param) {
+        String result = "";
+        PrintWriter out = null;
+        BufferedReader in = null;
+        try {
+            //建立URL之间的连接
+            URLConnection conn = new URL("http://data.zz.baidu.com/urls?site=https://www.caimei365.com&token=hgKJrx3lqsPPCf73").openConnection();
+            // 设置通用的请求属性
+            conn.setRequestProperty("User-Agent", "curl/7.12.1");
+            conn.setRequestProperty("Host", "data.zz.baidu.com");
+            conn.setRequestProperty("Content-Type", "text/plain");
+            conn.setRequestProperty("Content-Length", "83");
+            //发送POST请求必须设置如下两行
+            conn.setDoInput(true);
+            conn.setDoOutput(true);
+            //获取conn对应的输出流
+            out = new PrintWriter(conn.getOutputStream());
+            //发送请求参数
+            out.print(param.trim());
+            //进行输出流的缓冲
+            out.flush();
+            //通过BufferedReader输入流来读取Url的响应
+            in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+            String line;
+            while((line=in.readLine()) != null){
+                result += line;
+            }
+        } catch (Exception e) {
+            log.info("百度链接实时推送出现异常!" + e);
+        } finally {
+            try{
+                if(out != null) {
+                    out.close();
+                }
+                if(in != null) {
+                    in.close();
+                }
+            } catch(IOException ex) {
+                ex.printStackTrace();
+                log.info("百度链接实时推送关闭连接异常!" + ex);
+            }
+        }
+        log.info("百度链接实时推送:"+result);
+    }
+}

+ 78 - 0
src/main/resources/mapper/ArticleMapper.xml

@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei365.user.mapper.ArticleMapper">
+    <select id="getShopArticleById" resultType="com.caimei365.user.model.vo.ShopArticleVo">
+        select id            as articleId,
+               title,
+               label,
+               keyword,
+               publisher,
+               source,
+               recommendContent,
+               infoContent   as articleContent,
+               typeId,
+               guidanceImage,
+               enabledStatus as status
+        from info
+        where id = #{articleId}
+    </select>
+    <select id="getArticleTypeList" resultType="com.caimei365.user.model.vo.ArticleTypeVo">
+        select id as typeId, name as typeName from info_type where enabledStatus = '1' order by sort desc,createDate desc
+    </select>
+    <select id="getArticleLabelId" resultType="java.lang.Integer">
+        select id from info_label where name = #{label}
+    </select>
+    <select id="getShopArticleList" resultType="com.caimei365.user.model.vo.ShopArticleVo">
+        select i.id            as articleId,
+               title,
+               ip.num as praiseNum,
+               ip.pv as pvNum,
+               publisher,
+               source,
+               it.name as typeName,
+               guidanceImage,
+               i.pubdate as publishDate,
+               i.createDate,
+               i.auditStatus,
+               i.enabledStatus as status
+        from info i
+        left join info_type it on i.typeId = it.id
+        left join info_praise ip on i.id = ip.infoId
+        where shopId = #{shopId} and publishSource = 2
+        order by i.createDate desc
+    </select>
+    <insert id="insertShopArticle"  parameterType="com.caimei365.user.model.po.ArticlePo" keyProperty="articleId" useGeneratedKeys="true">
+        insert into info (typeId, title, label, publisher, source, publishSource, shopId, keyword,
+                          recommendContent, infoContent, guidanceImage,
+                          recommendStatus, enabledStatus, basePraise, basePv, priorityIndex,
+                          auditStatus, createDate)
+        values (#{typeId}, #{title}, #{label}, #{publisher}, #{source}, #{publishSource}, #{shopId},
+                #{keyword}, #{recommendContent}, #{articleContent}, #{guidanceImage}, #{recommendStatus},
+                #{status}, #{basePraise}, #{basePv}, #{priorityIndex}, #{auditStatus}, NOW())
+    </insert>
+    <insert id="insertArticleLabel">
+        insert into info_label (name, createDate)
+        values (#{label}, NOW())
+    </insert>
+    <insert id="insertArticlePraise">
+        insert into info_praise (infoId, num, pv)
+        values (#{articleId}, 0, 0)
+    </insert>
+    <update id="updateShopArticle">
+        update info
+        set typeId           = #{typeId},
+            title            = #{title},
+            label            = #{label},
+            publisher        = #{publisher},
+            source           = #{source},
+            keyword          = #{keyword},
+            recommendContent = #{recommendContent},
+            infoContent      = #{articleContent},
+            guidanceImage    = #{guidanceImage},
+            enabledStatus    = #{status}
+        where id = #{articleId}
+    </update>
+    <update id="updateArticleStatus">
+        update info set enabledStatus = #{status} where id = #{articleId}
+    </update>
+</mapper>