LIVE_YE 1 рік тому
батько
коміт
60e4c9155e

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/StudentInfoMapper.java

@@ -58,4 +58,6 @@ public interface StudentInfoMapper
      * @return 结果
      */
     public int deleteStudentInfoByIds(Long[] ids);
+
+    StudentInfo selectStudentInfoByStudentId(Long studentId);
 }

+ 29 - 7
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StudentInfoOldServiceImpl.java

@@ -111,14 +111,36 @@ public class StudentInfoOldServiceImpl implements IStudentInfoOldService
         List<Object> x = new ArrayList<>();
         List<Object> y1 = new ArrayList<>();
         List<Object> y2 = new ArrayList<>();
-        for (StudentInfoOld infoOld : StudentInfoOldList) {
-            x.add(DateUtils.dateTime(infoOld.getUpdateTime()));
-            y1.add(infoOld.getHeight());
-            y2.add(infoOld.getWeight());
+        String sg = "0";
+        String tz = "0";
+
+        for (int i = 0; i < StudentInfoOldList.size(); i++) {
+            StudentInfoOld infoOld = StudentInfoOldList.get(i);
+            if(i==0){
+                sg = infoOld.getHeight();
+                tz = infoOld.getWeight();
+                x.add(DateUtils.dateTime(infoOld.getUpdateTime()));
+                y1.add(infoOld.getHeight());
+                y2.add(infoOld.getWeight());
+
+                map.put("X",x);
+                map.put("Y1",y1);
+                map.put("Y2",y2);
+            }else{
+                if(!sg.equals(infoOld.getHeight()) || !tz.equals(infoOld.getWeight())){
+                    sg = infoOld.getHeight();
+                    tz = infoOld.getWeight();
+                    x.add(DateUtils.dateTime(infoOld.getUpdateTime()));
+                    y1.add(infoOld.getHeight());
+                    y2.add(infoOld.getWeight());
+
+                    map.put("X",x);
+                    map.put("Y1",y1);
+                    map.put("Y2",y2);
+                }
+            }
         }
-        map.put("X",x);
-        map.put("Y1",y1);
-        map.put("Y2",y2);
+
         return AjaxResult.success("成功",map);
     }
 }

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StudentInfoServiceImpl.java

@@ -85,7 +85,7 @@ public class StudentInfoServiceImpl implements IStudentInfoService
     public int updateStudentInfo(StudentInfo studentInfo)
     {
         //查询修改前数据
-        StudentInfo student = studentInfoMapper.selectStudentInfoById(studentInfo.getId());
+        StudentInfo student = studentInfoMapper.selectStudentInfoByStudentId(studentInfo.getStudentId());
         StudentInfoOld studentInfoOld = new StudentInfoOld();
         ClassUtils.copyProperties(student, studentInfoOld);
         studentInfoOld.setCreateTime(DateUtils.getNowDate());

+ 5 - 0
ruoyi-system/src/main/resources/mapper/system/StudentInfoMapper.xml

@@ -79,12 +79,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="address != null  and address != ''"> and s.address = #{address}</if>
             <if test="classId != null "> and f.class_id = #{classId}</if>
         </where>
+        order by create_time desc;
     </select>
     
     <select id="selectStudentInfoById" parameterType="Long" resultMap="StudentInfoResult">
         <include refid="selectStudentInfoVo"/>
         where id = #{id}
     </select>
+    <select id="selectStudentInfoByStudentId" resultMap="StudentInfoResult">
+        <include refid="selectStudentInfoVo"/>
+        where student_id = #{studentId}
+    </select>
 
 
     <insert id="insertStudentInfo" parameterType="StudentInfo" useGeneratedKeys="true" keyProperty="id">