小么熊🐻 3 лет назад
Родитель
Сommit
e2bc95bf67

+ 0 - 103
zzjs-admin/src/main/java/com/miaxis/app/controller/collection/AppletCollectionInfoController.java

@@ -1,103 +0,0 @@
-package com.miaxis.app.controller.collection;
-
-import com.miaxis.collection.service.ICollectionInfoService;
-import com.miaxis.common.constant.Constants;
-import com.miaxis.common.core.controller.BaseController;
-import com.miaxis.common.core.domain.Response;
-import com.miaxis.common.core.domain.entity.UserInfo;
-import com.miaxis.common.core.page.ResponsePageInfo;
-import com.miaxis.common.utils.SecurityUtils;
-import io.swagger.annotations.*;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Arrays;
-
-/**
- * 【小程序-收藏管理】Controller
- *
- * @author miaxis
- * @date 2021-03-10
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping(Constants.STUDENT_PREFIX+"/applet/collection")
-@Api(tags = {"【小程序-收藏管理】"})
-public class AppletCollectionInfoController extends BaseController {
-
-    private final ICollectionInfoService collectionInfoService;
-
-
-    /**
-     * 查询用户收藏列表
-     */
-    @GetMapping("/collectionList")
-    @ApiOperation("查询用户收藏列表")
-    @ApiImplicitParam(name = "collectionType", value = "收藏类别", dataType = "string", required = true)
-    public Response collectionList(String collectionType) {
-        //当前用户
-        UserInfo userInfo = SecurityUtils.getLoginUser().getStudent();
-        return collectionInfoService.collectionList(userInfo,collectionType);
-    }
-
-    /**
-     * 通用收藏接口
-     * @param id
-     * @param collectionType
-     * @return
-     */
-    @PutMapping(value = Constants.STUDENT_PREFIX+"/collectionBusiness")
-    @ApiOperation("通用收藏接口")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "id", value = "收藏id", dataType = "int", required = true),
-            @ApiImplicitParam(name = "collectionType", value = "收藏类别", dataType = "string", required = true),
-    })
-    public Response collectionOperation(Long id, String collectionType){
-        //当前用户
-        UserInfo userInfo = SecurityUtils.getLoginUser().getStudent();
-        return collectionInfoService.collectionOperation(userInfo,id,collectionType);
-    }
-
-    /**
-     * 通用取消收藏
-     */
-    @DeleteMapping(value = "/collectionCancel/{ids}")
-    @ApiOperation("通用取消收藏")
-    public Response collectionCancel(
-            @ApiParam(name = "ids", value = "ids", required = true)
-            @PathVariable("ids") Long[] ids
-    ){
-        return toResponse(collectionInfoService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
-    }
-
-
-    /**
-     * 收藏商家
-     */
-    @PutMapping(value = "/collectionBusiness/{id}")
-    @ApiOperation("收藏商家")
-    public Response collectionBusiness(
-            @ApiParam(name = "id",value = "商家id",required = true)
-            @PathVariable("id") Long id
-    ){
-        //当前用户
-        UserInfo userInfo = SecurityUtils.getLoginUser().getStudent();
-        return collectionInfoService.collectionBusiness(userInfo,id);
-    }
-
-    /**
-     * 取消收藏商家
-     */
-    @DeleteMapping(value = "/cancelCollection/{ids}")
-    @ApiOperation("取消收藏")
-    public Response cancelCollection(
-            @ApiParam(name = "ids", value = "商家id", required = true)
-            @PathVariable Long[] ids
-    ){
-        //当前用户
-        UserInfo userInfo = SecurityUtils.getLoginUser().getStudent();
-        return collectionInfoService.removeCollectionByIds(userInfo.getId(),ids);
-    }
-
-
-}

+ 58 - 0
zzjs-admin/src/main/java/com/miaxis/app/controller/question/QuestionInfoGetController.java

@@ -0,0 +1,58 @@
+package com.miaxis.app.controller.question;
+
+import com.miaxis.common.constant.Constants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.question.domain.QuestionInfoGet;
+import com.miaxis.question.service.IQuestionInfoGetService;
+import io.swagger.annotations.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 【202204题库获取】Controller
+ *
+ * @author miaxis
+ * @date 2022-03-30
+ */
+@RestController
+@RequestMapping(Constants.OPEN_PREFIX+"/question/get")
+@Api(tags={"【小程序-202204题库获取】"})
+public class QuestionInfoGetController extends BaseController{
+    @Autowired
+    private IQuestionInfoGetService questionInfoGetService;
+
+    /**
+     * 查询202204题库获取列表
+     */
+    @GetMapping("/list")
+    @ApiOperation("查询202204题库获取列表")
+        @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
+            @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
+    })
+    public ResponsePageInfo<QuestionInfoGet> list(@ModelAttribute QuestionInfoGet questionInfoGet){
+        startPage();
+        List<QuestionInfoGet> list = questionInfoGetService.selectQuestionInfoGetList(questionInfoGet);
+        return toResponsePageInfo(list);
+    }
+    
+
+    /**
+     * 获取202204题库获取详细信息
+     */
+    @GetMapping(value = "/{id}")
+    @ApiOperation("获取202204题库获取详细信息")
+    public Response<QuestionInfoGet> getInfo(
+            @ApiParam(name = "id", value = "202204题库获取参数", required = true)
+            @PathVariable("id") Long id
+    ){
+        return Response.success(questionInfoGetService.getById(id));
+    }
+
+
+
+}

+ 24 - 22
zzjs-admin/src/test/java/com/miaxis/test/YdtTest.java

@@ -4,8 +4,8 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.miaxis.ZzjsApplication;
 import com.miaxis.feign.service.IYdtService;
-import com.miaxis.question.domain.QuestionInfoTwo;
-import com.miaxis.question.service.IQuestionInfoTwoService;
+import com.miaxis.question.domain.QuestionInfoGet;
+import com.miaxis.question.service.IQuestionInfoGetService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,7 +21,7 @@ public class YdtTest {
     private IYdtService ydtService;
 
     @Autowired
-    private IQuestionInfoTwoService questionInfoTwoService;
+    private IQuestionInfoGetService questionInfoGetService;
 
     /**
      * 获取一点通题库
@@ -29,7 +29,7 @@ public class YdtTest {
     @Test
     public void getInfo(){
         Long kemu = 1l;
-        String cartype = "3";
+        String cartype = "3"; //0:小车(313) 1:货车(325) 2:客车(328) 3:摩托车(40)
 
         String result = ydtService.getInfo(kemu,cartype);
         JSONObject json = JSONObject.parseObject(result);
@@ -42,43 +42,45 @@ public class YdtTest {
             String name = json1.getString("name");
             String rightAnswer = json1.getString("rightAnswer");
             String image = json1.getString("image");
+            if("".equals(image)){
+                image = null;
+            }
             String explain = json1.getString("explain");
             String type = json1.getString("type");
 
 
             JSONArray option = json1.getJSONArray("option");
-            QuestionInfoTwo questionInfoTwo = new QuestionInfoTwo();
+            QuestionInfoGet questionInfoGet = new QuestionInfoGet();
             for (int j = 0; j <option.size() ; j++) {
                 JSONObject json2 = (JSONObject)option.get(j);
                 String oid = json2.getString("id");
                 String oname = json2.getString("name");
                 if("A".equals(oid)) {
-                    questionInfoTwo.setAn1(oname);
+                    questionInfoGet.setAn1(oname);
                 } else if ("B".equals(oid)) {
-                    questionInfoTwo.setAn2(oname);
+                    questionInfoGet.setAn2(oname);
                 } else if ("C".equals(oid)) {
-                    questionInfoTwo.setAn3(oname);
+                    questionInfoGet.setAn3(oname);
                 } else if ("D".equals(oid)) {
-                    questionInfoTwo.setAn4(oname);
+                    questionInfoGet.setAn4(oname);
                 } else if ("E".equals(oid)) {
-                    questionInfoTwo.setAn5(oname);
+                    questionInfoGet.setAn5(oname);
                 } else if ("F".equals(oid)) {
-                    questionInfoTwo.setAn6(oname);
+                    questionInfoGet.setAn6(oname);
                 } else if ("G".equals(oid)) {
-                    questionInfoTwo.setAn7(oname);
+                    questionInfoGet.setAn7(oname);
                 }
             }
 
-            questionInfoTwo.setNum(Long.parseLong(id));
-            questionInfoTwo.setName(name);
-            questionInfoTwo.setImage(image);
-            questionInfoTwo.setRightAnswer(Long.parseLong(rightAnswer));
-            questionInfoTwo.setExplainJs(explain);
-            questionInfoTwo.setKemu(kemu);
-            questionInfoTwo.setCartype(cartype);
-            questionInfoTwo.setType(Long.parseLong(type));
-            System.out.println(questionInfoTwo);
-            questionInfoTwoService.save(questionInfoTwo);
+            questionInfoGet.setNum(Long.parseLong(id));
+            questionInfoGet.setName(name);
+            questionInfoGet.setImage(image);
+            questionInfoGet.setRightAnswer(Long.parseLong(rightAnswer));
+            questionInfoGet.setExplainJs(explain);
+            questionInfoGet.setKemu(kemu);
+            questionInfoGet.setCartype(cartype);
+            questionInfoGet.setType(Long.parseLong(type));
+            questionInfoGetService.save(questionInfoGet);
 
         }
 

+ 21 - 0
zzjs-service/src/main/java/com/miaxis/question/service/IQuestionInfoGetService.java

@@ -0,0 +1,21 @@
+package com.miaxis.question.service;
+
+import java.util.List;
+import com.miaxis.question.domain.QuestionInfoGet;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 202204题库获取Service接口
+ *
+ * @author miaxis
+ * @date 2022-03-30
+ */
+public interface IQuestionInfoGetService extends IService<QuestionInfoGet>{
+    /**
+     * 查询202204题库获取列表
+     *
+     * @param questionInfoGet 202204题库获取
+     * @return 202204题库获取集合
+     */
+    public List<QuestionInfoGet> selectQuestionInfoGetList(QuestionInfoGet questionInfoGet);
+}

+ 36 - 0
zzjs-service/src/main/java/com/miaxis/question/service/impl/QuestionInfoGetServiceImpl.java

@@ -0,0 +1,36 @@
+package com.miaxis.question.service.impl;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.miaxis.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.apache.commons.lang3.StringUtils;
+import com.miaxis.question.mapper.QuestionInfoGetMapper;
+import com.miaxis.question.domain.QuestionInfoGet;
+import com.miaxis.question.service.IQuestionInfoGetService;
+
+/**
+ * 202204题库获取Service业务层处理
+ *
+ * @author miaxis
+ * @date 2022-03-30
+ */
+@Service
+public class QuestionInfoGetServiceImpl extends ServiceImpl<QuestionInfoGetMapper, QuestionInfoGet> implements IQuestionInfoGetService {
+    @Autowired
+    private QuestionInfoGetMapper questionInfoGetMapper;
+
+    /**
+     * 查询202204题库获取列表
+     *
+     * @param questionInfoGet 202204题库获取
+     * @return 202204题库获取
+     */
+    @Override
+    public List<QuestionInfoGet> selectQuestionInfoGetList(QuestionInfoGet questionInfoGet){
+        return questionInfoGetMapper.selectQuestionInfoGetList(questionInfoGet);
+    }
+}

+ 53 - 0
zzjs-service/src/main/resources/mapper/question/QuestionInfoGetMapper.xml

@@ -0,0 +1,53 @@
+<?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.miaxis.question.mapper.QuestionInfoGetMapper">
+
+    <resultMap type="QuestionInfoGet" id="QuestionInfoGetResult">
+        <result property="id"    column="id"    />
+        <result property="num"    column="num"    />
+        <result property="name"    column="name"    />
+        <result property="image"    column="image"    />
+        <result property="rightAnswer"    column="right_answer"    />
+        <result property="explainJs"    column="explain_js"    />
+        <result property="type"    column="type"    />
+        <result property="an1"    column="an1"    />
+        <result property="an2"    column="an2"    />
+        <result property="an3"    column="an3"    />
+        <result property="an4"    column="an4"    />
+        <result property="an5"    column="an5"    />
+        <result property="an6"    column="an6"    />
+        <result property="an7"    column="an7"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="kemu"    column="kemu"    />
+        <result property="cartype"    column="cartype"    />
+    </resultMap>
+
+    <sql id="selectQuestionInfoGetVo">
+        select * from question_info_get
+    </sql>
+
+    <select id="selectQuestionInfoGetList" parameterType="QuestionInfoGet" resultMap="QuestionInfoGetResult">
+        <include refid="selectQuestionInfoGetVo"/>
+        <where>
+            <if test="num != null "> and num = #{num}</if>
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+            <if test="image != null  and image != ''"> and image = #{image}</if>
+            <if test="rightAnswer != null "> and right_answer = #{rightAnswer}</if>
+            <if test="explainJs != null  and explainJs != ''"> and explain_js = #{explainJs}</if>
+            <if test="type != null "> and type = #{type}</if>
+            <if test="an1 != null  and an1 != ''"> and an1 = #{an1}</if>
+            <if test="an2 != null  and an2 != ''"> and an2 = #{an2}</if>
+            <if test="an3 != null  and an3 != ''"> and an3 = #{an3}</if>
+            <if test="an4 != null  and an4 != ''"> and an4 = #{an4}</if>
+            <if test="an5 != null  and an5 != ''"> and an5 = #{an5}</if>
+            <if test="an6 != null  and an6 != ''"> and an6 = #{an6}</if>
+            <if test="an7 != null  and an7 != ''"> and an7 = #{an7}</if>
+            <if test="kemu != null "> and kemu = #{kemu}</if>
+            <if test="cartype != null  and cartype != ''"> and cartype = #{cartype}</if>
+        </where>
+    </select>
+
+</mapper>