/*
 * @description:消息推送
 * @Author: LanJianRong
 * @Date: 2021-01-26 14:40:06
 * @FilePath: \construction_management\dao\project_message_dao.go
 */
package dao

import (
	"github.com/go-xorm/xorm"
	"go.mod/models"
)

//数据库操作引擎
type ProjectMessageDao struct {
	engine *xorm.Engine
}

//获得一个DAO对象
func NewProjectMessageDao(engine *xorm.Engine) *ProjectMessageDao {
	return &ProjectMessageDao{
		engine: engine,
	}
}

// 获得项目下 账号的消息
func (d *ProjectMessageDao) GetAll(projectId int, accountId int) []models.CmProjectMessage {

	datalist := make([]models.CmProjectMessage, 0)
	_ = d.engine.
		Where("project_id=? and account_id=? ",
			projectId, accountId).
		Desc("id").
		Find(&datalist)
	return datalist
}
