Esempio n. 1
0
func (c *ComplaintController) Export() {
	c.GetInitData()
	p, _ := c.GetInt("p")
	complaintList := complaint.NewComplaintList(p, -1).SetCode(c.GetString("code")).SetProjectName(c.GetString("project")).SetDepartment(c.GetString("department")).
		SetEmployeeId(c.GetString("employee_id")).SetFinishTimeFrom(c.GetString("end_time_from")).SetFinishTimeTo(c.GetString("end_time_to")).SetResponse(c.GetString("response")).
		SetConditions("del_status", 0)
	err := complaintList.GetComplainList()

	if err != nil {
		c.Data["error"] = err.Error()
	}
	records := complaintList.GetExportData()
	c.Ctx.Output.Download(export.NewExporteFile(complaintList).MakeCsvFile(records).GetFilePath(), complaintList.GetOutFileName())

}
Esempio n. 2
0
File: job.go Progetto: zbzzbd/beego
func (c *JobController) Export() {
	c.getInitData()
	p, _ := c.GetInt("p")
	del_status, _ := c.GetInt("delstatus")
	jobList := job.NewJobList(p, -1).SetCode(c.GetString("code")).SetProjectName(c.GetString("project")).
		SetDepartment(c.GetString("department")).SetType(c.GetString("type")).SetEmployeeId(c.GetString("employee_id")).
		SetFinishTimeFrom(c.GetString("finish_time_from")).SetFinishTimeTo(c.GetString("finish_time_to")).
		SetCondition("submit_time__gte", c.GetString("submit_time_from")).SetCondition("submit_time__lte", c.GetString("submit_time_to")).
		SetCondition("create_user_id", c.GetString("create_user_id")).SetCondition("del_status", del_status)

	err := jobList.GetList()
	if err != nil {
		c.Data["error"] = err.Error()
	}
	records := jobList.GetExportData()
	c.Ctx.Output.Download(export.NewExporteFile(jobList).MakeCsvFile(records).GetFilePath(), jobList.GetOutFileName())
}