package com.org.hktshop.service.user.impl;

import com.org.hktshop.base.BaseService;
import com.org.hktshop.base.UserContext;
import com.org.hktshop.entity.user.HktUserContacts;
import com.org.hktshop.service.user.HktUserContactsService;
import com.org.hktshop.utils.ExecSqlLib;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HktUserContactsServiceImpl extends BaseService<HktUserContacts> implements HktUserContactsService {
    @Autowired
    private UserContext userContext;

    @Override
    public void saveHktUserContacts(HktUserContacts hktUserContacts) {
        hktUserContacts.setUserId(userContext.getUserInfo().getId());
        this.updateJdbc(hktUserContacts);
    }

    @Override
    public void deleteHktUserContacts(HktUserContacts hktUserContacts) {
        this.delete(hktUserContacts);
    }

    @Override
    public void updateHktUserContacts(HktUserContacts hktUserContacts) {
        this.updateJdbc(hktUserContacts);
    }

    @Override
    public List<HktUserContacts> gethktHktUserContacts() {
        HktUserContacts contacts = new HktUserContacts();
        contacts.setUserId(userContext.getUserInfo().getId());
        return this.baseJdbcDao.queryList(ExecSqlLib.GetQuerySql(contacts), contacts);
    }
}
