目前,我已设置RESTful API,以返回Book
belongsTo
一个或多个Author
个Author
。虽然这是我想要的,但它不是我喜欢的格式。
当我为<author id="2">
<author_name>Stephen</author_name>
<books>
<book id="2"/>
<book id="3"/>
</books>
</author>
提供2的ID时,我得到以下回复:
<list>
<book id="2">
<book_name>BookA</book_name>
<book_year>2001</book_year>
</book>
<book id="3">
<book_name>BookB</book_name>
<book_year>2005</book_year>
</book>
</list>
相反,我想要一个显示书籍内容的回复,而不是参考:
@Override
protected Book queryForResource(Serializable id) {
def p = Author.id == params.AuthorId
Book.where {
id == id && p
}.find()
}
产生第一个响应的控制器的内容是:
book_year
还可以按protected void btnSubmit_Click(object sender, EventArgs e)
{
string query = "SELECT T1.Project_Id,T2.Project_name,T1.Vehicle_No,T1.Creation_date,T1.Time_In,T1.Time_Out FROM XXCUS.XX_SUPINV T1 INNER JOIN XXACL_PN_PROJBUILD_V T2 ON T1.Project_Id = T2.Project_id WHERE Project_Id = '"+ ddlProjectName.SelectedValue +"' AND Creation_date BETWEEN Convert(datetime,'"+lblFrmDate.Text+"') AND Convert(datetime,'"+lblToDate.Text+"')"
SqlDataAdapter da = new SqlDataAdapter(query, connection);
DataTable dt = new DataTable();
da.Fill(dt);
grdData.DataSource = dt;
grdData.DataBind();
}
降序排序吗?任何帮助将不胜感激。