package com.cool.store.dao;


import com.cool.store.entity.HomeTemplateUserMappingDO;
import com.cool.store.mapper.HomeTemplateUserMappingMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;

/**
 * @Author: WangShuo
 * @Date: 2025/04/08/10:25
 * @Version 1.0
 * @注释:
 */
@Repository
public class HomeTemplateUserMappingDAO {

    @Resource
    private HomeTemplateUserMappingMapper homeTemplateUserMappingMapper;

    public int insertSelective(HomeTemplateUserMappingDO homeTemplateRoleMappingDO) {
        return homeTemplateUserMappingMapper.insertSelective(homeTemplateRoleMappingDO);
    }
    public HomeTemplateUserMappingDO getHomeTemplateRoleMappingByUserId(String userId) {
        if (StringUtils.isBlank(userId)){
            return null;
        }
        Example example = new Example(HomeTemplateUserMappingDO.class);
        example.createCriteria().andEqualTo("userId", userId);
        return homeTemplateUserMappingMapper.selectOneByExample(example);
    }
    public int updateByPrimaryKeySelective(HomeTemplateUserMappingDO homeTemplateRoleMappingDO) {
        return homeTemplateUserMappingMapper.updateByPrimaryKeySelective(homeTemplateRoleMappingDO);
    }
}
