浏览代码

修改了志愿者信息模块

LiRong 1 月之前
父节点
当前提交
0bc6f0217e

+ 1 - 1
leromro_service/src/main/java/com/leromro/serve/controller/VolunteerInfoController.java

@@ -25,7 +25,7 @@ public class VolunteerInfoController {
     /**
      * 新增志愿者信息
      * **/
-    @PutMapping("/insertNewVolunteerInfo/{serviceCategory}")
+    @PostMapping("/insertNewVolunteerInfo/{serviceCategory}")
     public R newVolunteerInfoByuserId(@RequestBody VolunteerInfoVO volunteerInfoVO, @PathVariable Long serviceCategory){
         Long userId = SecurityUtils.getUserId();
         volunteerInfoService.newVolunteerInfoByuserId(volunteerInfoVO,userId,serviceCategory);

+ 1 - 1
leromro_service/src/main/java/com/leromro/serve/mapper/VolunteerInfoMapper.java

@@ -15,5 +15,5 @@ import org.apache.ibatis.annotations.Param;
  */
 public interface VolunteerInfoMapper extends BaseMapper<VolunteerInfo> {
 
-    void newVolunteerByUserId(@Param("info") VolunteerInfoVO volunteerInfoVO, Long userId);
+    void newVolunteerByUserId( VolunteerInfoVO volunteerInfoVO);
 }

+ 2 - 2
leromro_service/src/main/java/com/leromro/serve/service/impl/VolunteerInfoServiceImpl.java

@@ -33,12 +33,12 @@ public class VolunteerInfoServiceImpl extends ServiceImpl<VolunteerInfoMapper, V
      */
     @Override
     public void newVolunteerInfoByuserId(VolunteerInfoVO volunteerInfoVO, Long userId, Long serviceCategory) {
+        volunteerInfoVO.setUserId(userId);
         LambdaQueryWrapper<VolunteerInfo> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(VolunteerInfo::getVolunteerId, userId).eq(VolunteerInfo::getServiceCategory, serviceCategory);
         Integer i = volunteerInfoMapper.selectCount(wrapper);
-
         if(i>0){
             throw new RuntimeException("此用户已有志愿者信息,不可重复创建,请前往修改");
-        }else {volunteerInfoMapper.newVolunteerByUserId(volunteerInfoVO,userId);}
+        }else {volunteerInfoMapper.newVolunteerByUserId(volunteerInfoVO);}
     }
 }

+ 40 - 43
leromro_service/src/main/resources/mapper/serve/VolunteerInfoMapper.xml

@@ -5,52 +5,49 @@
 <mapper namespace="com.leromro.serve.mapper.VolunteerInfoMapper">
     <insert id="newVolunteerByUserId">
         INSERT INTO l_volunteer_info (
-        <if test="info.userId != null">user_id,</if>
-        <if test="info.name != null">name,</if>
-        <if test="info.idCard != null">id_card,</if>
-        <if test="info.picture != null">picture,</if>
-        <if test="info.serviceCategory != null">service_category,</if>
-        <if test="info.serviceType != null">service_type,</if>
-        <if test="info.serviceSubject != null">service_subject,</if>
-        <if test="info.skillDescribe != null">skill_describe,</if>
-        <if test="info.phonenumber != null">phonenumber,</if>
-        <if test="info.sex != null">sex,</if>
-        <if test="volunteerInfoVO.status != null">status,</if>
-        <if test="volunteerInfoVO.certificate != null">certificate,</if>
-        <if test="volunteerInfoVO.workedCompany != null">worked_company,</if>
-        <if test="volunteerInfoVO.level != null">level,</if>
-        <if test="volunteerInfoVO.isOnJob != null">is_on_job,</if>
-        <if test="volunteerInfoVO.city != null">city,</if>
-        <if test="volunteerInfoVO.address != null">address,</if>
-        <if test="volunteerInfoVO.createTime != null">create_time,</if>
-        <if test="volunteerInfoVO.updateTime != null">update_time,</if>
-        <if test="volunteerInfoVO.remark != null">remark</if>
+        <if test="userId != null">user_id,</if>
+        <if test="name != null">name,</if>
+        <if test="idCard != null">id_card,</if>
+        <if test="picture != null">picture,</if>
+        <if test="serviceCategory != null">service_category,</if>
+        <if test="serviceType != null">service_type,</if>
+        <if test="serviceSubject != null">service_subject,</if>
+        <if test="skillDescribe != null">skill_describe,</if>
+        <if test="phonenumber != null">phonenumber,</if>
+        <if test="sex != null">sex,</if>
+        <if test="status != null">status,</if>
+        <if test="certificate != null">certificate,</if>
+        <if test="workedCompany != null">worked_company,</if>
+        <if test="level != null">level,</if>
+        <if test="isOnJob != null">is_on_job,</if>
+        <if test="city != null">city,</if>
+        <if test="address != null">address,</if>
+        <if test="createTime != null">create_time,</if>
+        <if test="updateTime != null">update_time,</if>
+        <if test="remark != null">remark</if>
         )
         VALUES (
-        <if test="volunteerInfoVO.userId != null">#{volunteerInfoVO.userId},</if>
-        <if test="volunteerInfoVO.name != null">#{volunteerInfoVO.name},</if>
-        <if test="volunteerInfoVO.idCard != null">#{volunteerInfoVO.idCard},</if>
-        <if test="volunteerInfoVO.picture != null">#{volunteerInfoVO.picture},</if>
-        <if test="volunteerInfoVO.serviceCategory != null">#{volunteerInfoVO.serviceCategory},</if>
-        <if test="volunteerInfoVO.serviceType != null">#{volunteerInfoVO.serviceType},</if>
-        <if test="volunteerInfoVO.serviceSubject != null">#{volunteerInfoVO.serviceSubject},</if>
-        <if test="volunteerInfoVO.skillDescribe != null">#{volunteerInfoVO.skillDescribe},</if>
-        <if test="volunteerInfoVO.phonenumber != null">#{volunteerInfoVO.phonenumber},</if>
-        <if test="volunteerInfoVO.sex != null">#{volunteerInfoVO.sex},</if>
-        <if test="volunteerInfoVO.status != null">#{volunteerInfoVO.status},</if>
-        <if test="volunteerInfoVO.certificate != null">#{volunteerInfoVO.certificate},</if>
-        <if test="volunteerInfoVO.workedCompany != null">#{volunteerInfoVO.workedCompany},</if>
-        <if test="volunteerInfoVO.level != null">#{volunteerInfoVO.level},</if>
-        <if test="volunteerInfoVO.isOnJob != null">#{volunteerInfoVO.isOnJob},</if>
-        <if test="volunteerInfoVO.city != null">#{volunteerInfoVO.city},</if>
-        <if test="volunteerInfoVO.address != null">#{volunteerInfoVO.address},</if>
-        <if test="volunteerInfoVO.createTime != null">#{volunteerInfoVO.createTime},</if>
-        <if test="volunteerInfoVO.updateTime != null">#{volunteerInfoVO.updateTime},</if>
-        <if test="volunteerInfoVO.remark != null">#{volunteerInfoVO.remark}</if>
+        <if test="userId != null">#{userId},</if>
+        <if test="name != null">#{name},</if>
+        <if test="idCard != null">#{idCard},</if>
+        <if test="picture != null">#{picture},</if>
+        <if test="serviceCategory != null">#{serviceCategory},</if>
+        <if test="serviceType != null">#{serviceType},</if>
+        <if test="serviceSubject != null">#{serviceSubject},</if>
+        <if test="skillDescribe != null">#{skillDescribe},</if>
+        <if test="phonenumber != null">#{phonenumber},</if>
+        <if test="sex != null">#{sex},</if>
+        <if test="status != null">#{status},</if>
+        <if test="certificate != null">#{certificate},</if>
+        <if test="workedCompany != null">#{workedCompany},</if>
+        <if test="level != null">#{level},</if>
+        <if test="isOnJob != null">#{isOnJob},</if>
+        <if test="city != null">#{city},</if>
+        <if test="address != null">#{address},</if>
+        <if test="createTime != null">#{createTime},</if>
+        <if test="updateTime != null">#{updateTime},</if>
+        <if test="remark != null">#{remark}</if>
         )
-
-
-
     </insert>