package com.duowenlvshi.duowenlszp.model.lawyer.controller;

import com.duowenlvshi.duowenlszp.model.lawyer.server.LawyerServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.Map;

/**
 * @author yang fang yu
 * @since 2019/9/23 21:12
 */
@Transactional
@Component
public class LawyerController {
    @Value("${backgroundMap.url}")
    private String url;

    @Autowired
    LawyerServer lawyerServer;

    /**
     * 设置背景图
     * */
    public String updateBackgroundMap(Map<String,Object> map){
        String lawyerId =(String) map.get("token");
        String backgroundMap =(String) map.get("backgroundMap");
        Map map1 = new HashMap();
        map1.put("lawyerId",lawyerId);
        map1.put("backgroundMap",backgroundMap);
        lawyerServer.updateBackgroundMap(map1);
        return url+backgroundMap;
    }
    /**
     * 查看背景图
     * */
    public String selectBackgroundMap(Map<String,Object> map){
        String lawyerId =(String) map.get("lawyerId");
        Map map1 = new HashMap();
        map1.put("lawyerId",lawyerId);
        map1.put("url",url);
        return lawyerServer.selectBackgroundMap(map1);
    }
}
