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

import com.org.hktshop.base.BaseService;
import com.org.hktshop.entity.user.HktUsersLevel;
import com.org.hktshop.service.user.HktUsersLevelService;
import com.org.hktshop.utils.ExecSqlLib;
import com.org.hktshop.utils.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author hotking03
 */
@Service
public class HktUsersLevelServiceImpl extends BaseService<HktUsersLevel> implements HktUsersLevelService {
    @Override
    public void updateScoreLevel(HktUsersLevel hktUsersLevel) {
        String sql;
        if(StringUtils.isNull(hktUsersLevel.getId())){
            sql = ExecSqlLib.GetInsertSql(hktUsersLevel);
        }else {
            sql = ExecSqlLib.GetUpdateSql(hktUsersLevel);
        }
        this.baseJdbcDao.execute(sql);
    }

    @Override
    public List<HktUsersLevel> selectScoreLevel(HktUsersLevel hktUsersLevel) {
        String sql = ExecSqlLib.GetQuerySql(hktUsersLevel);
        return this.baseJdbcDao.queryList(sql,hktUsersLevel);
    }

    @Override
    public HktUsersLevel findScoreLevel(HktUsersLevel hktUsersLevel) {
        String sql = ExecSqlLib.GetQuerySql(hktUsersLevel);
        return this.baseJdbcDao.query(sql,hktUsersLevel);
    }
}
