package com.qianhe.zqbf.service.impl;

import com.qianhe.zqbf.domain.ZqbfXmzBfzj;
import com.qianhe.zqbf.domain.ZqbfXmzBfzjQuery;
import com.qianhe.zqbf.domain.ZqbfXmzBfzjVo;
import com.qianhe.zqbf.mapper.ZqbfXmzBfzjMapper;
import com.qianhe.zqbf.service.ZqbfXmzBfzjService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ZqbfXmzBfzjServiceImpl implements ZqbfXmzBfzjService {
    @Autowired
    private ZqbfXmzBfzjMapper zqbfXmzBfzjMapper;


    /**
     * 条件查询
     */
    @Override
    public List<ZqbfXmzBfzjVo> list(ZqbfXmzBfzjQuery zqbfXmzBfzjQuery) {
        List<ZqbfXmzBfzjVo> dataList = zqbfXmzBfzjMapper.list(zqbfXmzBfzjQuery);
        return dataList;
    }

    /**
     * 查询详情
     */
    @Override
    public ZqbfXmzBfzjVo info(Long id) {
        ZqbfXmzBfzjVo info = zqbfXmzBfzjMapper.info(id);
        return info;
    }

    /**
     * 新增
     */
    @Override
    public int add(ZqbfXmzBfzj zqbfXmzBfzj, String username) {
        zqbfXmzBfzj.setCjr(username);
        zqbfXmzBfzj.setGxr(username);
        zqbfXmzBfzj.setCjsj(new Date());
        return zqbfXmzBfzjMapper.add(zqbfXmzBfzj);
    }

    /**
     * 修改
     */
    @Override
    public int edit(ZqbfXmzBfzj zqbfXmzBfzj, String username) {
        zqbfXmzBfzj.setGxr(username);
        return zqbfXmzBfzjMapper.edit(zqbfXmzBfzj);
    }

    /**
     * 删除
     */
    @Override
    public int delete(Long[] ids) {
        return zqbfXmzBfzjMapper.delete(ids);
    }
}
