gorm标准可以受实现域类约束吗?

时间:2019-07-04 06:18:38

标签: grails gorm criteria

拥有一个属于A100的域A110。

我使用createCriteria来限制a100的“ noteDt”列

RouterModule.forRoot([     
      {
        path: 'yourcomponent',
        component: yourcomponent,
        pathMatch: 'full',
        resolve: { ar: ActiveResolver }
      }]

我想知道Gorm标准中有什么方法可以做到这一点?

还是grails中除原始sql代码以外的其他方法?

1 个答案:

答案 0 :(得分:1)

尝试以下代码-

func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {

    if editingStyle == .delete {

       // getting id //
        id1 = "\(arrdata[indexPath.row].id)"
        print(id1)

        self.arrdata.remove(at: indexPath.row)
        tableView.deleteRows(at: [indexPath], with: .automatic)
        let url = URL(string: "http://localhost:8080/hub/business/fun/=%@",id1 as CVarArg)

        URLSession.shared.dataTask(with: url!) { (data, response, error) in
            do{if error == nil{
                self.arrdata = try JSONDecoder().decode([jsonstruct3].self, from: data!)

                for mainarr in self.arrdata{
                    //                    print(mainarr.name,":",mainarr.capital,":",mainarr.alpha3Code)
                    //                    print(data)

                    DispatchQueue.main.async {
                        self.tableView.reloadData()
                    }
                }
                }

            }
            catch
            {
                print("Error in get json data")
                print(error)
            }

            }.resume()

        tableView.reloadData()
        tableView.endUpdates()
    }
}

A110.createCriteria().list() {
  A100 {
    order("noteDt", "asc")
  }
}