6 files modified
1 files added
| | |
| | | package com.xcong.farmer.cms.configurations; |
| | | |
| | | import com.xcong.farmer.cms.configurations.properties.CmsProperties; |
| | | import com.xcong.farmer.cms.core.template.TemplateConfiguration; |
| | | import com.xcong.farmer.cms.core.template.TemplateLoader; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | |
| | | @Configuration |
| | | public class CmsConfig { |
| | | |
| | | @Autowired |
| | | private CmsProperties cmsProperties; |
| | | |
| | | @Bean |
| | | public TemplateConfiguration templateConfiguration() { |
| | | log.info("CMS管理系统"); |
| | | TemplateConfiguration cfg = new TemplateConfiguration("/Users/helius/Desktop/template", "", "/Users/helius/Desktop/web/output"); |
| | | TemplateConfiguration cfg = new TemplateConfiguration(cmsProperties.getTemplatePath(), cmsProperties.getStaticPath(), cmsProperties.getOutputPath()); |
| | | TemplateLoader loader = new TemplateLoader(cfg); |
| | | cfg.templateLoader(loader); |
| | | return cfg; |
| New file |
| | |
| | | package com.xcong.farmer.cms.configurations.properties; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Data |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = "cms.file") |
| | | public class CmsProperties { |
| | | |
| | | private String templatePath; |
| | | |
| | | private String staticPath; |
| | | |
| | | private String outputPath; |
| | | |
| | | } |
| | |
| | | cmsTemplateService.delete(id); |
| | | return Result.ok("删除成功"); |
| | | } |
| | | |
| | | @ApiOperation(value = "模板下拉列表", notes = "模板下拉列表接口") |
| | | @GetMapping(value = "/dropdownList") |
| | | public Result dropdownList() { |
| | | return Result.ok(cmsTemplateService.dropdownList()); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.xcong.farmer.cms.common.response.Result; |
| | | import com.xcong.farmer.cms.modules.system.dto.TemplateListDto; |
| | | import com.xcong.farmer.cms.modules.system.entity.CmsTemplateEntity; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | IPage<CmsTemplateEntity> findInPage(TemplateListDto templateListDto); |
| | | |
| | | void delete(Long id); |
| | | |
| | | Result dropdownList(); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xcong.farmer.cms.common.exception.GlobalException; |
| | | import com.xcong.farmer.cms.common.response.Result; |
| | | import com.xcong.farmer.cms.common.utils.FileUtils; |
| | | import com.xcong.farmer.cms.configurations.GlobalExceptionHandler; |
| | | import com.xcong.farmer.cms.core.template.TemplateConfiguration; |
| | | import com.xcong.farmer.cms.modules.system.dto.TemplateListDto; |
| | | import com.xcong.farmer.cms.modules.system.entity.CmsTemplateEntity; |
| | | import com.xcong.farmer.cms.modules.system.entity.UserEntity; |
| | | import com.xcong.farmer.cms.modules.system.mapper.CmsTemplateMapper; |
| | | import com.xcong.farmer.cms.modules.system.service.ICmsTemplateService; |
| | | import com.xcong.farmer.cms.modules.system.util.LoginUserUtil; |
| | |
| | | Long companyId = LoginUserUtil.getCompanyId(); |
| | | this.baseMapper.delete(id, companyId); |
| | | } |
| | | |
| | | @Override |
| | | public Result dropdownList() { |
| | | Long companyId = LoginUserUtil.getCompanyId(); |
| | | QueryWrapper<CmsTemplateEntity> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("company_id",companyId); |
| | | List<CmsTemplateEntity> cmsTemplateEntities = this.baseMapper.selectList(objectQueryWrapper); |
| | | return Result.ok(cmsTemplateEntities); |
| | | } |
| | | } |
| | |
| | | url: http://120.27.238.55:8000/uploadeFile/image/ |
| | | path: /home/javaweb/webresource/uploadeFile/image/ |
| | | |
| | | cms: |
| | | file: |
| | | template-path: /Users/helius/Desktop/template |
| | | static-path: |
| | | output-path: /Users/helius/Desktop/web/output |
| | | |
| | |
| | | url: http://192.168.0.11:8878/image/ |
| | | path: /image/ |
| | | |
| | | cms: |
| | | file: |
| | | template-path: /Users/helius/Desktop/template |
| | | static-path: |
| | | output-path: /Users/helius/Desktop/web/output |
| | | |