Browse Source

学生信息保存更新

guq 6 years ago
parent
commit
b820a9ab13

+ 4 - 5
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/service/impl/StudentServiceImpl.java

@@ -42,7 +42,6 @@ public class StudentServiceImpl implements StudentService{
     public PageInfo<SysStudent> getListData(PageRequest page, ListReqDTO listReqDTO) {
         PageHelper.startPage(page.getNumber(), page.getSize());
         Long schoolId = BaseContextHolder.getSchoolId();
-        schoolId = 1l;
         //condition语句
         String condition = listReqDTO.getFinalCondition();
         if(condition == null){
@@ -91,7 +90,7 @@ public class StudentServiceImpl implements StudentService{
                     item.setSchool_id(schoolid);
                     sysStudentMapper.insertparent(item);
                     pr_id = item.getParent_id();
-                    sysStudentMapper.insertrelation(id, pr_id);
+                    sysStudentMapper.insertrelation(id, pr_id, item.getPs_relation());
                 }
             }
             return new DocBaseDTO(id, null, "student");
@@ -115,17 +114,17 @@ public class StudentServiceImpl implements StudentService{
                 item.setSchool_id(schoolid);
                 sysStudentMapper.insertparent(item);
                 pr_id = item.getParent_id();
-                sysStudentMapper.insertrelation(id, pr_id);
+                sysStudentMapper.insertrelation(id, pr_id, item.getPs_relation());
             }
         }
         //更新从表
         if (updateDetails.size() > 0) {
             sysStudentMapper.updateParents(updateDetails);
             for (SysParents item : updateDetails) {
-                sysStudentMapper.updateRelation(item.getParent_id(), id, item.getPr_relation());
+                sysStudentMapper.updateRelation(item.getParent_stu_id(), item.getPs_relation());
             }
         }
-        return new DocBaseDTO(id, null, "student");
+        return new DocBaseDTO(id);
     }
 
     @Override

+ 2 - 2
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/SysStudentMapper.java

@@ -27,11 +27,11 @@ public interface SysStudentMapper {
 
     void insertparent(SysParents item);
 
-    void insertrelation(@Param("id") Long id, @Param("pr_id") Long pr_id);
+    void insertrelation(@Param("id") Long id, @Param("pr_id") Long pr_id, @Param("relation") String relation);
 
     void updateParents(List<SysParents> updateDetails);
 
-    void updateRelation(@Param("parent_id") Long parent_id, @Param("id") Long id, @Param("relation") String relation);
+    void updateRelation(@Param("id") Long id, @Param("relation") String relation);
 
     SysStudent selectByCode(@Param("code") String code, @Param("schoolId") Long schoolId);
 

+ 8 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/po/SysParents.java

@@ -44,6 +44,14 @@ public class SysParents {
 
     private String ps_relation;
 
+    public String getPs_relation() {
+        return ps_relation;
+    }
+
+    public void setPs_relation(String ps_relation) {
+        this.ps_relation = ps_relation;
+    }
+
     public Long getParent_stu_id() {
         return parent_stu_id;
     }

+ 10 - 3
applications/school/school-server/src/main/resources/mapper/SysStudentMapper.xml

@@ -297,6 +297,7 @@
     <result column="parents_remarks" property="parents_remarks" jdbcType="VARCHAR" />
     <result column="ps_relation" property="ps_relation" jdbcType="VARCHAR" />
     <result column="parent_stu_id" property="parent_stu_id" jdbcType="BIGINT" />
+    <result property="pa_phone" column="pa_phone" jdbcType="VARCHAR"/>
   </resultMap>
   <resultMap id="ResultMapWithBLOBs" type="com.usoftchina.smartschool.school.po.SysParents" extends="parentMap" >
     <result column="parents_photo" property="parents_photo" jdbcType="LONGVARCHAR" />
@@ -346,6 +347,9 @@
       <if test="parents_remarks != null" >
         parents_remarks,
       </if>
+      <if test="pa_phone != null" >
+        pa_phone,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides="," >
       <if test="user_id != null" >
@@ -381,24 +385,27 @@
       <if test="parents_remarks != null" >
         #{parents_remarks,jdbcType=VARCHAR},
       </if>
+      <if test="pa_phone != null" >
+        #{pa_phone,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
 
   <insert id="insertrelation">
-    insert into sys_parents_stu (stu_id,parent_id) VALUES (#{id},#{pr_id})
+    insert into sys_parents_stu (stu_id,parent_id,ps_relation) VALUES (#{id},#{pr_id},#{relation})
   </insert>
 
   <update id="updateParents" parameterType="com.usoftchina.smartschool.school.po.SysParents" >
     <foreach collection="list" item="item" index="index" open="" close="" separator=";">
       update sys_parents <set>
-      parents_name = #{item.parents_name,jdbcType=VARCHAR}
+      parents_name = #{item.parents_name,jdbcType=VARCHAR},pa_phone = #{item.pa_phone,jdbcType=VARCHAR}
     </set>
       where parent_id = #{item.parent_id,jdbcType=BIGINT}
     </foreach>
   </update>
 
   <update id="updateRelation">
-    update sys_parents_stu set ps_relation=#{relation} where parent_id=#{parent_id} and stu_id =#{id}
+    update sys_parents_stu set ps_relation=#{relation} where parent_stu_id =#{id}
   </update>
 
   <select id="selectByCode" resultMap="BaseResultMap">