package com.duowenlvshi.duowenlszp.model.Job.server;

import com.duowenlvshi.duowenlszp.model.Job.entity.Job;
import com.duowenlvshi.duowenlszp.model.Job.dao.JobMapper;
import com.duowenlvshi.duowenlszp.app.util.UUIDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author yang fang yu
 * @since 2019/8/21 10:51
 */
@Service
public class JobServer {
    @Autowired(required = false)
    JobMapper jobMapper;

    public int delete(String id){
        return jobMapper.delete(id);
    }

    public List selectByLawyerId(String id){
        return jobMapper.selectByLawyerId(id);
    }

    public Map selectByIdPush(String id){
        return jobMapper.selectByIdPush(id);
    }
    public List selectByLawyerIdMy(String jobId,String lawyerId){
        return jobMapper.selectByLawyerIdMy(jobId,lawyerId);
    }
    public int save(Job job){
        int i =0;
        if("".equals(job.getJobId())){
            //新增
            job.setJobId(UUIDUtil.GetUUID());
            job.setCreatedate(new Date());
            job.setUpdatedate(new Date());
            job.setIsvalid("1");
            i =jobMapper.insertSelective(job);
        }else{
            //修改
            job.setUpdatedate(new Date());
            i =jobMapper.updateByPrimaryKeySelective(job);
        }
        return i;
    }
    public List<Map> selectByLawyerIdList(Map map){

        return jobMapper.selectByLawyerIdList(map);
    }
    public Integer selectByLawyerIdListCount(Map map){

        return jobMapper.selectByLawyerIdListCount(map);
    }
    public List<Map> selectConditionList(Map map){
        return jobMapper.selectConditionList(map);
    }
    public List<Map> selectJobDialongus(String id){
        return jobMapper.selectJobDialongus(id);
    }
    public Integer selectConditionListCount(Map map){
        return jobMapper.selectConditionListCount(map);
    }
    public List<Map> selectProvince(){
        return jobMapper.selectProvince();
    }
    public List<Map> selectCity() {
        return jobMapper.selectCity();
    }
    public List<Map> selectSchool(){
        return jobMapper.selectSchool();
    }

    public int updateProfile(Map map){
        return jobMapper.updateProfile(map);
    }
    public String selectProfile(String id){
        return jobMapper.selectProfile(id);
    }

    public List selectPost(Map map){
        return jobMapper.selectPost(map);
    }
}
