Pārlūkot izejas kodu

增加乐器与乐保查询接口

周箭河 4 gadi atpakaļ
vecāks
revīzija
50b7a698b4

+ 1 - 1
mec-auth/mec-auth-server/src/main/resources/bootstrap-test.properties

@@ -3,7 +3,7 @@
 #\u670d\u52a1\u5668\u5730\u5740
 spring.cloud.nacos.config.server-addr=47.114.1.200:8848
 #\u9ed8\u8ba4\u4e3aPublic\u547d\u540d\u7a7a\u95f4,\u53ef\u4ee5\u7701\u7565\u4e0d\u5199
-spring.cloud.nacos.config.namespace=02105743-16b8-46ab-87df-2aca0f3dbca3
+spring.cloud.nacos.config.namespace=f9d46b0a-9847-48ae-8e4b-216c7a3eb466
 #\u6307\u5b9a\u914d\u7f6e\u7fa4\u7ec4 --\u5982\u679c\u662fPublic\u547d\u540d\u7a7a\u95f4 \u5219\u53ef\u4ee5\u7701\u7565\u7fa4\u7ec4\u914d\u7f6e
 spring.cloud.nacos.config.group=DEFAULT_GROUP
 #\u6587\u4ef6\u540d -- \u5982\u679c\u6ca1\u6709\u914d\u7f6e\u5219\u9ed8\u8ba4\u4e3a ${spring.appliction.name}

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentInstrument.java

@@ -10,6 +10,12 @@ public class StudentInstrument {
     private Long id;
 
     /**
+     * 学生id
+     */
+    @ApiModelProperty(value="学生id")
+    private Integer studentId;
+
+    /**
     * 商品id
     */
     @ApiModelProperty(value="商品id")
@@ -117,4 +123,12 @@ public class StudentInstrument {
         sb.append("]");
         return sb.toString();
     }
+
+    public Integer getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
+    }
 }

+ 24 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentInstrumentQueryInfo.java

@@ -0,0 +1,24 @@
+package com.ym.mec.biz.dal.page;
+
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class StudentInstrumentQueryInfo extends QueryInfo {
+
+    /**
+     * 学生id
+     */
+    @ApiModelProperty(value = "学生id", required = true)
+    private Integer studentId;
+
+    public Integer getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
+    }
+}

+ 7 - 5
mec-biz/src/main/resources/config/mybatis/StudentInstrumentMapper.xml

@@ -5,6 +5,7 @@
     <!--@mbg.generated-->
     <!--@Table student_instrument-->
     <id column="id_" property="id" />
+    <result column="student_id_" property="studentId" />
     <result column="goods_id_" property="goodsId" />
     <result column="status_" property="status" />
     <result column="start_time_" property="startTime" />
@@ -14,7 +15,7 @@
   </resultMap>
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
-    id_, goods_id_, status_, start_time_, end_time_, create_time_, update_time
+    id_, goods_id_,student_id_, status_, start_time_, end_time_, create_time_, update_time
   </sql>
   <select id="get" parameterType="java.lang.Integer" resultMap="StudentInstrument">
     <!--@mbg.generated-->
@@ -31,9 +32,9 @@
   
   <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.StudentInstrument" useGeneratedKeys="true">
     <!--@mbg.generated-->
-    insert into student_instrument (goods_id_, status_, start_time_, end_time_, create_time_, update_time
+    insert into student_instrument (student_id,goods_id_, status_, start_time_, end_time_, create_time_, update_time
       )
-    values (#{goodsId}, #{status}, #{startTime}, #{endTime}, #{createTime}, #{updateTime}
+    values (#{studentId},#{goodsId}, #{status}, #{startTime}, #{endTime}, #{createTime}, #{updateTime}
       )
   </insert>
   <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentInstrument">
@@ -70,14 +71,15 @@
 
   <!-- 分页查询 -->
   <select id="queryPage" resultMap="StudentInstrument" parameterType="map">
-    SELECT * FROM student
+    SELECT * FROM student_instrument si
+    LEFT JOIN goods g ON g.id_ = si.goods_id_
     <include refid="global.limit"/>
   </select>
 
   <!-- 查询当前表的总记录数 -->
   <select id="queryCount" resultType="int">
     SELECT COUNT(*)
-    FROM student
+    FROM student_instrument
   </select>
 
 </mapper>

+ 17 - 6
mec-student/src/main/java/com/ym/mec/student/controller/StudentInstrumentController.java

@@ -1,8 +1,12 @@
 package com.ym.mec.student.controller;
 
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.RegisterPayDto;
 import com.ym.mec.biz.dal.entity.StudentInstrument;
+import com.ym.mec.biz.dal.page.DegreeQueryInfo;
+import com.ym.mec.biz.dal.page.StudentInstrumentQueryInfo;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.biz.service.StudentInstrumentService;
@@ -13,10 +17,8 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.*;
 
 @RequestMapping("studentInstrument")
 @Api(tags = "乐器与月保服务")
@@ -24,11 +26,20 @@ import org.springframework.web.bind.annotation.RestController;
 public class StudentInstrumentController extends BaseController {
     @Autowired
     private StudentInstrumentService studentInstrumentService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
 
 
     @ApiOperation(value = "获取乐器与月保列表")
-    @PostMapping("/getList")
-    public HttpResponseResult<PageInfo<StudentInstrument>> getList(QueryInfo queryInfo) {
+    @GetMapping("/getList")
+    public HttpResponseResult<PageInfo<StudentInstrument>> getList(StudentInstrumentQueryInfo queryInfo) {
+//        SysUser user = sysUserFeignService.queryUserInfo();
+//        if(user == null || user.getId()==null){
+//            return failed(HttpStatus.FORBIDDEN,"请登录");
+//        }
+//        queryInfo.setStudentId(user.getId());
+        queryInfo.setStudentId(2111835);
+
         return succeed(studentInstrumentService.queryPage(queryInfo));
     }
 

+ 1 - 1
mec-student/src/main/resources/bootstrap-test.properties

@@ -3,7 +3,7 @@
 #\u670d\u52a1\u5668\u5730\u5740
 spring.cloud.nacos.config.server-addr=47.114.1.200:8848
 #\u9ed8\u8ba4\u4e3aPublic\u547d\u540d\u7a7a\u95f4,\u53ef\u4ee5\u7701\u7565\u4e0d\u5199
-spring.cloud.nacos.config.namespace=f753d9d9-4bb2-4df6-a483-da9e169617c4
+spring.cloud.nacos.config.namespace=f9d46b0a-9847-48ae-8e4b-216c7a3eb466
 #\u6307\u5b9a\u914d\u7f6e\u7fa4\u7ec4 --\u5982\u679c\u662fPublic\u547d\u540d\u7a7a\u95f4 \u5219\u53ef\u4ee5\u7701\u7565\u7fa4\u7ec4\u914d\u7f6e
 spring.cloud.nacos.config.group=DEFAULT_GROUP
 #\u6587\u4ef6\u540d -- \u5982\u679c\u6ca1\u6709\u914d\u7f6e\u5219\u9ed8\u8ba4\u4e3a ${spring.appliction.name}