package com.demo.action.companey;
import java.util.LinkedList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import com.demo.action.BaseAction;
import com.demo.pojo.companey.Companey;
import com.demo.pojo.user.User;
import com.demo.service.companey.CompaneyService;
import com.demo.service.user.UserService;
/**
* @author XiongShunHong
* @date 2009/4/29
*/
@Controller("companeyAction")
public class CompaneyAction extends BaseAction{
@Autowired
private CompaneyService companeyService;
private Companey companey;
private Long companeyId;
private List<Companey> companeyList;
private Long id;
@Autowired
private UserService userService;
private List<User> userList;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getCompaneyId() {
return companeyId;
}
public void setCompaneyId(Long companeyId) {
this.companeyId = companeyId;
}
public Companey getCompaney() {
return companey;
}
public void setCompaney(Companey companey) {
this.companey = companey;
}
public List<Companey> getCompaneyList() {
return companeyList;
}
public void setCompaneyList(List<Companey> companeyList) {
this.companeyList = companeyList;
}
public List<User> getUserList() {
return userList;
}
public void setUserList(List<User> userList) {
this.userList = userList;
}
/* this method use for companey register */
public String register()throws Exception{
User user=userService.getUserInformation(id);
List<User> userListForUserObj=new LinkedList<User>();
userListForUserObj.add(user);
companey.setUserList(userListForUserObj);
companeyService.register(companey);
companeyList =companeyService.CompaneyList();
return SUCCESS;
}
/* this method use for companey delete*/
public String delete()throws Exception{
companey.setId(companeyId);
companeyService.delete(companey);
companeyList =companeyService.CompaneyList();
return SUCCESS;
}
/*this method use for companey update*/
public String update()throws Exception{
companeyService.update(companey);
companeyList =companeyService.CompaneyList();
return SUCCESS;
}
/*this method use for get one companey information*/
public String getCompaneyInformation()throws Exception{
companey=companeyService.getCompaneyInformation(companeyId);
return SUCCESS;
}
/*this method use for get all companey information*/
public String companeyList()throws Exception{
companeyList =companeyService.CompaneyList();
return SUCCESS;
}
/* this method user for get all user information*/
public String userList()throws Exception{
userList=userService.userList();
return SUCCESS;
}
}
评论4
最新资源