Error message:
{Error:ER_BAD_FIELD_ERROR:Unknown column ' a_role.id ' in ' FIELD list '
To restore a scene:
A_role This table has no self-increment ID, and the primary key is Roleid. This error occurs if you write query data SQL for this table in the controller of THINKJS.
Workaround:
The Modified code:
1 Async listaction () {2Let GetData = This. get ();3 Let role = This.model (' a_role ');4 role._pk = ' Roleid ';5Let whereobj = {};//Status: 1: normal;-1: Disabled6 if(Getdata.roleid) {//role ID7whereobj[' Roleid '] =Getdata.roleid;8 }9 if(Getdata.rolename) {//Role NameTenwhereobj[' rolename ' = [' like ', '% ' + getdata.rolename + '% ']; One } A if(getdata.state && Getdata.state! =-99) { -Whereobj.state =getdata.state; - } theLet result = awaitrole. Field (' Roleid,rolename,state ') - . where (whereobj) -. Order ("Roleid ASC") - . Page (Getdata.pagenumber, getdata.pagesize) + . Countselect (); - return This. JSON ({total:result.count, rows:result.data}); +}
Modifying the default primary key in Thinkjs