package model import ( "fmt" "github.com/zeromicro/go-zero/core/stores/sqlx" ) var _ CbStaffModel = (*customCbStaffModel)(nil) type ( // CbStaffModel is an interface to be customized, add more methods here, // and implement the added methods in customCbStaffModel. CbStaffModel interface { cbStaffModel GetStaff(corpid, userid string) (d *CbStaff, err error) } customCbStaffModel struct { *defaultCbStaffModel } ) // NewCbStaffModel returns a model for the database table. func NewCbStaffModel(conn sqlx.SqlConn) CbStaffModel { return &customCbStaffModel{ defaultCbStaffModel: newCbStaffModel(conn), } } func (m *customCbStaffModel) GetStaff(corpid, userid string) (d *CbStaff, err error) { query := fmt.Sprintf("select * from %s where `corpid` = ? AND `userid` = ? limit 1", m.table) var resp CbStaff err = m.conn.QueryRow(&resp, query, corpid, userid) d = &resp return }