fix
Helius
2022-10-07 2762e01a72e93dc6703c06c701b28ceffe7c9de8
fix
12 files modified
52 ■■■■■ changed files
src/main/java/com/xcong/farmer/cms/core/handler/FriendlyDataParserHandler.java 9 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/core/node/Template.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/core/tag/model/Friendly.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddArticleDto.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdateArticleDto.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/mapper/CmsFriendlyLinkMapper.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java 3 ●●●●● patch | view | raw | blame | history
src/main/resources/application.yml 4 ●●●● patch | view | raw | blame | history
src/main/resources/logback-spring.xml 2 ●●● patch | view | raw | blame | history
src/main/resources/mapper/ArticleMapper.xml 2 ●●● patch | view | raw | blame | history
src/main/resources/mapper/CmsFriendlyLinkMapper.xml 7 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/core/handler/FriendlyDataParserHandler.java
@@ -2,6 +2,7 @@
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.xcong.farmer.cms.core.node.AttrNode;
import com.xcong.farmer.cms.core.tag.data.FriendlyData;
import com.xcong.farmer.cms.core.tag.model.Ad;
@@ -26,7 +27,13 @@
        Long companyId = (Long) attrNode.getSystemDataValue("companyId");
        Friendly param = (Friendly) attrNode.getParam();
        List<CmsFriendlyLinkEntity> friendlies = cmsFriendlyLinkMapper.selectByGroupIdAndCompanyId(Long.parseLong(param.getGroupId()), companyId);
        List<CmsFriendlyLinkEntity> friendlies = null;
        if (StrUtil.isNotBlank(param.getGroupId())) {
            friendlies = cmsFriendlyLinkMapper.selectByGroupIdAndCompanyId(Long.parseLong(param.getGroupId()), companyId);
        } else {
            friendlies = cmsFriendlyLinkMapper.selectByGroupCodeAndCompanyId(param.getCode(), companyId);
        }
        if (CollUtil.isEmpty(friendlies)) {
            attrNode.setData(new FriendlyData());
        } else {
src/main/java/com/xcong/farmer/cms/core/node/Template.java
@@ -117,6 +117,8 @@
            FileOutputStream outputStream = new FileOutputStream(path + this.name + suffix);
            outputStream.write(html.getBytes());
            outputStream.close();
            document = null;
        } catch (IOException e) {
            e.printStackTrace();
        }
src/main/java/com/xcong/farmer/cms/core/tag/model/Friendly.java
@@ -6,6 +6,8 @@
 **/
public class Friendly {
    private String code;
    private String groupId;
    private String field;
@@ -25,4 +27,12 @@
    public void setField(String field) {
        this.field = field;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
}
src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddArticleDto.java
@@ -71,4 +71,7 @@
    @ApiModelProperty(value = "保存状态 1-仅保存 2-保存并发布")
    private int saveState;
    @ApiModelProperty(value = "是否草稿 1-是 2-否")
    private Integer draftState;
}
src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdateArticleDto.java
@@ -73,4 +73,7 @@
    @ApiModelProperty(value = "保存状态 1-仅保存 2-保存并发布")
    private int saveState;
    @ApiModelProperty(value = "是否草稿 1-是 2-否")
    private Integer draftState;
}
src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java
@@ -90,6 +90,11 @@
     */
    private Long beforeColumnId;
    /**
     * 草稿状态 1-是 2-否
     */
    private Integer draftState;
    @TableField(exist = false)
    private String columnCode;
src/main/java/com/xcong/farmer/cms/modules/system/mapper/CmsFriendlyLinkMapper.java
@@ -12,4 +12,6 @@
    Page<CmsFriendlyLinkEntity> selectInPage(Page<CmsFriendlyLinkEntity> page, @Param("record") CmsFriendlyLinkEntity cmsFriendlyLinkEntity);
    List<CmsFriendlyLinkEntity> selectByGroupIdAndCompanyId(@Param("groupId") Long groupId, @Param("companyId") Long companyId);
    List<CmsFriendlyLinkEntity> selectByGroupCodeAndCompanyId(@Param("code") String code, @Param("companyId") Long companyId);
}
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
@@ -131,6 +131,7 @@
        articleEntity.setArticleUrl(adminAddArticleDto.getArticleUrl());
        articleEntity.setType(adminAddArticleDto.getType());
        articleEntity.setContentType(adminAddArticleDto.getContentType());
        articleEntity.setDraftState(adminAddArticleDto.getDraftState());
        this.baseMapper.insert(articleEntity);
        if (adminAddArticleDto.getSaveState() == 2) {
@@ -214,6 +215,7 @@
        String authorBelong = adminUpdateArticleDto.getAuthorBelong();
        articleEntity.setAuthorBelong(authorBelong);
        articleEntity.setDraftState(adminUpdateArticleDto.getDraftState());
        this.baseMapper.updateById(articleEntity);
        if (adminUpdateArticleDto.getSaveState() == 2) {
@@ -322,6 +324,7 @@
        if(ObjectUtil.isEmpty(articleEntity)){
            return Result.fail("文章不存在");
        }
        articleEntity.setDraftState(2);
        articleEntity.setReleaseStatus(ArticleEntity.RELEASE_STATUS_YES);
        this.baseMapper.updateById(articleEntity);
src/main/resources/application.yml
@@ -113,7 +113,7 @@
cms:
  api-url: http://120.27.238.55:8878
  static-url: http://120.27.238.55:8000/cms/static/
  template-path: /Users/helius/Desktop/template-online/template
  template-path: /Users/helius/Documents/xcong/cms/test/template
  static-path: /Users/helius/Desktop/template-online/static
  output-path: /Users/helius/Desktop/template-online/output
  output-path: /Users/helius/Documents/xcong/cms/test/output
src/main/resources/logback-spring.xml
@@ -134,7 +134,7 @@
    <!--开发环境:打印控制台-->
    <springProfile name="dev">
        <logger name="com.kss.kssframework" level="debug"/>
        <logger name="com.xcong.farmer.cms" level="debug"/>
    </springProfile>
    <root level="info">
src/main/resources/mapper/ArticleMapper.xml
@@ -158,7 +158,7 @@
    <select id="selectArticleByColumnId" resultType="com.xcong.farmer.cms.modules.system.entity.ArticleEntity">
        select * from t_article a
        where a.column_id=#{columnId} and a.company_id=#{companyId} and a.del_status = 1
        where a.column_id=#{columnId} and a.company_id=#{companyId} and a.del_status = 1 and draft_state=2
        <if test="type != 4">
            <if test="type == 2">
                and release_status=1
src/main/resources/mapper/CmsFriendlyLinkMapper.xml
@@ -20,4 +20,11 @@
        select * from cms_friendly_link
        where group_id=#{groupId} and company_id=#{companyId}
    </select>
    <select id="selectByGroupCodeAndCompanyId" resultType="com.xcong.farmer.cms.modules.system.entity.CmsFriendlyLinkEntity">
        select
            *
        from cms_friendly_link a, cms_group_info b
        where a.group_id=b.id and b.code=#{code} and a.company_id=#{companyId}
    </select>
</mapper>