package com.org.hktshop.service.coupon;

import com.org.hktshop.Interface.coupon.HktCouponUserService;
import com.org.hktshop.base.BaseService;
import com.org.hktshop.entity.product.HktCouponUser;
import com.org.hktshop.utils.ExecSqlLib;
import org.springframework.stereotype.Service;

/**
 * @author hotking03
 */
@Service
public class HktCouponUserServiceImpl extends BaseService<HktCouponUser> implements HktCouponUserService {
    @Override
    public HktCouponUser findHktCouponUser(HktCouponUser hktCouponUser) {
        String sql = ExecSqlLib.GetQuerySql(hktCouponUser);
        return this.baseJdbcDao.query(sql,hktCouponUser);
    }

    @Override
    public void updateByHktCouponUser(HktCouponUser hktCouponUser) {
        String sql = "update hkt_coupon_user set used=1 where coupon_id= "+hktCouponUser.getCouponId()+" and user_id = "+hktCouponUser.getUserId();
        this.baseJdbcDao.execute(sql);
    }
}
