| | |
| | | package com.yeshi.fanli.dao.user;
|
| | |
|
| | | 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 com.yeshi.fanli.dao.MongodbBaseDao;
|
| | | import com.yeshi.fanli.entity.bus.user.BindRemind;
|
| | |
|
| | | @Repository
|
| | | public class BindRemindDao extends MongodbBaseDao<BindRemind> {
|
| | | |
| | | public BindRemind getByUidAndType(Long uid, Integer type) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(
|
| | | new Criteria().andOperator(
|
| | | Criteria.where("uid").is(uid),
|
| | | Criteria.where("type").is(type)
|
| | | )
|
| | | );
|
| | | return mongoTemplate.findOne(query, BindRemind.class);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 更新分享次数
|
| | | * @param record
|
| | | */
|
| | | public void updateInfo(BindRemind record) {
|
| | | if (record == null) {
|
| | | return;
|
| | | }
|
| | | // 查询数据是存在
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("id").is(record.getId()));
|
| | | |
| | | Update update = Update.update("createTime", record.getRemindTime());
|
| | | mongoTemplate.updateMulti(query, update, BindRemind.class);
|
| | | }
|
| | | }
|
| | |
|
| | | package com.yeshi.fanli.dao.user; |
| | | |
| | | 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 com.yeshi.common.MongodbBaseDao; |
| | | import com.yeshi.fanli.entity.bus.user.BindRemind; |
| | | |
| | | @Repository |
| | | public class BindRemindDao extends MongodbBaseDao<BindRemind> { |
| | | |
| | | public BindRemind getByUidAndType(Long uid, Integer type) { |
| | | Query query = new Query(); |
| | | query.addCriteria( |
| | | new Criteria().andOperator( |
| | | Criteria.where("uid").is(uid), |
| | | Criteria.where("type").is(type) |
| | | ) |
| | | ); |
| | | return mongoTemplate.findOne(query, BindRemind.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 更新分享次数 |
| | | * @param record |
| | | */ |
| | | public void updateInfo(BindRemind record) { |
| | | if (record == null) { |
| | | return; |
| | | } |
| | | // 查询数据是存在 |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("id").is(record.getId())); |
| | | |
| | | Update update = Update.update("createTime", record.getRemindTime()); |
| | | mongoTemplate.updateMulti(query, update, BindRemind.class); |
| | | } |
| | | } |
| | | |