You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.3 KiB

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<Customer> 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<Customer> list() {
return customerMapper.selectByExample(null);
}
@Override
public void shezhihuiyuan(int id) {
customerMapper.enableStatus(id);
}
@Override
public void del(int id) {
customerMapper.deleteByPrimaryKey(id);
}
}