2 Commits 3294ac0c96 ... 2d56a4f545

Author SHA1 Message Date
  songshuai 2d56a4f545 Commit. 5 years ago
  songshuai 551c12a518 新增获取分类列表接口 5 years ago

+ 2 - 1
src/main/java/cn/efunbox/audio/config/Config.java

@@ -50,7 +50,8 @@ public class Config extends WebMvcConfigurerAdapter{
 
         registry.addInterceptor(adminInterceptor())
                 .addPathPatterns("/**", "/device/update", "/device/delete")
-                .excludePathPatterns("/device/**","/audio/info/{audioId}", "/error", "/admin/login", "/audio/search","/file/**","/audio/searchList","/statistics","/album","/album/{albumId}");
+                .excludePathPatterns("/device/**","/audio/info/{audioId}", "/error", "/admin/login", "/audio/search","/file/**","/audio/searchList","/statistics","/album","/album/{albumId}")
+                .excludePathPatterns("/getTypeList");
 
         registry.addInterceptor(ignoreOptionsInterceptor())
                 .addPathPatterns("/**");

+ 24 - 0
src/main/java/cn/efunbox/audio/controller/res/ResCategoryController.java

@@ -0,0 +1,24 @@
+package cn.efunbox.audio.controller.res;
+
+import cn.efunbox.audio.entity.res.ResCategory;
+import cn.efunbox.audio.service.res.ResCategoryService;
+import cn.efunbox.audio.utils.ResApiResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping
+public class ResCategoryController {
+
+    @Autowired
+    ResCategoryService resCategoryService;
+
+    @RequestMapping(value = "/getTypeList")
+    public ResApiResult<ResCategory> getResCategoryList(@RequestHeader(value = "USERID",required = false) String USERID){
+       return resCategoryService.getResCategoryList();
+    }
+
+
+}

+ 2 - 2
src/main/java/cn/efunbox/audio/entity/res/ResAlbum.java

@@ -25,8 +25,8 @@ public class ResAlbum {
     @Column(name = "content_name")
     private String contentName;
 
-    @Column(name = "shor_trecommend")
-    private String shorTrecommend;
+    @Column(name = "shortRecommend")
+    private String shortRecommend;
 
     @Column(name = "long_recommend")
     private String longRecommend;

+ 6 - 0
src/main/java/cn/efunbox/audio/entity/res/ResCategory.java

@@ -34,6 +34,12 @@ public class ResCategory {
     @Column(name = "type_update_time")
     private String typeUpdateTime;
 
+    @Column(name = "is_del")
+    private String isDel;
+
+    @Column(name = "renewal")
+    private String renewal;
+
     @Column(name = "gmt_created")
     private Date gmtCreated;
 

+ 30 - 0
src/main/java/cn/efunbox/audio/impl/res/ResCategoryServiceImpl.java

@@ -0,0 +1,30 @@
+package cn.efunbox.audio.impl.res;
+
+import cn.efunbox.audio.entity.res.ResCategory;
+import cn.efunbox.audio.repository.res.ResCategoryRepository;
+import cn.efunbox.audio.service.res.ResCategoryService;
+import cn.efunbox.audio.utils.ApiResult;
+import cn.efunbox.audio.utils.ResApiResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class ResCategoryServiceImpl implements ResCategoryService {
+
+    @Autowired
+    ResCategoryRepository resCategoryRepository;
+
+    /**
+     * 获取分类列表
+     * @return
+     */
+    @Override
+    public ResApiResult getResCategoryList() {
+
+        List<ResCategory> resCategoryList = resCategoryRepository.getResCategoryList();
+
+        return ResApiResult.ok(resCategoryList);
+    }
+}

+ 2 - 0
src/main/java/cn/efunbox/audio/repository/res/ResAlbumRepository.java

@@ -5,4 +5,6 @@ import cn.efunbox.audio.repository.base.BasicRepository;
 
 public interface ResAlbumRepository extends BasicRepository<ResAlbum> {
 
+    //public List<ResAlbum>
+
 }

+ 6 - 0
src/main/java/cn/efunbox/audio/repository/res/ResCategoryRepository.java

@@ -2,7 +2,13 @@ package cn.efunbox.audio.repository.res;
 
 import cn.efunbox.audio.entity.res.ResCategory;
 import cn.efunbox.audio.repository.base.BasicRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
 
 public interface ResCategoryRepository extends BasicRepository<ResCategory> {
 
+    @Query(value = "select * from res_category where is_del = 0",nativeQuery = true)
+    public List<ResCategory> getResCategoryList();
 }

+ 8 - 0
src/main/java/cn/efunbox/audio/service/res/ResCategoryService.java

@@ -0,0 +1,8 @@
+package cn.efunbox.audio.service.res;
+
+import cn.efunbox.audio.utils.ResApiResult;
+
+public interface ResCategoryService {
+
+    public ResApiResult getResCategoryList();
+}