Shi Kejing 4 år sedan
förälder
incheckning
dd2afb0bba

+ 23 - 3
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlArticleContentController.java

@ -1,12 +1,15 @@
package cn.stylefeng.guns.zjxl.cnotroller;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import cn.stylefeng.guns.zjxl.model.ZjxlSystemDict;
import cn.stylefeng.guns.zjxl.service.ZjxlArticleContentService;
import cn.stylefeng.guns.zjxl.service.ZjxlSystemDictService;
import cn.stylefeng.guns.zjxlUtil.BaseController;
import cn.stylefeng.guns.zjxlUtil.PageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -37,6 +40,9 @@ public class ZjxlArticleContentController extends BaseController {
    @Autowired
    private ZjxlArticleContentService articleContentService;
    @Autowired
    private ZjxlSystemDictService systemDictService;
    @RequestMapping(value = "/findArticleContentById", method = RequestMethod.GET)
    @ApiOperation(value = "查询文章管理列表")
    public String findArticleContentById(@ApiParam(name = "id", value = "文章id", required = false) @RequestParam(value = "id", required = false)String id,
@ -72,8 +78,9 @@ public class ZjxlArticleContentController extends BaseController {
            if (list.size() > 0){
                Iterator<ZjxlArticleContent> iterator = list.iterator();
                while (iterator.hasNext()){
                    if (articleContentTitle.equals(iterator.next()));
                    return write(-1,"改文章已存在");
                    if (articleContentTitle.equals(iterator.next().getArticleContentTitle())){
                        return write(-1,"改文章已存在");
                    }
                }
            }
@ -160,7 +167,20 @@ public class ZjxlArticleContentController extends BaseController {
            }
            logger.info("内容类型:articleContentType====="+articleContentType);
            logger.info("分类:articleContentClassify====="+articleContentClassify);
            return write(200,"操作成功","data",articleContentService.getArticleContentSubclassify(articleContentType,articleContentClassify));
            List<ZjxlArticleContent> list = articleContentService.getArticleContentSubclassify(articleContentType,articleContentClassify);
            if (list.size() > 0){
                return write(200,"操作成功","data",list);
            }else {
                ZjxlArticleContent content = new ZjxlArticleContent();
                List<ZjxlSystemDict> systemDictList = systemDictService.findNewsTypeA(new Integer(articleContentType),articleContentClassify);
                if (systemDictList.size() > 0){
                    for (int i=0;i<systemDictList.size();i++){
                        content.setArticleContentSubclassify(systemDictList.get(i).getSystemDictSubclassify());
                        list.add(content);
                    }
                }
             return write(200,"操作成功","data",list);
            }
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"操作失败");

+ 1 - 1
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlSystemDictController.java

@ -69,7 +69,7 @@ public class ZjxlSystemDictController extends BaseController {
            if (systemDictClassifyList>0){
                return write(-1,"该分类已存在,请勿重复添加");
            }
            if (systemDictSubclassifyList>0){
            if (systemDictClassifyList > 0 && systemDictSubclassifyList>0){
                return write(-1,"该子分类已存在,请勿重复添加");
            }
            systemDict.setSystemDictClassify(systemDictClassify);

+ 1 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlArticleContentService.java

@ -78,6 +78,7 @@ public class ZjxlArticleContentService extends BaseService {
        String sql = "select * from zjxl_article_content where article_content_type = "+articleContentType+" and article_content_classify = '"+articleContentClassify+"' group by article_content_subclassify";
        List<ZjxlArticleContent> articleContentList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlArticleContent.class));
        return articleContentList;
        //SELECT * FROM zjxl_system_dict WHERE system_dict_type = 4 AND system_dict_classify = '公司介绍分类4'
    }
    public List<ZjxlArticleContent> getArticleContent(String articleContentType,String articleContentClassify,String articleContentSubclassify){

+ 7 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlSystemDictService.java

@ -86,4 +86,11 @@ public class ZjxlSystemDictService extends BaseService {
        List<ZjxlSystemDict> systemDictList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlSystemDict.class));
        return systemDictList;
    }
    public List<ZjxlSystemDict> findNewsTypeA(Integer systemDictType,String articleContentClassify){
        String sql = "select * from zjxl_system_dict where system_dict_type = "+systemDictType+"    AND system_dict_classify = '"+articleContentClassify+"' group by system_dict_subclassify";
        List<ZjxlSystemDict> systemDictList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlSystemDict.class));
        return systemDictList;
    }
}