package com.iamberry.wechat.service.customized;

import com.github.pagehelper.PageHelper;
import com.iamberry.wechat.core.entity.customized.OrderCustomized;
import com.iamberry.wechat.core.entity.page.PageRequest;
import com.iamberry.wechat.core.entity.page.PagedResult;
import com.iamberry.wechat.core.entity.receive.ChargerReceive;
import com.iamberry.wechat.face.customized.OrderCustomizedService;
import com.iamberry.wechat.service.mapper.OrderCustomizedMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import util.PageUtil;

import java.util.List;

/**
 *  牙刷定制-定制牙刷信息接口
 * @author w
 * @Date 2018-05-25
 */
@Service
public class OrderCustomizedServiceImpl  implements OrderCustomizedService {
    @Autowired
    private OrderCustomizedMapper orderCustomizedMapper;
    /**
     * 获取集合
     * @param  orderCustomized
     * @return List
     */
    @Override
    public List<OrderCustomized> getOrderCustomizedList(OrderCustomized  orderCustomized){
        return  orderCustomizedMapper.getOrderCustomizedList(orderCustomized);
    }

    /**
     * 获取集合
     * @param  pageRequest
     * @return List
     */
    @Override
    public PagedResult<OrderCustomized> listOrderCustomizedPage(PageRequest<OrderCustomized> pageRequest) {
        PageHelper.startPage(pageRequest.getPageNO(), pageRequest.getPageSize(), pageRequest.isPageTotal());
        List<OrderCustomized> detedctList = orderCustomizedMapper.listOrderCustomizedPage(pageRequest.getData());
        return PageUtil.getPage(detedctList);
    }

    /**
     * 查询单条数据
     * @param  id
     * @return  orderCustomized
     */
    @Override
    public  OrderCustomized  getOrderCustomizedById(Integer  id){
        return  orderCustomizedMapper.getOrderCustomizedById(id);
    }
    /**
     * 增加数据
     * @param  orderCustomized
     * @return Integer
     */
    @Override
    public  Integer  save(OrderCustomized  orderCustomized){
        return  orderCustomizedMapper.save(orderCustomized);
    }
    /**
     * 修改数据
     * @param  orderCustomized
     * @return Integer
     */
    @Override
    public  Integer  update(OrderCustomized  orderCustomized){
        return  orderCustomizedMapper.update(orderCustomized);
    }
}