package com.demo.service.impl; import com.demo.dao.CustomerMapper; import com.demo.pojo.Customer; import com.demo.pojo.CustomerExample; import com.demo.service.CustomerService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class CustomerServiceImpl implements CustomerService { @Autowired private CustomerMapper customerMapper; @Override public Customer foreLogin(Customer customer) { CustomerExample example = new CustomerExample(); example.createCriteria().andNameEqualTo(customer.getName()).andPasswordEqualTo(customer.getPassword()); List customers = customerMapper.selectByExample(example); return customers.size()>0?customers.get(0):null; } @Override public void save(Customer customer) { customerMapper.insert(customer); } @Override public Customer get(int cstid) { return customerMapper.selectByPrimaryKey(cstid); } @Override public List list() { return customerMapper.selectByExample(null); } @Override public void shezhihuiyuan(int id) { customerMapper.enableStatus(id); } @Override public void del(int id) { customerMapper.deleteByPrimaryKey(id); } }