| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- package actions
- import (
- "xorm.io/xorm"
- "dashoo.cn/base_common/utils"
- . "dashoo.cn/base_common/utils/db"
- )
- type ActionsService struct {
- ServiceBase
- }
- func GetActionsService(xormEngine *xorm.Engine) *ActionsService {
- s := new(ActionsService)
- s.DBE = xormEngine
- return s
- }
- func (s *ActionsService) GetAlertor(alertor string) Actions {
- var model Actions
- sql := "select * from Actions where AItem=4 and SPara4='" + alertor + "'"
- s.DBE.SQL(sql).Get(&model)
- return model
- }
- func (s *ActionsService) GetByWdid(wdid string) Actions {
- var model Actions
- sql := "select * from Actions where Wdid='" + wdid + "'"
- s.DBE.SQL(sql).Get(&model)
- return model
- }
- func (s *ActionsService) GetEntitiesWithOrderSearch(searchstring string) []Actions {
- sql := `select * from Actions where ` + searchstring
- List := make([]Actions, 0)
- utils.DBE.SQL(sql).Find(&List)
- return List
- }
- func (s *ActionsService) GetCIds(searchstring string) string {
- if searchstring == "" {
- searchstring = "1=1"
- }
- sql := `select Id from Actions a
- where ` + searchstring
- var cids = "-1"
- List := make([]Actions, 0)
- s.DBE.SQL(sql).Find(&List)
- for i, j := 0, len(List); i < j; i++ {
- cids += "," + utils.ToStr(List[i].Id)
- }
- return cids
- }
- func (s *ActionsService) IsUsed_TriggerAbnormal(aid string) bool {
- var idmodel Id_Int
- if aid == "" {
- aid = "-1"
- }
- sql := `select count(*) Id from Trigger_Abnormal where FIND_IN_SET(` + aid + `,AId)>0`
- s.DBE.SQL(sql).Get(&idmodel)
- return idmodel.Id > 0
- }
|