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.

64 lines
1.6 KiB

package com.demo.service.impl;
import com.demo.dao.CustomerMapper;
import com.demo.dao.ZiXunMapper;
import com.demo.pojo.Customer;
import com.demo.pojo.ZiXun;
import com.demo.pojo.ZiXunExample;
import com.demo.service.ZiXunService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ZiXunServiceImpl implements ZiXunService {
@Autowired
private ZiXunMapper ziXunMapper;
@Autowired
private CustomerMapper customerMapper;
@Override
public List<ZiXun> list() {
ZiXunExample example = new ZiXunExample();
example.createCriteria().andStatusEqualTo(1);
List<ZiXun> ziXuns = ziXunMapper.selectByExample(example);
for (ZiXun z:ziXuns){
Customer customer =customerMapper.selectByPrimaryKey(z.getCstid());
z.setCustomer(customer);
}
return ziXuns;
}
@Override
public void save(ZiXun entity) {
ziXunMapper.insert(entity);
}
@Override
public void del(int id) {
ziXunMapper.deleteByPrimaryKey(id);
}
@Override
public ZiXun get(int id) {
return ziXunMapper.selectByPrimaryKey(id);
}
@Override
public void shenhe(int zid) {
ziXunMapper.shenhe(zid);
}
@Override
public List<ZiXun> list1() {
List<ZiXun> ziXuns = ziXunMapper.selectByExample(null);
for (ZiXun z:ziXuns){
Customer customer =customerMapper.selectByPrimaryKey(z.getCstid());
z.setCustomer(customer);
}
return ziXuns;
}
}