Browse Source

案例管理

lyhzzz 2 years ago
parent
commit
ef2c8092cb

+ 27 - 5
src/main/java/com/fdkankan/ucenter/controller/ArticleController.java

@@ -1,9 +1,14 @@
 package com.fdkankan.ucenter.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.ucenter.common.BaseController;
 import com.fdkankan.ucenter.common.Result;
 import com.fdkankan.ucenter.entity.Article;
+import com.fdkankan.ucenter.entity.Case;
 import com.fdkankan.ucenter.service.IArticleService;
+import com.fdkankan.ucenter.service.ICaseService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.ObjectUtils;
 import org.springframework.web.bind.annotation.*;
@@ -18,19 +23,36 @@ import org.springframework.web.bind.annotation.*;
  */
 @RestController
 @RequestMapping("/ucenter/article")
-public class ArticleController {
+public class ArticleController extends BaseController {
 
     @Autowired
-    IArticleService articleService;
+    ICaseService caseService;
     /**
      * 行业解决方案-案例展示
      */
     @PostMapping("/detail")
-    public Result detail(@RequestBody Article article) throws Exception {
-        if(ObjectUtils.isEmpty(article.getId())){
+    public Result detail(@RequestBody Case caseEntity) throws Exception {
+        if(ObjectUtils.isEmpty(caseEntity.getId())){
             return Result.success();
         }
-        return Result.success(articleService.getById(article.getId()));
+        return Result.success(caseService.getById(caseEntity.getId()));
+    }
+
+    @PostMapping("/allList")
+    public Result allList(@RequestBody Case caseEntity) throws Exception {
+        String lang = getLang();
+        if("zh".equals(lang)){
+            lang = "cn";
+        }
+        LambdaQueryWrapper<Case> wrapper = new LambdaQueryWrapper<>();
+        if(StringUtils.isNotBlank(caseEntity.getTypeId())){
+            wrapper.eq(Case::getTypeId,caseEntity.getTypeId());
+        }
+        wrapper.eq(Case::getLanguage,lang);
+        wrapper.eq(Case::getIsPublic,1);
+        wrapper.orderByAsc(Case::getSort);
+        wrapper.orderByAsc(Case::getId);
+        return Result.success(caseService.list(wrapper));
     }
 }
 

+ 108 - 0
src/main/java/com/fdkankan/ucenter/entity/Case.java

@@ -0,0 +1,108 @@
+package com.fdkankan.ucenter.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2023-08-11
+ */
+@Getter
+@Setter
+@TableName("t_case")
+public class Case implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 案例标题
+     */
+    @TableField("title")
+    private String title;
+
+    /**
+     * 案例文案
+     */
+    @TableField("sub_title")
+    private String subTitle;
+
+    @TableField("type_id")
+    private String typeId;
+
+    @TableField("icon_ids")
+    private String iconIds;
+
+    /**
+     * 排序字段
+     */
+    @TableField("sort")
+    private Integer sort;
+
+    /**
+     * 案例logo	
+     */
+    @TableField("logo")
+    private String logo;
+
+    /**
+     * 详情内容
+     */
+    @TableField("detail_content")
+    private String detailContent;
+
+    /**
+     * 详情图片
+     */
+    @TableField("cover_image_url")
+    private String coverImageUrl;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * 是否发布,0否,1是
+     */
+    @TableField("is_public")
+    private Integer isPublic;
+
+    /**
+     * 发布时间
+     */
+    @TableField("public_time")
+    private Date publicTime;
+
+    @TableField("language")
+    private String language;
+
+    /**
+     * 是否显示,0否,1是
+     */
+    @TableField("is_show")
+    private Integer isShow;
+
+    @TableField("sys_user_id")
+    private Integer sysUserId;
+
+
+}

+ 1 - 1
src/main/java/com/fdkankan/ucenter/generate/AutoGenerate.java

@@ -18,7 +18,7 @@ public class AutoGenerate {
         String path =System.getProperty("user.dir") ;
 
         generate(path,"ucenter", getTables(new String[]{
-                "t_exceed_space_scene",
+                "t_case",
         }));
 
 //        generate(path,"goods", getTables(new String[]{

+ 18 - 0
src/main/java/com/fdkankan/ucenter/mapper/ICaseMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.ucenter.mapper;
+
+import com.fdkankan.ucenter.entity.Case;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2023-08-11
+ */
+@Mapper
+public interface ICaseMapper extends BaseMapper<Case> {
+
+}

+ 16 - 0
src/main/java/com/fdkankan/ucenter/service/ICaseService.java

@@ -0,0 +1,16 @@
+package com.fdkankan.ucenter.service;
+
+import com.fdkankan.ucenter.entity.Case;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2023-08-11
+ */
+public interface ICaseService extends IService<Case> {
+
+}

+ 20 - 0
src/main/java/com/fdkankan/ucenter/service/impl/CaseServiceImpl.java

@@ -0,0 +1,20 @@
+package com.fdkankan.ucenter.service.impl;
+
+import com.fdkankan.ucenter.entity.Case;
+import com.fdkankan.ucenter.mapper.ICaseMapper;
+import com.fdkankan.ucenter.service.ICaseService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2023-08-11
+ */
+@Service
+public class CaseServiceImpl extends ServiceImpl<ICaseMapper, Case> implements ICaseService {
+
+}

+ 5 - 0
src/main/resources/mapper/ucenter/CaseMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.ucenter.mapper.ICaseMapper">
+
+</mapper>