Quellcode durchsuchen

提交教练修改密码

小么熊🐻 vor 1 Jahr
Ursprung
Commit
f67bcedf53

+ 12 - 0
jsjp-admin/src/main/java/com/miaxis/app/controller/tms/CoachInfoController.java

@@ -7,11 +7,13 @@ import com.miaxis.common.core.domain.Response;
 import com.miaxis.tms.domain.CoachInfo;
 import com.miaxis.tms.dto.CoachInfoDTO;
 import com.miaxis.tms.dto.CoachInfoIdDTO;
+import com.miaxis.tms.dto.CoachInfoPwDTO;
 import com.miaxis.tms.service.ICoachInfoService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -56,5 +58,15 @@ public class CoachInfoController extends BaseController {
         return Response.success(coachInfoService.getCoachBylogin(coaDto));
     }
 
+
+    /**
+     * 教练修改密码
+     */
+    @PutMapping("/updateCoachInfo")
+    @ApiOperation("教练修改密码")
+    public Response<CoachInfo> updateCoachInfo(CoachInfoPwDTO coaPwDto) {
+        return coachInfoService.updateCoachPassWord(coaPwDto);
+    }
+
 }
 

+ 27 - 0
jsjp-service/src/main/java/com/miaxis/tms/dto/CoachInfoPwDTO.java

@@ -0,0 +1,27 @@
+package com.miaxis.tms.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+@Data
+public class CoachInfoPwDTO implements Serializable {
+
+
+    @ApiModelProperty(value = "登录账号")
+    private String idcard;
+
+    @ApiModelProperty(value = "登录密码")
+    private String password;
+
+    @ApiModelProperty(value = "登录密码")
+    private String newPassword;
+
+    @ApiModelProperty(value = "地区编号")
+    private String city;
+
+
+
+}

+ 4 - 0
jsjp-service/src/main/java/com/miaxis/tms/mapper/CoachInfoMapper.java

@@ -1,9 +1,11 @@
 package com.miaxis.tms.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.miaxis.common.core.domain.Response;
 import com.miaxis.tms.domain.CoachInfo;
 import com.miaxis.tms.dto.CoachInfoDTO;
 import com.miaxis.tms.dto.CoachInfoIdDTO;
+import com.miaxis.tms.dto.CoachInfoPwDTO;
 
 /**
  * <p>
@@ -19,4 +21,6 @@ public interface CoachInfoMapper extends BaseMapper<CoachInfo> {
     CoachInfo getCoachInfoById(CoachInfoIdDTO coaDto);
 
     CoachInfo getCoachBylogin(CoachInfoDTO coaDto);
+
+    int updateCoachPassWord(CoachInfoPwDTO coaPwDto);
 }

+ 3 - 0
jsjp-service/src/main/java/com/miaxis/tms/service/ICoachInfoService.java

@@ -1,9 +1,11 @@
 package com.miaxis.tms.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.miaxis.common.core.domain.Response;
 import com.miaxis.tms.domain.CoachInfo;
 import com.miaxis.tms.dto.CoachInfoDTO;
 import com.miaxis.tms.dto.CoachInfoIdDTO;
+import com.miaxis.tms.dto.CoachInfoPwDTO;
 
 /**
  * <p>
@@ -23,4 +25,5 @@ public interface ICoachInfoService extends IService<CoachInfo> {
     CoachInfo getCoachBylogin(CoachInfoDTO coaDto);
 
 
+    Response updateCoachPassWord(CoachInfoPwDTO coaPwDto);
 }

+ 18 - 0
jsjp-service/src/main/java/com/miaxis/tms/service/impl/CoachInfoServiceImpl.java

@@ -2,12 +2,15 @@ package com.miaxis.tms.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.miaxis.common.annotation.DataSource;
+import com.miaxis.common.core.domain.Response;
 import com.miaxis.common.enums.DataSourceTypeEnum;
 import com.miaxis.tms.domain.CoachInfo;
 import com.miaxis.tms.dto.CoachInfoDTO;
 import com.miaxis.tms.dto.CoachInfoIdDTO;
+import com.miaxis.tms.dto.CoachInfoPwDTO;
 import com.miaxis.tms.mapper.CoachInfoMapper;
 import com.miaxis.tms.service.ICoachInfoService;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -38,5 +41,20 @@ public class CoachInfoServiceImpl extends ServiceImpl<CoachInfoMapper, CoachInfo
         return mapper.getCoachBylogin(coaDto);
     }
 
+    @Override
+    public Response updateCoachPassWord(CoachInfoPwDTO coaPwDto) {
+
+        CoachInfoDTO coaDto = new CoachInfoDTO();
+        BeanUtils.copyProperties(coaPwDto,coaDto);
+        CoachInfo coachInfo = this.getCoachBylogin(coaDto);
+        if(coachInfo==null) {
+            Response response = new Response(502,"用户不存在或用户密码错误");
+            return response;
+        } else {
+            int result = mapper.updateCoachPassWord(coaPwDto);
+            return Response.success(result);
+        }
+    }
+
 
 }

+ 7 - 0
jsjp-service/src/main/resources/mapper/tms/CoachInfoMapper.xml

@@ -63,4 +63,11 @@
                                              (select max(tci_id) from tms_coach_info@TMS${city} g where g.tci_idcard=#{idcard} and g.tci_password=#{password})
     </select>
 
+
+    <update id="updateCoachPassWord" parameterType="com.miaxis.tms.dto.CoachInfoPwDTO" >
+        update tms_coach_info@TMS${city} set tci_password = #{newPassword,jdbcType=VARCHAR}  where tci_id =
+                                                                (select max(tci_id) from tms_coach_info@TMS${city} g where g.tci_idcard=#{idcard,jdbcType=VARCHAR} and g.tci_password=#{password,jdbcType=VARCHAR})
+    </update>
+
+
 </mapper>