瀏覽代碼

Merge branch 'master' of shikejing/guns-separation into master

shikejing 4 年之前
父節點
當前提交
befdab90e7

+ 93 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlArticleContentController.java

@ -0,0 +1,93 @@
package cn.stylefeng.guns.zjxl.cnotroller;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import cn.stylefeng.guns.zjxl.service.ZjxlArticleContentService;
import cn.stylefeng.guns.zjxlUtil.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/***
 * @ClassName: ZjxlArticleContentController
 * @Description:文章内容管理
 * @Auther: shi kejing
 * @Date: 2020/11/3 17:40
 */
@RestController
@Api(description = "文章内容管理")
@RequestMapping(value = "/zjxl/zjxlArticleContent")
public class ZjxlArticleContentController extends BaseController {
    @Autowired
    private ZjxlArticleContentService articleContentService;
    @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,
                                         @ApiParam(name = "articleContentTitle", value = "文章标题", required = false) @RequestParam(value = "articleContentTitle", required = false)String articleContentTitle,
                                         @ApiParam(name = "page", value = "第几页", defaultValue = "0") @RequestParam(value = "page", required = false) Integer page,
                                         @ApiParam(name = "pagesize", value = "分页大小", defaultValue = "10") @RequestParam(value = "pagesize", required = false) Integer pagesize){
        try {
            return write(200,"查询成功","data",articleContentService.findArticleContentById(id,articleContentTitle,page,pagesize));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"查询失败");
        }
    }
    @RequestMapping(value = "/addArticleContent", method = RequestMethod.POST)
    @ApiOperation(value = "添加文章")
    public String addArticleContent(
            @ApiParam(name = "articleContentTitle", value = "文章标题", required = false) @RequestParam(value = "articleContentTitle", required = false)String articleContentTitle,
            @ApiParam(name = "articleContentCover", value = "封面", required = false) @RequestParam(value = "articleContentCover", required = false)String articleContentCover,
            @ApiParam(name = "articleContentAbstract", value = "摘要", required = false) @RequestParam(value = "articleContentAbstract", required = false) String articleContentAbstract,
            @ApiParam(name = "articleContentType", value = "内容类型 1-产品与服务  2-公司案例  3-新闻中心  4-关于我们", required = false) @RequestParam(value = "articleContentType", required = false)Integer articleContentType,
            @ApiParam(name = "articleContentClassify", value = "分类", required = false) @RequestParam(value = "articleContentClassify", required = false)String articleContentClassify,
            @ApiParam(name = "articleContentSubclassify", value = "子分类", required = false) @RequestParam(value = "articleContentSubclassify", required = false)String articleContentSubclassify,
            @ApiParam(name = "articleContentSort", value = "排序", required = false) @RequestParam(value = "articleContentSort", required = false)Integer articleContentSort,
            @ApiParam(name = "articleContentIsLine", value = "是否上线", required = false, defaultValue = "0") @RequestParam(value = "articleContentIsLine", required = false)Integer articleContentIsLine){
        try {
            ZjxlArticleContent articleContent = new ZjxlArticleContent();
            articleContent.setArticleContentTitle(articleContentTitle);
            articleContent.setArticleContentCover(articleContentCover);
            articleContent.setArticleContentAbstract(articleContentAbstract);
            articleContent.setArticleContentType(articleContentType);
            articleContent.setArticleContentClassify(articleContentClassify);
            articleContent.setArticleContentSubclassify(articleContentSubclassify);
            articleContent.setArticleContentSort(articleContentSort);
            articleContent.setArticleContentIsLine(articleContentIsLine);
            return write(200,"添加成功","data",articleContentService.addArticleContent(articleContent));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"添加失败");
        }
    }
    @RequestMapping(value = "/deleteArticleContent", method = RequestMethod.DELETE)
    @ApiOperation(value = "删除文章管理")
    public String deleteArticleContent(@ApiParam(name = "id", value = "文章id") @RequestParam(value = "id") String id){
        try {
            return write(200,"删除成功","data",articleContentService.deleteArticleContent(id));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"删除失败");
        }
    }
    @RequestMapping(value = "/updateArticleContent", method = RequestMethod.POST)
    @ApiOperation(value = "修改是否上线")
    public String updateArticleContent(@ApiParam(name = "id", value = "文章id") @RequestParam(value = "id") String id,
                                       @ApiParam(name = "isLine", value = "是否上线") @RequestParam(value = "isLine") Integer isLine){
        try {
            return write(200,"修改上线成功","data",articleContentService.updateArticleContent(id,isLine));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"修改上线失败");
        }
    }
}

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

@ -65,7 +65,7 @@ public class ZjxlBannerCnotroller extends BaseController {
                            @ApiParam(name = "bannerType", value = "跳转方式", required = false) @RequestParam(value = "bannerType", required = false)Integer bannerType,
                            @ApiParam(name = "bannerTypeUrl", value = "跳转链接", required = false) @RequestParam(value = "bannerTypeUrl", required = false)String bannerTypeUrl,
                            @ApiParam(name = "bannerSort", value = "排序", required = false) @RequestParam(value = "bannerSort", required = false)Integer bannerSort,
                            @ApiParam(name = "bannerIsLine", value = "是否上线", required = false) @RequestParam(value = "bannerIsLine", required = false)Integer bannerIsLine){
                            @ApiParam(name = "bannerIsLine", value = "是否上线", required = false,defaultValue = "0") @RequestParam(value = "bannerIsLine", required = false)Integer bannerIsLine){
        ZjxlBanner banner = new ZjxlBanner();
        banner.setBannerImage(bannerImage);//String
        banner.setBannerIsLine(bannerIsLine);//integer

+ 2 - 2
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlPartnerController.java

@ -46,7 +46,7 @@ public class ZjxlPartnerController extends BaseController {
    public String addPartenr(@ApiParam(name = "partnerName", value = "合作伙伴名称", required = false) @RequestParam(value = "partnerName", required = false)String partnerName,
                             @ApiParam(name = "partnerImg", value = "合作伙伴图片", required = false) @RequestParam(value = "partnerImg", required = false)String partnerImg,
                             @ApiParam(name = "partnerSort", value = "排序", required = false) @RequestParam(value = "partnerSort", required = false)Integer partnerSort,
                             @ApiParam(name = "partnerIsLine", value = "是否上线", required = false) @RequestParam(value = "partnerIsLine", required = false)Integer partnerIsLine){
                             @ApiParam(name = "partnerIsLine", value = "是否上线", required = false, defaultValue = "0") @RequestParam(value = "partnerIsLine", required = false)Integer partnerIsLine){
        try {
            ZjxlPartner partner = new ZjxlPartner();
            partner.setPartnerName(partnerName);
@ -71,7 +71,7 @@ public class ZjxlPartnerController extends BaseController {
        }
    }
    @RequestMapping(value = "/", method = RequestMethod.DELETE)
    @RequestMapping(value = "/deletePartner", method = RequestMethod.DELETE)
    @ApiOperation(value = "删除合作伙伴")
    public String deletePartner(String id){
        try {

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

@ -0,0 +1,87 @@
package cn.stylefeng.guns.zjxl.cnotroller;
import cn.stylefeng.guns.zjxl.model.ZjxlSystemDict;
import cn.stylefeng.guns.zjxl.service.ZjxlSystemDictService;
import cn.stylefeng.guns.zjxlUtil.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/***
 * @ClassName: ZjxlSystemDictController
 * @Description:
 * @Auther: shi kejing
 * @Date: 2020/11/4 9:31
 */
@RestController
@RequestMapping(value = "/zjxl/systemDict")
@Api(description = "系统管理字典")
public class ZjxlSystemDictController extends BaseController {
    @Autowired
    private ZjxlSystemDictService systemDictService;
    @RequestMapping(value = "/findSystemDictById", method = RequestMethod.GET)
    @ApiOperation("查询系统管理字典")
    public String findSystemDictById(            @ApiParam(name = "id", value = "systemDictId", required = false) @RequestParam(value = "id", required = false)String id,
//                                                 @ApiParam(name = "name", value = "partnername", required = false) @RequestParam(value = "name", required = false)String name,
                                                 @ApiParam(name = "page", value = "第几页", defaultValue = "0") @RequestParam(value = "page", required = false) Integer page,
                                                 @ApiParam(name = "pagesize", value = "分页大小", defaultValue = "10") @RequestParam(value = "pagesize", required = false) Integer pagesize){
        try {
            return write(200,"查询成功","data",systemDictService.findSystemDictById(id,page,pagesize));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"查询失败");
        }
    }
    @RequestMapping(value = "/addSystemDict", method = RequestMethod.POST)
    @ApiOperation("添加系统管理字典")
    public String addSystemDict(
                                @ApiParam(name = "systemDictType", value = "类型 1-产品与服务  2-公司案例  3-新闻中心  4-关于我们", required = false)@RequestParam(value = "systemDictType", required = false) Integer systemDictType,
                                @ApiParam(name = "systemDictClassify", value = "分类", required = false)@RequestParam(value = "systemDictClassify", required = false) String systemDictClassify,
                                @ApiParam(name = "systemDictSubclassify", value = "子分类", required = false)@RequestParam(value = "systemDictSubclassify", required = false) String systemDictSubclassify,
                                @ApiParam(name = "systemDictSort", value = "排序", required = false)@RequestParam(value = "systemDictSort", required = false) Integer systemDictSort,
                                @ApiParam(name = "systemDictIsLine", value = "是否上线", required = false, defaultValue = "0")@RequestParam(value = "systemDictIsLine", required = false) Integer systemDictIsLine){
        try {
            ZjxlSystemDict systemDict = new ZjxlSystemDict();
            systemDict.setSystemDictType(systemDictType);
            systemDict.setSystemDictClassify(systemDictClassify);
            systemDict.setSystemDictSubclassify(systemDictSubclassify);
            systemDict.setSystemDictSort(systemDictSort);
            systemDict.setSystemDictIsLine(systemDictIsLine);
            return write(200,"添加成功","data",systemDictService.addSystemDict(systemDict));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"添加失败");
        }
    }
    @RequestMapping(value = "/deleteSystemDict", method = RequestMethod.DELETE)
    @ApiOperation(value = "删除字典")
    public String deleteSystemDict(@ApiParam(name = "id", value = "systemDictId", required = false) @RequestParam(value = "id", required = false)String id){
        try {
            return write(200,"删除成功","data",systemDictService.deleteSystemDict(id));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"删除失败");
        }
    }
    @RequestMapping(value = "/updateSystemDict", method = RequestMethod.POST)
    @ApiOperation(value = "修改是否上线")
    public String updateSystemDict(@ApiParam(name = "id", value = "systemDictId", required = false) @RequestParam(value = "id", required = false)String id,
                                   @ApiParam(name = "isLine", value = "是否上线", required = false) @RequestParam(value = "isLine", required = false)Integer isLine){
        try {
            return write(200,"修改上线成功","data",systemDictService.updateSystemDict(id,isLine));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"修改上线失败");
        }
    }
}

+ 24 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/dao/ZjxlArticleContentDao.java

@ -0,0 +1,24 @@
package cn.stylefeng.guns.zjxl.dao;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/***
 * @ClassName: ZjxlArticleContentDao
 * @Description:
 * @Auther: shi kejing
 * @Date: 2020/11/3 17:40
 */
public interface ZjxlArticleContentDao extends PagingAndSortingRepository<ZjxlArticleContent,Long>, JpaSpecificationExecutor<ZjxlArticleContent> {
    @Modifying
    @Query("delete from ZjxlArticleContent a where a.articleContentId = ?1")
    int deleteByArticleContentId(String id);
    @Modifying
    @Query("update ZjxlArticleContent a set a.articleContentIsLine = ?2 where a.articleContentId = ?1 ")
    int updateByArticleContentId(String id,Integer isLine);
}

+ 25 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/dao/ZjxlSystemDictDao.java

@ -0,0 +1,25 @@
package cn.stylefeng.guns.zjxl.dao;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import cn.stylefeng.guns.zjxl.model.ZjxlSystemDict;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/***
 * @ClassName: ZjxlSystemDictDao
 * @Description:
 * @Auther: shi kejing
 * @Date: 2020/11/4 9:14
 */
public interface ZjxlSystemDictDao extends PagingAndSortingRepository<ZjxlSystemDict,Long>, JpaSpecificationExecutor<ZjxlSystemDict> {
    @Modifying
    @Query("delete from ZjxlSystemDict a where a.systemDictId = ?1")
    int deleteBySystemDictId(String id);
    @Modifying
    @Query("update ZjxlSystemDict a set a.systemDictIsLine = ?2 where a.systemDictId = ?1")
    int updateBySystemDictId(String id, Integer isLine);
}

+ 98 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlArticleContent.java

@ -0,0 +1,98 @@
package cn.stylefeng.guns.zjxl.model;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/***
 * @ClassName: ZjxlArticleContent
 * @Description:
 * @Auther: shi kejing
 * @Date: 2020/11/3 17:36
 */
@Entity
@Table(name = "zjxl_article_content")
public class ZjxlArticleContent {
   private String articleContentId;
    private String articleContentTitle;
    private String articleContentCover;
    private String articleContentAbstract;
    private Integer articleContentType;
    private String articleContentClassify;
    private String articleContentSubclassify;
    private Integer articleContentSort;
    private Integer articleContentIsLine;
    @Id
    public String getArticleContentId() {
        return articleContentId;
    }
    public void setArticleContentId(String articleContentId) {
        this.articleContentId = articleContentId;
    }
    public String getArticleContentTitle() {
        return articleContentTitle;
    }
    public void setArticleContentTitle(String articleContentTitle) {
        this.articleContentTitle = articleContentTitle;
    }
    public String getArticleContentCover() {
        return articleContentCover;
    }
    public void setArticleContentCover(String articleContentCover) {
        this.articleContentCover = articleContentCover;
    }
    public String getArticleContentAbstract() {
        return articleContentAbstract;
    }
    public void setArticleContentAbstract(String articleContentAbstract) {
        this.articleContentAbstract = articleContentAbstract;
    }
    public Integer getArticleContentType() {
        return articleContentType;
    }
    public void setArticleContentType(Integer articleContentType) {
        this.articleContentType = articleContentType;
    }
    public String getArticleContentClassify() {
        return articleContentClassify;
    }
    public void setArticleContentClassify(String articleContentClassify) {
        this.articleContentClassify = articleContentClassify;
    }
    public String getArticleContentSubclassify() {
        return articleContentSubclassify;
    }
    public void setArticleContentSubclassify(String articleContentSubclassify) {
        this.articleContentSubclassify = articleContentSubclassify;
    }
    public Integer getArticleContentSort() {
        return articleContentSort;
    }
    public void setArticleContentSort(Integer articleContentSort) {
        this.articleContentSort = articleContentSort;
    }
    public Integer getArticleContentIsLine() {
        return articleContentIsLine;
    }
    public void setArticleContentIsLine(Integer articleContentIsLine) {
        this.articleContentIsLine = articleContentIsLine;
    }
}

+ 71 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlSystemDict.java

@ -0,0 +1,71 @@
package cn.stylefeng.guns.zjxl.model;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/***
 * @ClassName: ZjxlSystemDict
 * @Description:
 * @Auther: shi kejing
 * @Date: 2020/11/4 9:10
 */
@Entity
@Table(name = "zjxl_system_dict")
public class ZjxlSystemDict {
    private String systemDictId;
    private Integer systemDictType;
    private String systemDictClassify;
    private String systemDictSubclassify;
    private Integer systemDictSort;
    private Integer systemDictIsLine;
    @Id
    public String getSystemDictId() {
        return systemDictId;
    }
    public void setSystemDictId(String systemDictId) {
        this.systemDictId = systemDictId;
    }
    public Integer getSystemDictType() {
        return systemDictType;
    }
    public void setSystemDictType(Integer systemDictType) {
        this.systemDictType = systemDictType;
    }
    public String getSystemDictClassify() {
        return systemDictClassify;
    }
    public void setSystemDictClassify(String systemDictClassify) {
        this.systemDictClassify = systemDictClassify;
    }
    public String getSystemDictSubclassify() {
        return systemDictSubclassify;
    }
    public void setSystemDictSubclassify(String systemDictSubclassify) {
        this.systemDictSubclassify = systemDictSubclassify;
    }
    public Integer getSystemDictSort() {
        return systemDictSort;
    }
    public void setSystemDictSort(Integer systemDictSort) {
        this.systemDictSort = systemDictSort;
    }
    public Integer getSystemDictIsLine() {
        return systemDictIsLine;
    }
    public void setSystemDictIsLine(Integer systemDictIsLine) {
        this.systemDictIsLine = systemDictIsLine;
    }
}

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

@ -0,0 +1,59 @@
package cn.stylefeng.guns.zjxl.service;
import cn.stylefeng.guns.zjxl.dao.ZjxlArticleContentDao;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import cn.stylefeng.guns.zjxlUtil.BaseService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/***
 * @ClassName: ZjxlArticleContentService
 * @Description:
 * @Auther: shi kejing
 * @Date: 2020/11/3 17:40
 */
@Component
@Transactional(rollbackFor = Exception.class)
public class ZjxlArticleContentService extends BaseService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ZjxlArticleContentDao articleContentDao;
    public List<ZjxlArticleContent> findArticleContentById(String id,String articleContentTitle,Integer page,Integer pagesiz){
        String sql = "select * from zjxl_article_content where 1=1 ";
        if (StringUtils.isNotEmpty(id)){
            sql += " and article_content_id = '"+id+"'";
        }
        if (StringUtils.isNotEmpty(articleContentTitle)){
            sql += " and article_content_title like '%"+articleContentTitle+"%'";
        }
        sql += " order by article_content_sort desc limit "+page+" , "+pagesiz+"";
        List<ZjxlArticleContent> articleContentList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlArticleContent.class));
        return articleContentList;
    }
    public String addArticleContent(ZjxlArticleContent articleContent){
        articleContent.setArticleContentId(getCode());
        ZjxlArticleContent content = articleContentDao.save(articleContent);
        return content.getArticleContentId();
    }
    public int deleteArticleContent(String id){
        articleContentDao.deleteByArticleContentId(id);
        return 1;
    }
    public int updateArticleContent(String id, Integer isLine){
        articleContentDao.updateByArticleContentId(id, isLine);
        return 1;
    }
}

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

@ -0,0 +1,55 @@
package cn.stylefeng.guns.zjxl.service;
import cn.stylefeng.guns.zjxl.dao.ZjxlSystemDictDao;
import cn.stylefeng.guns.zjxl.model.ZjxlSystemDict;
import cn.stylefeng.guns.zjxlUtil.BaseService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/***
 * @ClassName: ZjxlSystemDictService
 * @Description:
 * @Auther: shi kejing
 * @Date: 2020/11/4 9:19
 */
@Component
@Transactional(rollbackFor = Exception.class)
public class ZjxlSystemDictService extends BaseService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ZjxlSystemDictDao systemDictDao;
    public String addSystemDict(ZjxlSystemDict systemDict){
        systemDict.setSystemDictId(getCode());
        ZjxlSystemDict dict = systemDictDao.save(systemDict);
        return dict.getSystemDictId();
    }
    public List<ZjxlSystemDict> findSystemDictById(String id,Integer page,Integer pagesize){
        String sql = "select * from zjxl_system_dict where 1=1 ";
        if (StringUtils.isNotEmpty(id)){
            sql += " and system_dict_id = '"+id+"'";
        }
        sql += " order by system_dict_sort desc limit "+page+" , "+pagesize+"";
        List<ZjxlSystemDict> systemDictList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlSystemDict.class));
        return systemDictList;
    }
    public int updateSystemDict(String id, Integer isLine){
        systemDictDao.updateBySystemDictId(id,isLine);
        return 1;
    }
    public int deleteSystemDict(String id){
        systemDictDao.deleteBySystemDictId(id);
        return 1;
    }
}