From cc2bccd23513832e9c9fb2126e707bed64bd4ecf Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 19 三月 2019 12:07:09 +0800
Subject: [PATCH] 删除HongBaoManageDao,AccountMessageDao,BindingAccountDao

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/AccountMessageServiceImpl.java |   31 +++++++++++++------------------
 1 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/AccountMessageServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/AccountMessageServiceImpl.java
index ba271fa..635dc79 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/AccountMessageServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/AccountMessageServiceImpl.java
@@ -1,6 +1,5 @@
 package com.yeshi.fanli.service.impl.user;
 
-import java.io.Serializable;
 import java.util.List;
 
 import javax.annotation.Resource;
@@ -11,7 +10,7 @@
 import org.springframework.stereotype.Service;
 
 import com.yeshi.fanli.dao.config.SystemZnxDao;
-import com.yeshi.fanli.dao.user.AccountMessageDao;
+import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
 import com.yeshi.fanli.dao.user.UserInfoDao;
 import com.yeshi.fanli.entity.bus.user.AccountMessage;
 import com.yeshi.fanli.entity.bus.user.UserInfo;
@@ -23,47 +22,43 @@
 public class AccountMessageServiceImpl implements AccountMessageService {
 
 	@Resource
-	private AccountMessageDao dao;
+	private AccountMessageMapper accountMessageMapper;
 	@Resource
 	private UserInfoDao userInfoDao;
-
 	@Resource
 	private SystemZnxDao systemZnxDao;
 
-	@Resource
-	private AccountMessageService accountMessageService;
-
 	@Override
 	public List<AccountMessage> findAccountMessageList(long uid, int page) {
-		return dao.list("from AccountMessage am where am.userInfo.id=? order by id desc",
-				(page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, new Serializable[] { uid });
+		return accountMessageMapper.listByUidOrderByIdDesc(uid, (page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE);
 	}
 
 	@Override
 	public int getCount(long uid) {
-		return (int) dao.getCount("select count(*) from AccountMessage am where am.userInfo.id=?",
-				new Serializable[] { uid });
+		return (int) accountMessageMapper.countByUidAndOpen(uid, null);
+
 	}
 
 	@Override
 	public void open(long id) {
-		AccountMessage find = dao.find(AccountMessage.class, id);
+		AccountMessage find = accountMessageMapper.selectByPrimaryKey(id);
 		if (find != null) {
-			find.setIsOpen(true);
-			dao.update(find);
+			AccountMessage update = new AccountMessage();
+			update.setId(id);
+			update.setIsOpen(true);
+			accountMessageMapper.updateByPrimaryKeySelective(update);
 		}
 	}
 
 	@Override
 	public int getCanOpenCount(long uid) {
-		return (int) dao.getCount("select count(*) from AccountMessage am where am.userInfo.id=? and am.isOpen=0",
-				new Serializable[] { uid });
+		return (int) accountMessageMapper.countByUidAndOpen(uid, false);
 	}
 
 	@Override
 	public void save(AccountMessage accountMessage) {
 		if (accountMessage != null)
-			dao.save(accountMessage);
+			accountMessageMapper.insertSelective(accountMessage);
 	}
 
 	@SuppressWarnings("unchecked")
@@ -97,7 +92,7 @@
 				accountMessage.setIsOpen(false);
 				accountMessage.setUserInfo(new UserInfo(uid));
 				accountMessage.setSystemMsgId(systemZnx.getId());
-				accountMessageService.save(accountMessage);
+				save(accountMessage);
 			}
 	}
 

--
Gitblit v1.8.0