Shi Kejing %!s(int64=4) %!d(string=hai) anos
pai
achega
d6106f794f

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

@ -62,11 +62,20 @@ public class ZjxlSystemDictController extends BaseController {
        try {
            ZjxlSystemDict systemDict = new ZjxlSystemDict();
            systemDict.setSystemDictType(systemDictType);
            //查询分类是否存在
            int systemDictClassifyList = systemDictService.findSystemDictClassify(systemDictClassify);
            //查询子分类是否存在
            int systemDictSubclassifyList = systemDictService.findSystemDictSubclassify(systemDictSubclassify);
            if (systemDictClassifyList>0){
                return write(-1,"该分类已存在,请勿重复添加");
            }
            if (systemDictSubclassifyList>0){
                return write(-1,"该子分类已存在,请勿重复添加");
            }
            systemDict.setSystemDictClassify(systemDictClassify);
            systemDict.setSystemDictSubclassify(systemDictSubclassify);
            systemDict.setSystemDictSort(systemDictSort);
            systemDict.setSystemDictIsLine(systemDictIsLine);
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
            systemDict.setSystemDictCreateTime(df.format(new Date()));// new Date()为获取当前系统时间

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

@ -1,6 +1,7 @@
package cn.stylefeng.guns.zjxl.service;
import cn.stylefeng.guns.zjxl.dao.ZjxlSystemDictDao;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import cn.stylefeng.guns.zjxl.model.ZjxlSystemDict;
import cn.stylefeng.guns.zjxlUtil.BaseService;
import org.apache.commons.lang3.StringUtils;
@ -33,6 +34,19 @@ public class ZjxlSystemDictService extends BaseService {
        return dict.getSystemDictId();
    }
    public int findSystemDictClassify(String systemDictClassify){
        String sql = "select count(1) from zjxl_system_dict where system_dict_classify = '"+systemDictClassify+"' ";
        Integer articleContentList = jdbcTemplate.queryForObject(sql, Integer.class);
        return articleContentList;
    }
    public int findSystemDictSubclassify(String systemDictSubclassify){
        String sql = "select count(1) from zjxl_system_dict where system_dict_subclassify = '"+systemDictSubclassify+"' ";
        Integer articleContentList = jdbcTemplate.queryForObject(sql, Integer.class);
        return articleContentList;
    }
    public List<ZjxlSystemDict> findSystemDictById(String id,Integer systemDictType,Integer page,Integer pagesize){
        String sql = "select * from zjxl_system_dict where 1=1 ";
        if (StringUtils.isNotEmpty(id)){