// Path: src/main/java/com/lixiaocong/cms/entity/User.java
// @Entity(name = "User")
// public class User extends AbstractEntity {
//     @Column(nullable = false, unique = true)
//     private String username;
// 
//     @JsonIgnore
//     @Column(nullable = false)
//     private String password;
// 
//     @Column(nullable = false)
//     private boolean admin;
// 
//     @JsonIgnore
//     @OneToMany(mappedBy = "user", cascade = {CascadeType.REMOVE})
//     private Set<Article> articles;
// 
//     @JsonIgnore
//     @OneToMany(mappedBy = "user", cascade = {CascadeType.REMOVE})
//     private Set<Comment> comments;
// 
//     public User() {
//         admin = false;
//         articles = new HashSet<>();
//         comments = new HashSet<>();
//     }
// 
//     public User(String username, String password) {
//         admin = false;
//         articles = new HashSet<>();
//         comments = new HashSet<>();
// 
//         this.username = username;
//         this.password = password;
//     }
// 
//     public Set<Comment> getComments() {
//         return comments;
//     }
// 
//     public void setComments(Set<Comment> comments) {
//         this.comments = comments;
//     }
// 
//     public Set<Article> getArticles() {
//         return articles;
//     }
// 
//     public void setArticles(Set<Article> articles) {
//         this.articles = articles;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public void setUsername(String username) {
//         this.username = username;
//     }
// 
//     public String getPassword() {
//         return password;
//     }
// 
//     public void setPassword(String password) {
//         this.password = password;
//     }
// 
//     public boolean isAdmin() {
//         return admin;
//     }
// 
//     public void setAdmin(boolean admin) {
//         this.admin = admin;
//     }
// }
// 
// Path: src/main/java/com/lixiaocong/cms/repository/IUserRepository.java
// public interface IUserRepository extends JpaRepository<User, Long> {
//     User findByUsername(String username);
// }
// 
// Path: src/main/java/com/lixiaocong/cms/service/IUserService.java
// public interface IUserService {
//     User create(String username, String password);
// 
//     void delete(long id);
// 
//     void update(User user);
// 
//     User get(long id);
// 
//     Page<User> get(int page, int size);
// 
//     User getByUsername(String username);
// }


import com.lixiaocong.cms.entity.User;
import com.lixiaocong.cms.repository.IUserRepository;
import com.lixiaocong.cms.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
/*
  BSD 3-Clause License

  Copyright (c) 2016, lixiaocong(lxccs@iCloud.com)
  All rights reserved.

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:

  * Redistributions of source code must retain the above copyright notice, this
    list of conditions and the following disclaimer.

  * Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.

  * Neither the name of the copyright holder nor the names of its
    contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package com.lixiaocong.cms.service.impl;



@Service
@Transactional
// Path: src/main/java/com/lixiaocong/cms/entity/User.java
// @Entity(name = "User")
// public class User extends AbstractEntity {
//     @Column(nullable = false, unique = true)
//     private String username;
// 
//     @JsonIgnore
//     @Column(nullable = false)
//     private String password;
// 
//     @Column(nullable = false)
//     private boolean admin;
// 
//     @JsonIgnore
//     @OneToMany(mappedBy = "user", cascade = {CascadeType.REMOVE})
//     private Set<Article> articles;
// 
//     @JsonIgnore
//     @OneToMany(mappedBy = "user", cascade = {CascadeType.REMOVE})
//     private Set<Comment> comments;
// 
//     public User() {
//         admin = false;
//         articles = new HashSet<>();
//         comments = new HashSet<>();
//     }
// 
//     public User(String username, String password) {
//         admin = false;
//         articles = new HashSet<>();
//         comments = new HashSet<>();
// 
//         this.username = username;
//         this.password = password;
//     }
// 
//     public Set<Comment> getComments() {
//         return comments;
//     }
// 
//     public void setComments(Set<Comment> comments) {
//         this.comments = comments;
//     }
// 
//     public Set<Article> getArticles() {
//         return articles;
//     }
// 
//     public void setArticles(Set<Article> articles) {
//         this.articles = articles;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public void setUsername(String username) {
//         this.username = username;
//     }
// 
//     public String getPassword() {
//         return password;
//     }
// 
//     public void setPassword(String password) {
//         this.password = password;
//     }
// 
//     public boolean isAdmin() {
//         return admin;
//     }
// 
//     public void setAdmin(boolean admin) {
//         this.admin = admin;
//     }
// }
// 
// Path: src/main/java/com/lixiaocong/cms/repository/IUserRepository.java
// public interface IUserRepository extends JpaRepository<User, Long> {
//     User findByUsername(String username);
// }
// 
// Path: src/main/java/com/lixiaocong/cms/service/IUserService.java
// public interface IUserService {
//     User create(String username, String password);
// 
//     void delete(long id);
// 
//     void update(User user);
// 
//     User get(long id);
// 
//     Page<User> get(int page, int size);
// 
//     User getByUsername(String username);
// }


// Path: src/main/java/com/lixiaocong/cms/service/impl/UserServiceImpl.java
import com.lixiaocong.cms.entity.User;
import com.lixiaocong.cms.repository.IUserRepository;
import com.lixiaocong.cms.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;

/*
  BSD 3-Clause License

  Copyright (c) 2016, lixiaocong(lxccs@iCloud.com)
  All rights reserved.

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:

  * Redistributions of source code must retain the above copyright notice, this
    list of conditions and the following disclaimer.

  * Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.

  * Neither the name of the copyright holder nor the names of its
    contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package com.lixiaocong.cms.service.impl;



@Service
@Transactional
public class UserServiceImpl implements IUserService {