1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CompanyReportPermission struct {
- CompanyReportPermissionId int64 `orm:"column(company_report_permission_id);pk"`
- CompanyId int
- ReportPermissionId int
- CreatedTime time.Time
- LastUpdatedTime time.Time
- ChartPermissionId int
- StartDate string `description:"权限开始日期"`
- EndDate string `description:"权限结束日期"`
- ProductId int `description:"产品id"`
- ProductName string `description:"产品名称"`
- CompanyContractId int `description:"合同id"`
- Status string `description:"'正式','试用','关闭'"`
- ModifyTime string `description:"修改时间"`
- IsUpgrade int `description:"是否升级,1是,0否"`
- ExpensiveYx int `description:"权益研选: 0-3w; 1-5w"`
- }
- // 通过查询条件获取详情
- func GetCompanyReportPermissionDetailByCondition(condition string, pars []interface{}) (item *CompanyReportPermission, err error) {
- if condition == "" {
- return
- }
- o := orm.NewOrmUsingDB("weekly_report")
- sql := `SELECT * FROM company_report_permission WHERE 1 = 1 ` + condition
- err = o.Raw(sql, pars).QueryRow(&item)
- return
- }
- // 列表
- func GetCompanyReportPermissionList(condition string, pars []interface{}) (items []*CompanyReportPermission, err error) {
- o := orm.NewOrmUsingDB("weekly_report")
- sql := `SELECT * FROM company_report_permission WHERE 1= 1 `
- if condition != "" {
- sql += condition
- }
- _, err = o.Raw(sql, pars).QueryRows(&items)
- return
- }
- func GetCompanyPermissionCheck(companyId, permissionId int) (count int, err error) {
- o := orm.NewOrmUsingDB("weekly_report")
- sql := `SELECT COUNT(1) AS count FROM company_report_permission AS a WHERE a.company_id=? AND a.chart_permission_id=? `
- err = o.Raw(sql, companyId, permissionId).QueryRow(&count)
- return
- }
|