package com.cab.service; import java.util.List; import com.cku.jpush.PushUtils; import com.cku.jpush.JpushExtras; import com.cku.jpush.JpushNotification; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.cab.dao.CabPushMapper; import com.cab.model.CabPush; import com.cku.core.PageBeanResult; import com.cku.util.PageBean; @Service("cabPushService") public class CabPushServiceImpl { @Autowired public CabPushMapper cabPushMapper; public PageBeanResult getList(String content,PageBean pb){ PageBeanResult pbr = new PageBeanResult(); List list = cabPushMapper.getList(content,pb.get_limit(),pb.get_start()); pbr.list = list; pbr.totalCount = cabPushMapper.getCount(content); return pbr; } public CabPush getModelById(Long id){ CabPush result= cabPushMapper.selectByPrimaryKey(id.intValue()); return result; } public int updateCabPush(CabPush cabPush) { int i = cabPushMapper.updateByPrimaryKeySelective(cabPush); return i; } public int deleteCabPush(Long id) { int i = cabPushMapper.deleteByPrimaryKey(id.intValue()); return i; } public int changeStatus(Long id) { CabPush cabPush = cabPushMapper.selectByPrimaryKey(id.intValue()); int i = cabPushMapper.changeStatus(id.intValue()); JpushNotification notification = new JpushNotification(cabPush.getContent(),"宠爱王国",new JpushExtras(cabPush.getType(),cabPush.getTypeId()+"").toMap()); if(i>0){ PushUtils.push_all_notification(notification); } return i; } public int addCabPush(CabPush cabPush) { int i = cabPushMapper.insertSelective(cabPush); return i; } }