123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- package crm
- import (
- "hongze/fms_api/global"
- "time"
- )
- // ChartPermission CRM系统-权限表
- type ChartPermission struct {
- ChartPermissionId int `gorm:"primaryKey;column:chart_permission_id" json:"chart_permission_id" description:"权限ID"`
- ChartPermissionName string `gorm:"column:chart_permission_name" json:"chart_permission_name" description:"名称"`
- PermissionName string `gorm:"column:permission_name" json:"permission_name" description:"权限名"`
- Sort int `gorm:"column:sort" json:"sort" description:"排序"`
- Enabled int `gorm:"column:enabled" json:"enabled" description:"是否可用"`
- CreatedTime time.Time `gorm:"column:created_time" json:"created_time" description:"创建时间"`
- LastUpdatedTime time.Time `gorm:"column:last_updated_time" json:"last_updated_time" description:"更新时间"`
- TeleconferenceSort int `gorm:"column:teleconference_sort" json:"teleconference_sort" description:"电话会类型排序"`
- Remark string `gorm:"column:remark" json:"remark" description:"备注"`
- ClassifyName string `gorm:"column:classify_name" json:"classify_name" description:"分类名称"`
- ProductName string `gorm:"column:product_name" json:"product_name" description:"产品名称"`
- ProductID int `gorm:"column:product_id" json:"product_id" description:"产品ID"`
- ImageURL string `gorm:"column:image_url" json:"image_url" description:"图片地址"`
- ShowType int `gorm:"column:show_type" json:"show_type" description:"1:查研观向小程序展示"`
- IsOther int `gorm:"column:is_other" json:"is_other" description:"是否是其他,用于查研观向小程序后台展示"`
- IsReport int `gorm:"column:is_report" json:"is_report" description:"是否是报告,用于查研观向小程序前台报告展示"`
- CygxAuth int `gorm:"column:cygx_auth" json:"cygx_auth" description:"是否是权限,用于查研观向小程序前台权限校验"`
- YbImgUrl string `gorm:"column:yb_img_url" json:"yb_img_url" description:"研报小程序报告列表icon"`
- PriceDrivenState int `gorm:"column:price_driven_state" json:"price_driven_state" description:"品种价格驱动开启状态 0-关闭 1-开启"`
- ParentId int `gorm:"column:parent_id;default:0;NOT NULL;comment:'父级权限id'" json:"parent_id"`
- IsPublic int `gorm:"column:is_public;default:0;NOT NULL;comment:'是否是公有权限1:公有权限,0私有权限'" json:"is_public"`
- }
- func (cp *ChartPermission) TableName() string {
- return "chart_permission"
- }
- func (cp *ChartPermission) List(condition string, pars []interface{}) (list []*ChartPermission, err error) {
- list = make([]*ChartPermission, 0)
- err = global.MYSQL["report"].Model(cp).
- Where(condition, pars...).
- Order("sort ASC").
- Find(&list).Error
- return
- }
- type PermissionSetResp struct {
- List []*PermissionSetList
- }
- type PermissionSetList struct {
- ClassifyName string `json:"classify_name" description:"分类"`
- Items []*PermissionSetItem `json:"items"`
- CheckList []int `json:"check_list"`
- }
- type PermissionSetItem struct {
- ChartPermissionId int `json:"chart_permission_id" description:"权限id"`
- PermissionName string `json:"permission_name" description:"权限名称"`
- PermissionType int `json:"permission_type" description:"1主观,2客观"`
- Checked bool `json:"checked" description:"选中状态"`
- ClassifyName string `json:"classify_name" description:"分类名称"`
- ParentId int `description:"父级权限id"`
- IsPublic int `description:"是否是公有权限1:公有权限,0私有权限"`
- }
- func GetPermissionSetItemsByCondition(condition string, pars []interface{}) (items []*PermissionSetItem, err error) {
- items = make([]*PermissionSetItem, 0)
- err = global.MYSQL["report"].
- Table("chart_permission").
- Where(condition, pars...).
- Order("sort ASC").
- Find(&items).Error
- return
- }
- // ContractPermissionListReq CRM系统合同权限-列表请求体
- type ContractPermissionListReq struct {
- ProductId int `json:"product_id" form:"product_id" description:"产品: 1-FICC; 2-权益"`
- }
- type CompanyPermissionLookItem struct {
- ChartPermissionId int `description:"权限id"`
- PermissionName string `description:"权限名称"`
- StartDate string `description:"权限开始日期"`
- EndDate string `description:"权限结束日期"`
- Status string `description:"'正式','试用','关闭'"`
- ExpireDay string `description:"到期天数"`
- ClassifyName string `description:"分类"`
- PermissionType int `description:"1主观,2客观"`
- PermissionTypeName string `description:"主观、客观"`
- Checked bool `description:"选中状态"`
- Remark string `description:"备注"`
- IsMerge bool `description:"是否合并行业, 给前端的标识, 暂时仅权益使用"`
- RaiBothHas bool `description:"权益-是否主客观都有"`
- IsUpgrade int `description:"是否升级,1是,0否"`
- ParentId int `description:"父级权限id"`
- IsPublic int `description:"是否是公有权限1:公有权限,0私有权限"`
- }
- func GetPermissionLookItems(productId int, classifyName string) (items []*CompanyPermissionLookItem, err error) {
- items = make([]*CompanyPermissionLookItem, 0)
- err = global.MYSQL["report"].Table("chart_permission").
- Where("enabled = 1 AND product_id = ? AND classify_name = ? AND parent_id>0", productId, classifyName).
- Order("sort ASC").
- Find(&items).Error
- return
- }
- func GetSecondPermissionLookItemsByProductId(productId int) (items []*CompanyPermissionLookItem, err error) {
- items = make([]*CompanyPermissionLookItem, 0)
- err = global.MYSQL["report"].Table("chart_permission").
- Where("enabled = 1 AND product_id = ? AND parent_id>0", productId).
- Order("sort ASC").
- Find(&items).Error
- return
- }
|