package com.hai.service.impl; import com.hai.common.utils.DateUtil; import com.hai.dao.HighUserMapper; import com.hai.entity.HighUser; import com.hai.entity.HighUserExample; import com.hai.service.HighUserService; import com.sun.xml.bind.v2.model.core.ID; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; import java.util.Map; /** * @author Sum1Dream */ @Service("highUserServiceImpl") public class HighUserServiceImpl implements HighUserService { @Resource private HighUserMapper highUserMapper; @Override public List getListUser(Map map) { HighUserExample example = new HighUserExample(); HighUserExample.Criteria criteria = example.createCriteria(); if (StringUtils.isNotBlank(map.get("phone"))) { criteria.andPhoneEqualTo(Long.valueOf(map.get("phone"))); } if (StringUtils.isNotBlank(map.get("name"))) { criteria.andNameLike("%" + map.get("name") + "%"); } if (StringUtils.isNotBlank(map.get("status"))) { criteria.andStatusEqualTo(Integer.valueOf(map.get("status"))); } if (StringUtils.isNotBlank(map.get("regTimeStart")) && StringUtils.isNotBlank(map.get("regTimeEnd"))) { criteria.andRegTimeBetween( DateUtil.format(map.get("regTimeStart") , "yyyy-MM-dd HH:mm:ss") , DateUtil.format(map.get("regTimeEnd") , "yyyy-MM-dd HH:mm:ss")); } return highUserMapper.selectByExample(example); } @Override public HighUser findByUserId(Long userId) { return highUserMapper.selectByPrimaryKey(userId); } @Override public void updateUser(HighUser highUser) { highUserMapper.updateByPrimaryKeySelective(highUser); } @Override public void insertUser(HighUser highUser) { highUserMapper.insert(highUser); } }