@Entity
@Table(name = "sec_user")
public class User {
@Id
@GeneratedValue
private Integer id;
@Column(name = "name")
private String name;
@Column(name = "password")
private String password;
@Column(name = "username")
private String username;
@Column(name = "division_id")
private Integer divisionId;
@Column(name = "email")
private String email;
@Column(name = "gender")
private String gender;
@Column(name = "mobilephone")
private String mobilephone;
@Column(name = "telephone")
private String telephone;
@Column(name = "user_type")
private Integer userType;
@Column(name = "create_by")
private String createBy;
@Column(name = "create_time")
private Date createTime;
@Column(name = "update_by")
private String updateBy;
@Column(name = "update_time")
private Date updateTime;
@Column(name = "disabled")
private Integer disabled;
@Column(name = "theme")
private String theme;
@Column(name = "is_ldap")
private Integer isLdap;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@JsonIgnore
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Integer getDivisionId() {
return divisionId;
}
public void setDivisionId(Integer divisionId) {
this.divisionId = divisionId;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getMobilephone() {
return mobilephone;
}
public void setMobilephone(String mobilephone) {
this.mobilephone = mobilephone;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public Integer getUserType() {
return userType;
}
public void setUserType(Integer userType) {
this.userType = userType;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getDisabled() {
return disabled;
}
public void setDisabled(Integer disabled) {
this.disabled = disabled;
}
public String getTheme() {
return theme;
}
public void setTheme(String theme) {
this.theme = theme;
}
public Integer getIsLdap() {
return isLdap;
}
public void setIsLdap(Integer isLdap) {
this.isLdap = isLdap;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
编写spring data jpa的dao层:
/**
* The Interface UserJpaDao.
* @author abel
*/
public interface UserJpaDao extends JpaRepository {
/**
* Find by name.
*
* @param name the name
* @return the user
*/
User findByName(String name);
/**
* Find by name and user name.
* 如果参数名为多个字母组成,请首字母大写。勿使用驼峰命名,jpa不识别驼峰
* @param name the name
* @param age the age
* @return the user
*/
User findByNameAndUsername(String name, Integer age);
/**
* Find user.
* User为@Entity 的名字
* @param name the name
* @return the user
*/
@Query("from User u where u.name=:name")
User findUser(@Param("name") String name);
}
编写service层UserService:
/**
* The Interface UserService.
*/
public interface UserService {
/**
* Gets the user by name.
*
* @param username the user name
* @return the user by name
*/
public User getUserByName(String username);
}
编写service层的实现类UserServiceImpl:
/**
*
* @ClassName UserServiceImpl
* @author abel
* @date 2016年11月10日
*/
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserJpaDao userJpaDao;
/**
*
* @param UserName
* @return
*/
@Override
public User getUserByName(String username) {
return userJpaDao.findByName(username);
}
}
控制层注入业务bean:
/**
*
* @ClassName UserController
* @author abel
* @date 2016年11月10日
*/
@Controller
@RequestMapping(value = "/users")
public class UserController {
@Autowired
private UserService userService;
/**
* 通过spring data jpa 调用方法 api :localhost:8099/users/byname?username=xxx
*
* @param request
* @return
*/
@RequestMapping(value = "/byname", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity
在数据库系统中存储过程是必不可少的利器,存储过程是预先编译好的为实现一个复杂功能的一段Sql语句集合。它的优点我就不多说了,说一下我碰到的问题吧。我在项目开发的过程中需要用存储过程来实现一个功能,其中涉及到判断一张表是否已经建立,没有建立就由存储过程来建立这张表。
CREATE OR REPLACE PROCEDURE TestProc
IS
fla
使用jsonp不能发起POST请求。
It is not possible to make a JSONP POST request.
JSONP works by creating a <script> tag that executes Javascript from a different domain; it is not pos
(一)Keepalived
(1)安装
# cd /usr/local/src
# wget http://www.keepalived.org/software/keepalived-1.2.15.tar.gz
# tar zxvf keepalived-1.2.15.tar.gz
# cd keepalived-1.2.15
# ./configure
# make &a