package cn.com.goldenwater.dcproj.service.impl.system; import cn.com.goldenwater.dcproj.dao.PersInfoDao; import cn.com.goldenwater.dcproj.model.PersInfo; import cn.com.goldenwater.dcproj.param.PersInfoParam; import cn.com.goldenwater.dcproj.service.PersInfoService; import cn.com.goldenwater.core.service.AbstractCrudService; import com.github.pagehelper.PageHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.goldenwater.id.util.UuidUtil; import java.util.HashMap; import java.util.List; import java.util.Date; import java.util.Map; /** * @author lhc * @date 2020-10-20 */ @Service @Transactional public class PersInfoServiceImpl extends AbstractCrudService implements PersInfoService { @Autowired private PersInfoDao persInfoDao; public PersInfoServiceImpl(PersInfoDao persInfoDao) { super(persInfoDao); this.persInfoDao = persInfoDao; } @Override public int insert(PersInfo persInfo) { // 生成uuid String uuid = UuidUtil.uuid(); persInfo.setId(uuid); persInfo.setIntm(new Date()); persInfo.setUptm(new Date()); persInfo.setDataStat("0"); return this.persInfoDao.insert(persInfo); } @Override public int update(PersInfo persInfo) { persInfo.setUptm(new Date()); return this.persInfoDao.update(persInfo); } @Override public int delete(String id) { return this.persInfoDao.delete(id); } @Override public Map getPerInfoSize(String userId) { Map map = new HashMap<>(2); PersInfo persInfo = new PersInfo(); persInfo.setRecPersId(userId); int perInfoTotal = persInfoDao.selectCount(persInfo); persInfo.setIsRead("1"); int undealPerInfoSize = persInfoDao.selectCount(persInfo); map.put("PERINFOTOTAL", perInfoTotal); map.put("PERINFOREAD", perInfoTotal - undealPerInfoSize); return map; } }