package com.recruit.control;

import java.io.IOException;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


import com.recruit.dao.gen.model.Commond;
import com.recruit.dao.gen.model.User;
import com.recruit.service.CommondService;
import com.recruit.util.DateUtil;



@Controller
@RequestMapping("/commond")
public class CommondController {

	@Resource
	CommondService commondService;


	/**
	 * 保存用户
	 * 
	 * @return
	 * @throws IOException 
	 */
	@RequestMapping(value = "/saveCommond", method = RequestMethod.POST)
	public  void saveCommond(Commond Commond, HttpServletRequest request,HttpServletResponse response) throws IOException {
		User user = (User) request.getSession().getAttribute("user");
		if(user==null){
			response.setContentType("text/html;charset=utf-8");
			
			response.getWriter().print("登入之后才能发布信息");
			return;
		}
		Commond.setUserId(user.getId());
       Commond.setCreatedate(DateUtil.currDay());
		boolean flag = commondService.saveCommond(Commond);
		
		try {
			if (flag) {
				response.setContentType("text/html;charset=utf-8");
			
				response.getWriter().print(1);
			
			} else {
				response.setContentType("text/html;charset=utf-8");
				response.getWriter().print("发布失败");
			}
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

	
	}

	

	
}
最近下载更多
liyan54188  LV2 1月2日
微信网友_7280920824942592  LV1 2024年12月3日
吉吉jijiji  LV2 2024年6月17日
HY1234  LV1 2024年6月2日
xiaopengzep  LV1 2024年3月11日
婴儿早教打猫猫菇  LV2 2024年2月17日
liubojian  LV2 2024年1月3日
微信网友_6693238752481280  LV1 2023年10月15日
leighua  LV1 2023年6月8日
17771013609  LV4 2023年4月12日
最近浏览更多
没有啊很开心啊  LV4 3月7日
dongandmin  LV8 2月19日
liyan54188  LV2 1月2日
微信网友_7280920824942592  LV1 2024年12月3日
krispeng  LV14 2024年10月28日
微信网友_7211237575856128 2024年10月22日
暂无贡献等级
maoye520  LV1 2024年10月8日
799743530  LV11 2024年7月8日
吉吉jijiji  LV2 2024年6月17日
wangbh1234  LV1 2024年6月7日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友