修复删除用户时删除用户对应的角色问题

master
river 4 years ago
parent bc93aa4234
commit 9a6e815201
  1. 2
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java
  2. 1
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java
  3. 8
      dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml

@ -113,4 +113,6 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
Integer countUserIdAndRoleId(@Param("userId") Long userId, @Param("roleId") Long roleId);
int selectUserRole(@Param("userId") Long userId, @Param("roleId") Long roleId);
Boolean deleteRoleByUserId(@Param("ids") List<Long> ids);
}

@ -87,6 +87,7 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity
if (user_ids == null || user_ids.size() == 0) {
ExceptionCast.cast(HrmsCode.EMPLOYEE_IS_NULL);
}
this.getBaseMapper().deleteRoleByUserId(user_ids);
return this.getBaseMapper().deleteByIds(user_ids);
}

@ -626,4 +626,12 @@
SELECT COUNT(id) FROM hrms_employee_role WHERE user_id = #{userId} AND role_id = #{roleId}
</select>
<!-- 删除用户对应的角色信息 -->
<delete id="deleteRoleByUserId" parameterType="long">
DELETE FROM hrms_employee_role WHERE user_id IN
<foreach collection="ids" open="(" separator="," close=")" item="id">
#{id}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save