Forráskód Böngészése

课程管理的木易视频类型添加模糊查询

xgb 1 hete
szülő
commit
1c9fb13164

+ 3 - 3
fs-admin/src/main/java/com/fs/course/controller/FsUserCourseCategoryController.java

@@ -155,17 +155,17 @@ public class FsUserCourseCategoryController extends BaseController
 
     //获取1级总分类
     @GetMapping("/getCatePidList")
-    public R getCatePidList()
+    public R getCatePidList(String keyword)
     {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         Long userId = loginUser.getUser().getUserId();
         String json = configService.selectConfigByKey("course.config");
         CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
         if (ObjectUtil.isNotEmpty(config.getIsBound())&&config.getIsBound()){
-            List<OptionsVO> list = fsUserCourseCategoryService.selectFsUserCourseCategoryPidList(userId);
+            List<OptionsVO> list = fsUserCourseCategoryService.selectFsUserCourseCategoryPidList(userId, keyword);
             return R.ok().put("data", list);
         }
-        List<OptionsVO> list = fsUserCourseCategoryService.selectFsUserCourseCategoryPidList();
+        List<OptionsVO> list = fsUserCourseCategoryService.selectFsUserCourseCategoryPidList(keyword);
         return R.ok().put("data", list);
     }
 

+ 1 - 1
fs-company/src/main/java/com/fs/company/controller/course/FsUserCourseCategoryController.java

@@ -109,7 +109,7 @@ public class FsUserCourseCategoryController extends BaseController
     @GetMapping("/getCatePidList")
     public R getCatePidList()
     {
-        List<OptionsVO> list = fsUserCourseCategoryService.selectFsUserCourseCategoryPidList();
+        List<OptionsVO> list = fsUserCourseCategoryService.selectFsUserCourseCategoryPidList(null);
         return R.ok().put("data", list);
     }
 

+ 4 - 1
fs-framework/src/main/java/com/fs/framework/config/FastJson2JsonRedisSerializer.java

@@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.type.TypeFactory;
 import org.springframework.data.redis.serializer.RedisSerializer;
 import org.springframework.data.redis.serializer.SerializationException;
+import com.alibaba.fastjson.parser.Feature;
 import com.alibaba.fastjson.parser.ParserConfig;
 import org.springframework.util.Assert;
 import java.nio.charset.Charset;
@@ -28,6 +29,8 @@ public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
     static
     {
         ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
+        // FastJSON 1.2.68+ 必须显式添加白名单
+        ParserConfig.getGlobalInstance().addAccept("com.fs.");
     }
 
     public FastJson2JsonRedisSerializer(Class<T> clazz)
@@ -55,7 +58,7 @@ public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
         }
         String str = new String(bytes, DEFAULT_CHARSET);
 
-        return JSON.parseObject(str, clazz);
+        return (T) JSON.parseObject(str, Object.class, Feature.SupportAutoType);
     }
 
     public void setObjectMapper(ObjectMapper objectMapper)

+ 6 - 0
fs-framework/src/main/java/com/fs/framework/web/service/TokenService.java

@@ -4,6 +4,9 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import javax.servlet.http.HttpServletRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
@@ -28,6 +31,7 @@ import io.jsonwebtoken.SignatureAlgorithm;
 @Component
 public class TokenService
 {
+    private static final Logger log = LoggerFactory.getLogger(TokenService.class);
     // 令牌自定义标识
     @Value("${token.header}")
     private String header;
@@ -71,6 +75,8 @@ public class TokenService
             }
             catch (Exception e)
             {
+//                System.out.println(com.alibaba.fastjson.JSON.class.getProtectionDomain().getCodeSource().getLocation());
+//                log.error("异常",e);
             }
         }
         return null;

+ 2 - 4
fs-service/src/main/java/com/fs/course/mapper/FsUserCourseCategoryMapper.java

@@ -71,8 +71,7 @@ public interface FsUserCourseCategoryMapper
 //    @Select("select cate_id dict_value, cate_name dict_label  from fs_user_course_category WHERE pid = 0 and is_del=0 ")
     List<OptionsVO> selectFsUserCourseCategoryPidList(@Param("isShow") Integer isShow);
 
-    @Select("select cate_id dict_value, cate_name dict_label  from fs_user_course_category WHERE pid = 0 and is_del=0 and user_id = #{userId}")
-    List<OptionsVO> selectFsUserCourseCategoryPidListByUserId(Long userId);
+    List<OptionsVO> selectFsUserCourseCategoryPidListByUserId(@Param("userId") Long userId, @Param("keyword") String keyword);
 
     @Select("select cate_id dict_value, cate_name dict_label  from fs_user_course_category WHERE pid =#{pid} and is_del=0 ")
     List<OptionsVO> selectCateListByPid(Long pid);
@@ -99,8 +98,7 @@ public interface FsUserCourseCategoryMapper
     @MapKey("cateId")
     Map<Long, FsUserCourseCategory> queryAllIdKeyCategoryData();
 
-    @Select("select cate_id dict_value, cate_name dict_label  from fs_user_course_category WHERE pid = 0 and is_del=0 ")
-    List<OptionsVO> selectAllFsUserCourseCategoryPidList();
+    List<OptionsVO> selectAllFsUserCourseCategoryPidList(@Param("keyword") String keyword);
 
     /**
      * 根据名称和上级ID查询分类

+ 2 - 2
fs-service/src/main/java/com/fs/course/service/IFsUserCourseCategoryService.java

@@ -67,8 +67,8 @@ public interface IFsUserCourseCategoryService
     List<OptionsVO> selectFsUserCoursePidList();
 
     List<OptionsVO> selectFsUserCourseCategoryPidList(Integer isShow);
-    List<OptionsVO> selectFsUserCourseCategoryPidList();
-    List<OptionsVO> selectFsUserCourseCategoryPidList(Long userId);
+    List<OptionsVO> selectFsUserCourseCategoryPidList(String keyword);
+    List<OptionsVO> selectFsUserCourseCategoryPidList(Long userId, String keyword);
 
     List<OptionsVO> selectCateListByPid(Long pid);
 

+ 4 - 4
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseCategoryServiceImpl.java

@@ -113,13 +113,13 @@ public class FsUserCourseCategoryServiceImpl implements IFsUserCourseCategorySer
     }
 
     @Override
-    public List<OptionsVO> selectFsUserCourseCategoryPidList() {
-        return fsUserCourseCategoryMapper.selectAllFsUserCourseCategoryPidList();
+    public List<OptionsVO> selectFsUserCourseCategoryPidList(String keyword) {
+        return fsUserCourseCategoryMapper.selectAllFsUserCourseCategoryPidList(keyword);
     }
 
     @Override
-    public List<OptionsVO> selectFsUserCourseCategoryPidList(Long userId) {
-        return fsUserCourseCategoryMapper.selectFsUserCourseCategoryPidListByUserId(userId);
+    public List<OptionsVO> selectFsUserCourseCategoryPidList(Long userId, String keyword) {
+        return fsUserCourseCategoryMapper.selectFsUserCourseCategoryPidListByUserId(userId, keyword);
     }
     @Override
     public List<OptionsVO> selectCateListByPid(Long pid) {

+ 18 - 0
fs-service/src/main/resources/mapper/course/FsUserCourseCategoryMapper.xml

@@ -45,6 +45,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by sort asc
     </select>
 
+    <select id="selectAllFsUserCourseCategoryPidList" resultType="com.fs.his.vo.OptionsVO">
+        select cate_id dict_value, cate_name dict_label
+        from fs_user_course_category
+        WHERE pid = 0 and is_del = 0
+        <if test="keyword != null and keyword != ''">
+            and cate_name LIKE CONCAT('%', #{keyword}, '%')
+        </if>
+    </select>
+
+    <select id="selectFsUserCourseCategoryPidListByUserId" resultType="com.fs.his.vo.OptionsVO">
+        select cate_id dict_value, cate_name dict_label
+        from fs_user_course_category
+        WHERE pid = 0 and is_del = 0 and user_id = #{userId}
+        <if test="keyword != null and keyword != ''">
+            and cate_name LIKE CONCAT('%', #{keyword}, '%')
+        </if>
+    </select>
+
     <insert id="insertFsUserCourseCategory" parameterType="FsUserCourseCategory" useGeneratedKeys="true" keyProperty="cateId">
         insert into fs_user_course_category
         <trim prefix="(" suffix=")" suffixOverrides=",">