springboot+vue+elementUI用户头像获取

springboot+vue+elementUI用户头像获取

实现思路:

​ 前端带token发请求—>后端解析token,获取到用户名,用户ID,根据用户id查base64 图片
code 返回前端。

前端代码:

template:

<img :src=userImg style="width:30px;height:30px;margin-right:15px;margin-top:15px">

方法:

			getUserImg(){
				this.request(this.url.getUserImg,'get',{},(response)=>{
					// console.log(response.obj.img)
					this.userImg=response.obj.img
				})
			}

后端代码:

tips:

数据库使用普通的varchar类型不能满足要求,且无法存储图片。这里使用了blob类型,但转换是个坑,需要重新写mapper。

controller:

    @RequestMapping(method = RequestMethod.GET,value = "/getUserImg")
    public ResultJson getUserImg(){
        logger.info("获取头像及用户名称");
        ServletRequestAttributes rsa = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        HttpServletRequest request = rsa.getRequest();
        String token = request.getHeader("token");
        UmsAdminDetail adminDetail = new UmsAdminDetail();
        try {
            UmsAdmin umsAdmin = JWTUtil.deCodeToken(token);
            if (umsAdmin!=null){
                adminDetail = umsAdminDetailService.getByUserId(umsAdmin.getId());
                adminDetail.setUserName(umsAdmin.getLoginName());
                logger.info(umsAdmin.getLoginName());
                logger.info(adminDetail.toString());
                if (adminDetail!=null){
                    String img = new String(adminDetail.getImgCode(), "UTF-8");
                    if (img!=null){
                        adminDetail.setImg(img);
                    }else {
                        return ResultJson.error("转换头像失败");
                    }
                }else {
                    return ResultJson.error("获取用户信息失败");
                }
            }else {
                return ResultJson.error("获取用户失败");
            }
        } catch (Exception e) {
            return ResultJson.error(e.getMessage());
        }
        return ResultJson.success(adminDetail);
    }

service实现类:

    @Override
    public UmsAdminDetail getByUserId(Integer id) {
        UmsAdminDetail umsAdminDetail = umsAdminDetailMapper.selectOneByUserId(id);
        return umsAdminDetail;
    }

mapper:

这里自定义了查询结果。转换typeHandler使用mybatis自带的。没有自己写



<mapper namespace="com.wy.mapper.UmsAdminDetailMapper">
    
    <resultMap id="getUmsAdminDetailResultMap" type="com.wy.pojo.UmsAdminDetail">
        <id column="id" property="id"/>
        <result column="user_id" property="userId"/>
        
        <result column="img_code" property="imgCode" typeHandler="org.apache.ibatis.type.BlobTypeHandler"/>
    resultMap>

    
    <select id="selectOneByUserId" resultMap="getUmsAdminDetailResultMap">
        select id,user_id,img_code from ums_admin_detail where 1=1
        
        <if test="id != null">
            and user_id = #{id}
        if>
        limit 1
    select>


    
    <insert id="insertImg" parameterType="com.wy.pojo.UmsAdminDetail">
        insert into ums_admin_detail(user_id,img_code)
        values (#{userId},#{imgCode})
    insert>


mapper>

测试类:

@RunWith作用
@RunWith 就是一个运行器

@RunWith(JUnit4.class) 就是指用JUnit4来运行

@RunWith(SpringJUnit4ClassRunner.class),让测试运行于Spring测试环境

@RunWith(Suite.class) 的话就是一套测试集合,

@ContextConfiguration Spring整合JUnit4测试时,使用注解引入多个配置文件

插入blobDemo:

package com.wy.test;

import com.wy.AdminApp;
import com.wy.mapper.UmsAdminDetailMapper;
import com.wy.pojo.UmsAdminDetail;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;

@SpringBootTest(classes = {AdminApp.class})
@RunWith(SpringJUnit4ClassRunner.class)

public class BlobTest {
    @Resource
    private UmsAdminDetailMapper adminDetailMapper;
    @Test
    public void test01() throws UnsupportedEncodingException {
        String str = "data:image/jpg;base64,UklGRiQwAABXRUJQVlA4IBgwAAAQmAGdASq8ArwCPrVaqU2nJaQiI/JaKOAWiWlu8lRXh3muBjnxeWoZC1P3WYcsYLEZP85z3Rj5T/of+X6YfJr+P/kNujwP1vu2J3D/OLUa/Lf7DwjAoGd762Nkf5iN6fXmzwJ+FZnckLG6hXLyEJM3XUlQROb19y09ZW81vxqySNAF4XM4EuYlXLPxb1CGZIcoeZ4bOW67d5O/q1e7tv4RzVKGNLezS1sO2nEt0313UBIyNuRcgh+fbvHJGpmuAZz/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minDetail umsAdminDetail = new UmsAdminDetail();
        umsAdminDetail.setImgCode(str.getBytes());
        umsAdminDetail.setUserId(118);
//        adminDetailMapper.insertImg(umsAdminDetail);
        UmsAdminDetail umsAdminDetail1 = adminDetailMapper.selectOneByUserId(118);
        System.out.println(umsAdminDetail1.toString());
        System.out.println(new String(umsAdminDetail1.getImgCode(),"UTF-8") );
    }
}

参考文章

https://blog.csdn.net/wild46cat/article/details/53080500

你可能感兴趣的:(ruoyi项目学习,spring,boot,vue.js,elementui)