wwl 4 年之前
父節點
當前提交
b2f0191996

+ 9 - 9
hzgzpt-admin/src/main/java/com/miaxis/pc/controller/coach/PcCoachInfoController.java

@@ -83,17 +83,17 @@ public class PcCoachInfoController extends BaseController{
     }
 
     /**
-     * 删除教练
+     * 删除教练(逻辑删除)
      */
     @PreAuthorize("@ss.hasPermi('coach:info:remove')")
     @Log(title = "教练", businessType = BusinessTypeEnum.DELETE)
-	@DeleteMapping("/{coachnums}")
+	@DeleteMapping("/{ids}")
     @ApiOperation("删除教练")
-    public  Response<Integer> remove(
+    public  Response<Integer> removeCoach(
             @ApiParam(name = "coachnums", value = "教练ids参数", required = true)
-            @PathVariable String[] coachnums
+            @PathVariable Long[] ids
     ){
-        return toResponse(coachInfoService.removeByIds(Arrays.asList(coachnums)) ? 1 : 0);
+        return toResponse(coachInfoService.removeCoach(ids) ? 1 : 0);
     }
 
 
@@ -102,13 +102,13 @@ public class PcCoachInfoController extends BaseController{
      */
     @PreAuthorize("@ss.hasPermi('coach:info:resetPassword')")
     @Log(title = "教练", businessType = BusinessTypeEnum.UPDATE)
-    @PostMapping("/resetPassword/{coachnums}")
+    @PostMapping("/resetPassword/{ids}")
     @ApiOperation("pc教练密码重置")
     public  Response<Integer> resetPassword(
-            @ApiParam(name = "coachnums", value = "教练员全国统一编号集合", required = true)
-            @PathVariable String[] coachnums
+            @ApiParam(name = "ids", value = "教练ids", required = true)
+            @PathVariable Long[] ids
     ){
-        return toResponse(coachInfoService.resetPassword(coachnums) ? 1 : 0);
+        return toResponse(coachInfoService.resetPassword(ids) ? 1 : 0);
     }
 
 

+ 8 - 2
hzgzpt-service/src/main/java/com/miaxis/coach/mapper/CoachInfoMapper.java

@@ -72,8 +72,14 @@ public interface CoachInfoMapper extends BaseMapper<CoachInfo> {
 
     /**
      * pc教练密码重置
-     * @param coachnums
+     * @param ids
      * @param password
      */
-    void resetPassword(@Param("coachnums")String[] coachnums, @Param("password")String password);
+    void resetPassword(@Param("ids")Long[] ids, @Param("password")String password);
+
+    /**
+     * 删除教练(逻辑删除)
+     * @param ids
+     */
+    void removeCoach(Long[] ids);
 }

+ 9 - 2
hzgzpt-service/src/main/java/com/miaxis/coach/service/ICoachInfoService.java

@@ -70,8 +70,15 @@ public interface ICoachInfoService extends IService<CoachInfo>{
 
     /**
      * pc教练密码重置
-     * @param coachnums
+     * @param ids
      * @return
      */
-    boolean resetPassword(String[] coachnums);
+    boolean resetPassword(Long[] ids);
+
+    /**
+     * 删除教练(逻辑删除)
+     * @param ids
+     * @return
+     */
+    boolean removeCoach(Long[] ids);
 }

+ 19 - 3
hzgzpt-service/src/main/java/com/miaxis/coach/service/impl/CoachInfoServiceImpl.java

@@ -103,15 +103,31 @@ public class CoachInfoServiceImpl extends ServiceImpl<CoachInfoMapper, CoachInfo
 
     /**
      * pc教练密码重置
-     * @param coachnums
+     * @param ids
      * @return
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public boolean resetPassword(String[] coachnums) {
+    public boolean resetPassword(Long[] ids) {
         try {
             String password = SecurityUtils.encryptPassword("123456");
-            coachInfoMapper.resetPassword(coachnums, password);
+            coachInfoMapper.resetPassword(ids, password);
+            return true;
+        }catch (Exception e){
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * 删除教练(逻辑删除)
+     * @param ids
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean removeCoach(Long[] ids) {
+        try {
+            coachInfoMapper.removeCoach(ids);
             return true;
         }catch (Exception e){
             throw new RuntimeException(e);

+ 1 - 1
hzgzpt-service/src/main/java/com/miaxis/school/service/impl/SchoolInfoServiceImpl.java

@@ -144,7 +144,7 @@ public class SchoolInfoServiceImpl extends ServiceImpl<SchoolInfoMapper, SchoolI
 
     /**
      * pc删除驾校(逻辑删除)
-     * @param inscodes
+     * @param ids
      * @return
      */
     @Override

+ 16 - 3
hzgzpt-service/src/main/resources/mapper/coach/CoachInfoMapper.xml

@@ -180,9 +180,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         coach_info ci
         SET password = #{password}
         <where>
-            and ci.coachnum in
-            <foreach collection="coachnums" item="coachnum" open="(" close=")" separator=",">
-                (#{coachnum})
+            and ci.id in
+            <foreach collection="ids" item="id" open="(" close=")" separator=",">
+                (#{id})
+            </foreach>
+        </where>
+    </update>
+
+    <!--pc删除教练(逻辑删除)-->
+    <update id="removeCoach">
+        UPDATE
+        coach_info s
+        SET s.status = '1'
+        <where>
+            and s.id in
+            <foreach collection="ids" item="id" open="(" close=")" separator=",">
+                (#{id})
             </foreach>
         </where>
     </update>