package com.yeshi.buwan.dao.ad; import com.yeshi.buwan.domain.ad.DeviceAdStrategy; import com.yeshi.buwan.dao.base.MongodbBaseDao; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Update; import org.springframework.stereotype.Repository; import java.util.Date; @Repository public class DeviceAdStrategyDao extends MongodbBaseDao { public void updateSelective(DeviceAdStrategy bean) { Query query = new Query(); Update update = new Update(); query.addCriteria(Criteria.where("id").is(bean.getId())); if (bean.getDetailSystemId() != null) { update.set("detailSystemId", bean.getDetailSystemId()); } if (bean.getDeviceId() != null) { update.set("deviceId", bean.getDeviceId()); } if (bean.getDetailFSAExpireTime() != null) { update.set("detailFSAExpireTime", bean.getDetailFSAExpireTime()); } if (bean.getDetailPVAExpireTime() != null) { update.set("detailPVAExpireTime", bean.getDetailPVAExpireTime()); } if (bean.getDetailShortVideoFSAExpireTime() != null) { update.set("detailShortVideoFSAExpireTime", bean.getDetailShortVideoFSAExpireTime()); } if (bean.getDetailShortVideoPVAExpireTime() != null) { update.set("detailShortVideoPVAExpireTime", bean.getDetailShortVideoPVAExpireTime()); } update.set("updateTime", new Date()); update(query, update); } }