日期:2014-05-16 浏览次数:20425 次
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import com.zxyg.bean.orgnization.Employee;
/**
* 年销售统计
* @author Lan
*
*/
@Entity
@Table(name = "t_yearunits")
public class YearUnits {
private Integer id;
private String year;
private Float units;
private Set<MonthUnits> months = new HashSet<MonthUnits>();
@OneToMany(mappedBy="year", cascade=CascadeType.REFRESH)
public Set<MonthUnits> getMonths() {
return months;
}
public void setMonths(Set<MonthUnits> months) {
this.months = months;
}
@Id @GeneratedValue
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(length=4, nullable=false)
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
@Column(length=5, nullable=false)
public Float getUnits() {
return units;
}
public void setUnits(Float units) {
this.units = units;
}
}
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
* 月销售统计
* @author Lan
*
*/
@Entity
@Table(name = "t_monthunits")
public class MonthUnits {
private Integer id;
private String month;
private Float units;
private YearUnits year;
@ManyToOne(cascade=CascadeType.REFRESH)
@JoinColumn(name="year_id")
public YearUnits getYear() {
return year;
}
public void setYear(YearUnits year) {
this.year = year;
}
@Id @GeneratedValue
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(length=4, nullable=false)
public String getMonth() {
return month;
}
public void setMonth(String month) {
this.month = month;
}
@Column(length=5, nullable=false)
public Float getUnits() {
return units;
}
public void setUnits(Float units) {
this.units = units;
}
}
import java.io.PrintWriter;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import org.springframework.stereotype.Controller;
import com.zxyg.bean.report.MonthUnits;
import com.zxyg.bean.report.YearUnits;
import com.zxyg.service.report.MonthUnitsService;
import com.zxyg.service.report.YearUnitsService;
/**
* 年销售统计图表
* @author Lan
*
*/
@Controller("/year/units/report")
public class YearUnitsAction extends Action {
@Resource private YearU