| | |
| | | import java.util.List; |
| | | import java.lang.Long; |
| | | import java.util.Date; |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornSettleRecord; |
| | | import org.yeshi.utils.mongo.MongodbBaseDao; |
| | | |
| | | import java.lang.String; |
| | | |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | |
| | | @Repository |
| | | public class GoldCornSettleRecordDao extends MongodbBaseDao<GoldCornSettleRecord>{ |
| | | public class GoldCornSettleRecordDao extends MongodbBaseDao<GoldCornSettleRecord> { |
| | | |
| | | public void updateSelective(GoldCornSettleRecord bean) { |
| | | public void updateSelective(GoldCornSettleRecord bean) { |
| | | Query query = new Query(); |
| | | Update update=new Update(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if(bean.getDay() != null) { |
| | | if (bean.getDay() != null) { |
| | | update.set("day", bean.getDay()); |
| | | } |
| | | if(bean.getSystem() != null) { |
| | | if (bean.getSystem() != null) { |
| | | update.set("system", bean.getSystem()); |
| | | } |
| | | if(bean.getRate() != null) { |
| | | if (bean.getRate() != null) { |
| | | update.set("rate", bean.getRate()); |
| | | } |
| | | if(bean.getCornNum() != null) { |
| | | if (bean.getCornNum() != null) { |
| | | update.set("cornNum", bean.getCornNum()); |
| | | } |
| | | if(bean.getTotalMoney() != null) { |
| | | if (bean.getTotalMoney() != null) { |
| | | update.set("totalMoney", bean.getTotalMoney()); |
| | | } |
| | | if(bean.getRemarks() != null) { |
| | | |
| | | if (bean.getUserCount() != null) { |
| | | update.set("userCount", bean.getUserCount()); |
| | | } |
| | | |
| | | if (bean.getSettledUserCount() != null) { |
| | | update.set("settledUserCount", bean.getSettledUserCount()); |
| | | } |
| | | |
| | | if (bean.getRemarks() != null) { |
| | | update.set("remarks", bean.getRemarks()); |
| | | } |
| | | if(bean.getCreateTime() != null) { |
| | | if (bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | } |
| | | |
| | | |
| | | public List<GoldCornSettleRecord> list(DaoQuery daoQuery){ |
| | | public List<GoldCornSettleRecord> list(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | if (daoQuery.sortList!=null && daoQuery.sortList.size()>0){ |
| | | if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) { |
| | | query.with(Sort.by(daoQuery.sortList)); |
| | | } |
| | | query.skip(daoQuery.start); |
| | | query.limit(daoQuery.count); |
| | | return findList(query); |
| | | } |
| | | } |
| | | |
| | | public long count(DaoQuery daoQuery){ |
| | | Query query=getQuery(daoQuery); |
| | | public long count(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | return count(query); |
| | | } |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery){ |
| | | List<Criteria> andList=new ArrayList<>(); |
| | | if(daoQuery.day!=null){ |
| | | private Query getQuery(DaoQuery daoQuery) { |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | if (daoQuery.day != null) { |
| | | andList.add(Criteria.where("day").is(daoQuery.day)); |
| | | } |
| | | if(daoQuery.system!=null){ |
| | | if (daoQuery.system != null) { |
| | | andList.add(Criteria.where("system").is(daoQuery.system)); |
| | | } |
| | | if(daoQuery.maxCreateTime!=null){ |
| | | |
| | | if (daoQuery.maxCreateTime != null) { |
| | | andList.add(Criteria.where("createTime").lt(daoQuery.maxCreateTime)); |
| | | } |
| | | if(daoQuery.minCreateTime!=null){ |
| | | if (daoQuery.minCreateTime != null) { |
| | | andList.add(Criteria.where("createTime").gte(daoQuery.minCreateTime)); |
| | | } |
| | | Query query=new Query(); |
| | | Criteria[] ands=new Criteria[andList.size()]; |
| | | Query query = new Query(); |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | if(ands.length>0){ |
| | | if (ands.length > 0) { |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | } |
| | | return query; |
| | | } |
| | | } |
| | | |
| | | public static class DaoQuery{ |
| | | public static class DaoQuery { |
| | | public String day; |
| | | public SystemEnum system; |
| | | public Date maxCreateTime; |
| | |
| | | public int start; |
| | | public int count; |
| | | public List<Sort.Order> sortList; |
| | | } |
| | | } |
| | | } |