package com.hai.service.impl; import com.hai.dao.HighGoldRecMapper; import com.hai.entity.HighGoldRec; import com.hai.entity.HighGoldRecExample; import com.hai.service.HighGoldRecService; import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; import java.util.Map; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/27 10:03 */ @Service("highGoldRecService") public class HighGoldRecServiceImpl implements HighGoldRecService { @Resource private HighGoldRecMapper highGoldRecMapper; @Override public void insertGoldRec(HighGoldRec highGoldRec) { highGoldRecMapper.insert(highGoldRec); } @Override public List getGoldRec(Map map) { HighGoldRecExample example = new HighGoldRecExample(); HighGoldRecExample.Criteria criteria = example.createCriteria(); if (MapUtils.getLong(map, "userId") != null) { criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId")); } if (MapUtils.getLong(map, "goldType") != null) { criteria.andGoldTypeEqualTo(MapUtils.getLong(map, "goldType")); } example.setOrderByClause("create_time desc"); return highGoldRecMapper.selectByExample(example); } }