| | |
| | | Long companyId = (Long) node.getSystemDataValue("companyId"); |
| | | Articles param = (Articles) node.getParam(); |
| | | |
| | | if (StrUtil.isEmpty(param.getColId())) { |
| | | Page<ArticleEntity> page = new Page<>(Integer.parseInt(param.getPage()), Integer.parseInt(param.getLimit())); |
| | | |
| | | ArticleEntity article = new ArticleEntity(); |
| | | Page<ArticleEntity> page = new Page<>(Integer.parseInt(param.getPage()), Integer.parseInt(param.getLimit())); |
| | | if (StrUtil.isEmpty(param.getColId())) { |
| | | |
| | | article.setColumnCode(param.getCode()); |
| | | |
| | | } else { |
| | | List<String> colIdsStr = StrUtil.split(param.getColId(), ','); |
| | | List<Long> colIds = new ArrayList<>(); |
| | | colIdsStr.forEach(item -> { |
| | | colIds.add(Long.parseLong(item)); |
| | | }); |
| | | |
| | | article.setColumnIds(colIds); |
| | | } |
| | | article.setCompanyId(companyId); |
| | | IPage<ArticleEntity> listPage = articleMapper.selectArticleInPage(page, article); |
| | | |
| | |
| | | } |
| | | |
| | | node.setData(list); |
| | | } else { |
| | | |
| | | } |
| | | } |
| | | |
| | | public ArticleData entityToData(ArticleEntity article) { |
| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.xcong.farmer.cms.core.node.AttrNode; |
| | | import com.xcong.farmer.cms.core.tag.model.Child; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @author wzy |
| | | * @date 2022-06-29 |
| | | **/ |
| | | @Slf4j |
| | | public class ChildDataParserHandler implements DataParserHandler { |
| | | |
| | | @Override |
| | | public void dataParser(AttrNode attrNode) { |
| | | System.out.println("ChildDataParserHandler"); |
| | | log.info("#数据子集执行#"); |
| | | Map<String, Object> parserData = attrNode.getParserData(); |
| | | |
| | | Object param = attrNode.getParam(); |
| | | JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(param)); |
| | | String obj = jsonObject.getString("obj"); |
| | | Child param = (Child) attrNode.getParam(); |
| | | String obj = param.getObj(); |
| | | |
| | | Object o = parserData.get(obj); |
| | | Object state = JSONObject.parseObject(JSONObject.toJSONString(o)).get("state"); |
| | |
| | | |
| | | ColumnEntity columnEntity = columnMapper.selectByCodeAndCompanyId(param.getCode(), companyId); |
| | | |
| | | if (columnEntity == null) { |
| | | return; |
| | | } |
| | | ColumnData columnData = columnToData(columnEntity); |
| | | if (columnEntity.getParentId() == 0L) { |
| | | List<ColumnEntity> child = columnMapper.selectColumnByParentId(columnEntity.getId(), companyId); |
| | |
| | | |
| | | /** |
| | | * (x + y)/2 = index |
| | | * y - x= size 解二元一次方程 |
| | | * y - x= size 解二元一次方程 x-起点 y-终点 |
| | | * |
| | | * @param index 当前页码 |
| | | * @param totalPage 总页数 |
| | |
| | | } |
| | | } |
| | | |
| | | if (attrNode.tagsEnum != null && attrNode.tagsEnum.getType() == 1) { |
| | | this.put(attrNode.getField(), result.toString()); |
| | | } |
| | | |
| | | attrNode.getElement().append(result.toString()); |
| | | return attrNode.getElement().toString(); |
| | | } |
| | |
| | | // 文件名称 |
| | | private String name = "index"; |
| | | // 文件保存路径 |
| | | private String path; |
| | | private String path = ""; |
| | | |
| | | private Document document; |
| | | private Map<String, Map<String, Object>> params = new HashMap<>(); |
| | |
| | | releaseService.releaseColumn(id, article); |
| | | return Result.ok("success"); |
| | | } |
| | | |
| | | @ApiOperation(value = "发布首页", notes = "发布首页") |
| | | @PostMapping(value = "/releaseIndex") |
| | | public Result releaseIndex() { |
| | | releaseService.releaseIndex(); |
| | | return Result.ok("success"); |
| | | } |
| | | } |
| | |
| | | */ |
| | | void columnProcess(Map<String, Object> map, String templateName, boolean columnOnly); |
| | | |
| | | void indexProcess(Map<String, Object> map, String templateName); |
| | | |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | } |
| | | cfg.process(data, templateName); |
| | | } |
| | | |
| | | @Override |
| | | public void indexProcess(@NotNull Map<String, Object> data, String templateName) { |
| | | if (StrUtil.isEmpty(templateName)) { |
| | | templateName = "index.html"; |
| | | } |
| | | |
| | | data.put("companyId", 23L); |
| | | cfg.process(data, templateName); |
| | | } |
| | | } |
| | |
| | | package com.xcong.farmer.cms.modules.system.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.xcong.farmer.cms.common.system.base.BaseEntity; |
| | | import lombok.Data; |
| | | import org.tron.trident.abi.datatypes.Int; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 栏目表 |
| | |
| | | |
| | | // 栏目目录 |
| | | private String path; |
| | | |
| | | @TableField(exist = false) |
| | | private List<Long> ids; |
| | | } |
| | |
| | | ColumnEntity selectByCodeAndCompanyId(@Param("code") String code, @Param("companyId") Long companyId); |
| | | |
| | | List<ColumnEntity> selectColumnByParentId(@Param("parentId") Long parentId, @Param("companyId") Long companyId); |
| | | |
| | | IPage<ColumnEntity> selectColumnInPage(Page<ColumnEntity> page, @Param("record") ColumnEntity column); |
| | | } |
| | |
| | | void releaseArticle(Long id); |
| | | |
| | | void releaseColumn(Long id, boolean article); |
| | | |
| | | void releaseIndex(); |
| | | } |
| | |
| | | map.put("templatePath", columnEntity.getPath()); |
| | | cmsCoreService.columnProcess(map, columnEntity.getListTemplate(), article); |
| | | } |
| | | |
| | | @Override |
| | | public void releaseIndex() { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | cmsCoreService.indexProcess(map, null); |
| | | } |
| | | } |
| | |
| | | <if test="record.columnCode != null and record.columnCode != ''"> |
| | | and c.column_code=#{record.columnCode} |
| | | </if> |
| | | <if test="record.columnIds != null"> |
| | | and c.id in |
| | | <foreach collection="record.columnIds" item="item" open="(" close=")" separator=","> |
| | | ${item} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | select * from t_column |
| | | where parent_id=#{parentId} and company_id=#{companyId} |
| | | </select> |
| | | |
| | | <select id="selectColumnInPage" resultType="com.xcong.farmer.cms.modules.system.entity.ColumnEntity"> |
| | | select |
| | | * |
| | | from t_column |
| | | where company_id=#{companyId} |
| | | <if test="record.ids != null"> |
| | | and id in |
| | | <foreach collection="record.columnIds" item="item" open="(" close=")" separator=","> |
| | | ${item} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | </mapper> |