package com.zhyc.module.sale.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.common.annotation.DataScope; // 【新增】引入数据权限注解
import com.zhyc.module.sale.mapper.SxCustomerMapper;
import com.zhyc.module.sale.domain.SxCustomer;
import com.zhyc.module.sale.service.ISxCustomerService;

@Service
public class SxCustomerServiceImpl implements ISxCustomerService {
    @Autowired
    private SxCustomerMapper sxCustomerMapper;

    @Override
    public SxCustomer selectSxCustomerById(Long id) {
        return sxCustomerMapper.selectSxCustomerById(id);
    }

    /**
     * 查询客户管理列表
     * 【新增】添加数据权限过滤注解
     * deptAlias = "c": 对应 Mapper.xml 中表 sx_customer 的别名 c
     * userAlias = "c": 对应 Mapper.xml 中表 sx_customer 的别名 c
     */
    @Override
    @DataScope(deptAlias = "c", userAlias = "c")
    public List<SxCustomer> selectSxCustomerList(SxCustomer sxCustomer) {
        return sxCustomerMapper.selectSxCustomerList(sxCustomer);
    }

    @Override
    public int insertSxCustomer(SxCustomer sxCustomer) {
        return sxCustomerMapper.insertSxCustomer(sxCustomer);
    }

    @Override
    public int updateSxCustomer(SxCustomer sxCustomer) {
        return sxCustomerMapper.updateSxCustomer(sxCustomer);
    }

    @Override
    public int deleteSxCustomerByIds(Long[] ids) {
        return sxCustomerMapper.deleteSxCustomerByIds(ids);
    }

    @Override
    public int deleteSxCustomerById(Long id) {
        return sxCustomerMapper.deleteSxCustomerById(id);
    }
}