Commit 9ab6492f authored by 刘文胜's avatar 刘文胜

加入跨域过滤器,修改entity的属性名为驼峰命名

parent 1119ed51
/**
* @Title: WorksController.java
* @Package com.hdp.customerservice.api.admin
* @Description: TODO
* @author new12304508_163_com
* @date 2015年6月17日 下午5:01:31
* @version V1.0
*/
package com.hdp.customerservice.api.admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.hdp.customerservice.dto.DTO;
import com.hdp.customerservice.model.WorksEntity;
import com.hdp.customerservice.service.WorksService;
@Controller
@RequestMapping("/admin/customerservice/worker")
public class WorksController {
@Autowired
private WorksService worksService;
@RequestMapping(value = "", method = RequestMethod.POST)
@ResponseBody
public String save(@RequestBody WorksEntity entity){
DTO dto = DTO.newDTO();
dto.data=worksService.save(entity);
return dto.toJson();
}
@RequestMapping(value = "/pageList", method = RequestMethod.GET)
@ResponseBody
public String pageList(@RequestParam(value = "pageNo", defaultValue = "1", required = false) Integer page,
@RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer size){
DTO dto = DTO.newDTO();
dto.data=worksService.findPage(page, size);
return dto.toJson();
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public String getWorkById(@PathVariable Long id){
DTO dto = DTO.newDTO();
dto.data=worksService.get(id);
return dto.toJson();
}
@RequestMapping(value = "/{id}/status", method = RequestMethod.PUT)
@ResponseBody
public String updateStatus(@PathVariable Long id,Integer status){
DTO dto = DTO.newDTO();
dto.data=worksService.get(id);
return dto.toJson();
}
}
package com.hdp.customerservice.dto;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
public class DTO {
@JSONField(name = "errcode")
public Integer errCode = 0 ;
@JSONField(name = "errmsg")
public String errMsg = "success";
public Object data;
public static DTO newDTO(){
return new DTO();
}
public String toJson(){
return JSON.toJSONString(this);
}
}
/**
*
*/
package com.hdp.customerservice.dto;
/**
* @author yangyw
*
*/
public class PageDTO extends DTO {
}
package com.hdp.customerservice.filter;
/**
* @Title: CORSFilter.java
* @Package com.hdp.pi.api
* @Description: TODO
* @author new12304508_163_com
* @date 2015年5月29日 下午1:38:58
* @version V1.0
*/
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Component;
@Component
public class CORSFilter implements Filter {
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletResponse response = (HttpServletResponse) res;
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "POST, PUT, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "7200");
response.setHeader("Access-Control-Allow-Headers", "Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With");
chain.doFilter(req, res);
}
public void init(FilterConfig filterConfig) {}
public void destroy() {}
}
package com.hdp.customerservice.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
......@@ -20,7 +23,7 @@ public class HistoryEntity implements java.io.Serializable {
/** */
@Id
@Column(name = "id", unique = true, nullable = false, length = 19)
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
/** */
......@@ -29,11 +32,11 @@ public class HistoryEntity implements java.io.Serializable {
/** */
@Column(name = "openid", nullable = false, length = 64)
private String openid;
private String openId;
/** */
@Column(name = "workid", nullable = false, length = 19)
private Long workid;
private Long workId;
/** */
@Column(name = "content", nullable = true, length = 65535)
......@@ -57,7 +60,7 @@ public class HistoryEntity implements java.io.Serializable {
/** */
@Column(name = "createat", nullable = false)
private Date createat;
private Date createAt;
/**
* 获取
......@@ -102,8 +105,8 @@ public class HistoryEntity implements java.io.Serializable {
*
* @return
*/
public String getOpenid() {
return this.openid;
public String getOpenId() {
return this.openId;
}
/**
......@@ -112,8 +115,8 @@ public class HistoryEntity implements java.io.Serializable {
* @param openid
*
*/
public void setOpenid(String openid) {
this.openid = openid;
public void setOpenId(String openId) {
this.openId = openId;
}
/**
......@@ -121,8 +124,8 @@ public class HistoryEntity implements java.io.Serializable {
*
* @return
*/
public Long getWorkid() {
return this.workid;
public Long getWorkId() {
return this.workId;
}
/**
......@@ -131,8 +134,8 @@ public class HistoryEntity implements java.io.Serializable {
* @param workid
*
*/
public void setWorkid(Long workid) {
this.workid = workid;
public void setWorkId(Long workId) {
this.workId = workId;
}
/**
......@@ -235,8 +238,8 @@ public class HistoryEntity implements java.io.Serializable {
*
* @return
*/
public Date getCreateat() {
return this.createat;
public Date getCreateAt() {
return this.createAt;
}
/**
......@@ -245,7 +248,7 @@ public class HistoryEntity implements java.io.Serializable {
* @param createat
*
*/
public void setCreateat(Date createat) {
this.createat = createat;
public void setCreateAt(Date createAt) {
this.createAt = createAt;
}
}
\ No newline at end of file
package com.hdp.customerservice.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
......@@ -20,12 +23,12 @@ public class MemberEntity implements java.io.Serializable {
/** */
@Id
@Column(name = "id", unique = true, nullable = false, length = 19)
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
/** */
@Column(name = "appid", nullable = false, length = 128)
private String appid;
private String appId;
/** */
@Column(name = "ent_code", nullable = false, length = 10)
......@@ -33,15 +36,15 @@ public class MemberEntity implements java.io.Serializable {
/** */
@Column(name = "openid", nullable = false, length = 32)
private String openid;
private String openId;
/** */
@Column(name = "headimg", nullable = true, length = 512)
private String headimg;
private String headImg;
/** */
@Column(name = "nickname", nullable = true, length = 128)
private String nickname;
private String nickName;
/** */
@Column(name = "country", nullable = true, length = 64)
......@@ -57,7 +60,7 @@ public class MemberEntity implements java.io.Serializable {
/** */
@Column(name = "groupid", nullable = true, length = 10)
private Integer groupid;
private Integer groupId;
/** */
@Column(name = "language", nullable = true, length = 32)
......@@ -99,8 +102,8 @@ public class MemberEntity implements java.io.Serializable {
*
* @return
*/
public String getAppid() {
return this.appid;
public String getAppId() {
return this.appId;
}
/**
......@@ -109,8 +112,8 @@ public class MemberEntity implements java.io.Serializable {
* @param appid
*
*/
public void setAppid(String appid) {
this.appid = appid;
public void setAppId(String appId) {
this.appId = appId;
}
/**
......@@ -137,8 +140,8 @@ public class MemberEntity implements java.io.Serializable {
*
* @return
*/
public String getOpenid() {
return this.openid;
public String getOpenId() {
return this.openId;
}
/**
......@@ -147,8 +150,8 @@ public class MemberEntity implements java.io.Serializable {
* @param openid
*
*/
public void setOpenid(String openid) {
this.openid = openid;
public void setOpenId(String openId) {
this.openId = openId;
}
/**
......@@ -156,8 +159,8 @@ public class MemberEntity implements java.io.Serializable {
*
* @return
*/
public String getHeadimg() {
return this.headimg;
public String getHeadImg() {
return this.headImg;
}
/**
......@@ -166,8 +169,8 @@ public class MemberEntity implements java.io.Serializable {
* @param headimg
*
*/
public void setHeadimg(String headimg) {
this.headimg = headimg;
public void setHeadImg(String headImg) {
this.headImg = headImg;
}
/**
......@@ -175,8 +178,8 @@ public class MemberEntity implements java.io.Serializable {
*
* @return
*/
public String getNickname() {
return this.nickname;
public String getNickName() {
return this.nickName;
}
/**
......@@ -185,8 +188,8 @@ public class MemberEntity implements java.io.Serializable {
* @param nickname
*
*/
public void setNickname(String nickname) {
this.nickname = nickname;
public void setNickname(String nickName) {
this.nickName = nickName;
}
/**
......@@ -251,8 +254,8 @@ public class MemberEntity implements java.io.Serializable {
*
* @return
*/
public Integer getGroupid() {
return this.groupid;
public Integer getGroupId() {
return this.groupId;
}
/**
......@@ -261,8 +264,8 @@ public class MemberEntity implements java.io.Serializable {
* @param groupid
*
*/
public void setGroupid(Integer groupid) {
this.groupid = groupid;
public void setGroupId(Integer groupId) {
this.groupId = groupId;
}
/**
......
......@@ -2,6 +2,8 @@ package com.hdp.customerservice.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
......@@ -19,7 +21,7 @@ public class MemberTagEntity implements java.io.Serializable {
/** */
@Id
@Column(name = "id", unique = true, nullable = false, length = 19)
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
/** */
......@@ -28,7 +30,7 @@ public class MemberTagEntity implements java.io.Serializable {
/** */
@Column(name = "workid", nullable = false, length = 19)
private Long workid;
private Long workId;
/** */
@Column(name = "mid", nullable = false, length = 19)
......@@ -81,8 +83,8 @@ public class MemberTagEntity implements java.io.Serializable {
*
* @return
*/
public Long getWorkid() {
return this.workid;
public Long getWorkId() {
return this.workId;
}
/**
......@@ -91,8 +93,8 @@ public class MemberTagEntity implements java.io.Serializable {
* @param workid
*
*/
public void setWorkid(Long workid) {
this.workid = workid;
public void setWorkId(Long workId) {
this.workId = workId;
}
/**
......
package com.hdp.customerservice.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
......@@ -20,7 +23,7 @@ public class ReceptionHistoryEntity implements java.io.Serializable {
/** */
@Id
@Column(name = "id", unique = true, nullable = false, length = 19)
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
/** */
......@@ -29,7 +32,7 @@ public class ReceptionHistoryEntity implements java.io.Serializable {
/** */
@Column(name = "workid", nullable = false, length = 19)
private Long workid;
private Long workId;
/** */
@Column(name = "mid", nullable = false, length = 19)
......@@ -49,7 +52,7 @@ public class ReceptionHistoryEntity implements java.io.Serializable {
/** */
@Column(name = "createat", nullable = false)
private Date createat;
private Date createAt;
/**
* 获取
......@@ -94,8 +97,8 @@ public class ReceptionHistoryEntity implements java.io.Serializable {
*
* @return
*/
public Long getWorkid() {
return this.workid;
public Long getWorkId() {
return this.workId;
}
/**
......@@ -104,8 +107,8 @@ public class ReceptionHistoryEntity implements java.io.Serializable {
* @param workid
*
*/
public void setWorkid(Long workid) {
this.workid = workid;
public void setWorkId(Long workId) {
this.workId = workId;
}
/**
......@@ -189,8 +192,8 @@ public class ReceptionHistoryEntity implements java.io.Serializable {
*
* @return
*/
public Date getCreateat() {
return this.createat;
public Date getCreateAt() {
return this.createAt;
}
/**
......@@ -199,7 +202,7 @@ public class ReceptionHistoryEntity implements java.io.Serializable {
* @param createat
*
*/
public void setCreateat(Date createat) {
this.createat = createat;
public void setCreateAt(Date createAt) {
this.createAt = createAt;
}
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package com.hdp.customerservice.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
......@@ -19,7 +21,7 @@ public class ReceptionSettingEntity implements java.io.Serializable {
/** */
@Id
@Column(name = "id", unique = true, nullable = false, length = 19)
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
/** */
......@@ -28,7 +30,7 @@ public class ReceptionSettingEntity implements java.io.Serializable {
/** */
@Column(name = "workid", nullable = false, length = 19)
private Long workid;
private Long workId;
/** */
@Column(name = "mid", nullable = false, length = 19)
......@@ -77,8 +79,8 @@ public class ReceptionSettingEntity implements java.io.Serializable {
*
* @return
*/
public Long getWorkid() {
return this.workid;
public Long getWorkId() {
return this.workId;
}
/**
......@@ -87,8 +89,8 @@ public class ReceptionSettingEntity implements java.io.Serializable {
* @param workid
*
*/
public void setWorkid(Long workid) {
this.workid = workid;
public void setWorkId(Long workId) {
this.workId = workId;
}
/**
......
......@@ -2,6 +2,8 @@ package com.hdp.customerservice.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
......@@ -19,7 +21,7 @@ public class WorkWeightSettingEntity implements java.io.Serializable {
/** */
@Id
@Column(name = "id", unique = true, nullable = false, length = 19)
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
/** */
......@@ -28,7 +30,7 @@ public class WorkWeightSettingEntity implements java.io.Serializable {
/** */
@Column(name = "workid", nullable = false, length = 19)
private Long workid;
private Long workId;
/** */
@Column(name = "weight", nullable = false, length = 10)
......@@ -77,8 +79,8 @@ public class WorkWeightSettingEntity implements java.io.Serializable {
*
* @return
*/
public Long getWorkid() {
return this.workid;
public Long getWorkId() {
return this.workId;
}
/**
......@@ -87,8 +89,8 @@ public class WorkWeightSettingEntity implements java.io.Serializable {
* @param workid
*
*/
public void setWorkid(Long workid) {
this.workid = workid;
public void setWorkId(Long workId) {
this.workId = workId;
}
/**
......
......@@ -2,6 +2,8 @@ package com.hdp.customerservice.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
......@@ -19,7 +21,7 @@ public class WorksEntity implements java.io.Serializable {
/** */
@Id
@Column(name = "id", unique = true, nullable = false, length = 19)
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
/** */
......@@ -28,7 +30,7 @@ public class WorksEntity implements java.io.Serializable {
/** */
@Column(name = "username", nullable = false, length = 128)
private String username;
private String userName;
/** */
@Column(name = "pwd", nullable = false, length = 128)
......@@ -36,11 +38,11 @@ public class WorksEntity implements java.io.Serializable {
/** */
@Column(name = "nickname", nullable = true, length = 128)
private String nickname;
private String nickName;
/** */
@Column(name = "headimg", nullable = true, length = 512)
private String headimg;
private String headImg;
/** */
@Column(name = "status", nullable = false, length = 10)
......@@ -89,8 +91,8 @@ public class WorksEntity implements java.io.Serializable {
*
* @return
*/
public String getUsername() {
return this.username;
public String getUserName() {
return this.userName;
}
/**
......@@ -99,8 +101,8 @@ public class WorksEntity implements java.io.Serializable {
* @param username
*
*/
public void setUsername(String username) {
this.username = username;
public void setUserName(String userName) {
this.userName = userName;
}
/**
......@@ -127,8 +129,8 @@ public class WorksEntity implements java.io.Serializable {
*
* @return
*/
public String getNickname() {
return this.nickname;
public String getNickName() {
return this.nickName;
}
/**
......@@ -137,8 +139,8 @@ public class WorksEntity implements java.io.Serializable {
* @param nickname
*
*/
public void setNickname(String nickname) {
this.nickname = nickname;
public void setNickName(String nickName) {
this.nickName = nickName;
}
/**
......@@ -146,8 +148,8 @@ public class WorksEntity implements java.io.Serializable {
*
* @return
*/
public String getHeadimg() {
return this.headimg;
public String getHeadImg() {
return this.headImg;
}
/**
......@@ -156,8 +158,8 @@ public class WorksEntity implements java.io.Serializable {
* @param headimg
*
*/
public void setHeadimg(String headimg) {
this.headimg = headimg;
public void setHeadImg(String headImg) {
this.headImg = headImg;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment