新增员工业务逻辑,优化登录账号权限,更新设计文档
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
package com.cwhelp.modules.business.domain;
|
||||
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.common.utils.StatusUtil;
|
||||
import com.cwhelp.modules.system.domain.User;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.NotFound;
|
||||
import org.hibernate.annotations.NotFoundAction;
|
||||
import org.hibernate.annotations.Where;
|
||||
import org.springframework.data.annotation.CreatedBy;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedBy;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/07/29
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name="bss_dept")
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
@Where(clause = StatusUtil.notDelete)
|
||||
public class BssDept implements Serializable {
|
||||
// 主键ID
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String name;
|
||||
// 描述
|
||||
private String description;
|
||||
// 平台ID
|
||||
//@Column(name = "platform_id")
|
||||
//private Long platformId;
|
||||
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@NotFound(action=NotFoundAction.IGNORE)
|
||||
@JoinColumn(name="platform_id")
|
||||
@JsonIgnore
|
||||
private BssPlatform bssPlatform;
|
||||
|
||||
// 备注
|
||||
private String remark;
|
||||
// 创建时间
|
||||
@CreatedDate
|
||||
private Date createDate;
|
||||
// 更新时间
|
||||
@LastModifiedDate
|
||||
private Date updateDate;
|
||||
// 创建者
|
||||
@CreatedBy
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@NotFound(action=NotFoundAction.IGNORE)
|
||||
@JoinColumn(name="create_by")
|
||||
@JsonIgnore
|
||||
private User createBy;
|
||||
// 更新者
|
||||
@LastModifiedBy
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@NotFound(action=NotFoundAction.IGNORE)
|
||||
@JoinColumn(name="update_by")
|
||||
@JsonIgnore
|
||||
private User updateBy;
|
||||
// 数据状态
|
||||
private Byte status = StatusEnum.OK.getCode();
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.cwhelp.modules.business.domain;
|
||||
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.common.utils.StatusUtil;
|
||||
import com.cwhelp.modules.system.domain.User;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.NotFound;
|
||||
import org.hibernate.annotations.NotFoundAction;
|
||||
import org.hibernate.annotations.Where;
|
||||
import org.springframework.data.annotation.CreatedBy;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedBy;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/07/31
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name="bss_employee")
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
@Where(clause = StatusUtil.notDelete)
|
||||
public class BssEmployee implements Serializable {
|
||||
// 主键ID
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String name;
|
||||
// 部门
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@NotFound(action=NotFoundAction.IGNORE)
|
||||
@JoinColumn(name="dept_id")
|
||||
@JsonIgnore
|
||||
private BssDept bssDept;
|
||||
// 职位
|
||||
private String position;
|
||||
// 手机号码
|
||||
@Column(name = "phone_num")
|
||||
private String phoneNum;
|
||||
// 身份证号码
|
||||
private String card;
|
||||
// 邮箱
|
||||
private String email;
|
||||
// 员工状态
|
||||
@Column(name = "employee_status")
|
||||
private String employeeStatus;
|
||||
// 学历
|
||||
private String education;
|
||||
// 备注
|
||||
private String remark;
|
||||
// 创建时间
|
||||
@CreatedDate
|
||||
private Date createDate;
|
||||
// 更新时间
|
||||
@LastModifiedDate
|
||||
private Date updateDate;
|
||||
// 创建者
|
||||
@CreatedBy
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@NotFound(action=NotFoundAction.IGNORE)
|
||||
@JoinColumn(name="create_by")
|
||||
@JsonIgnore
|
||||
private User createBy;
|
||||
// 更新者
|
||||
@LastModifiedBy
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@NotFound(action=NotFoundAction.IGNORE)
|
||||
@JoinColumn(name="update_by")
|
||||
@JsonIgnore
|
||||
private User updateBy;
|
||||
// 数据状态
|
||||
private Byte status = StatusEnum.OK.getCode();
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.cwhelp.modules.business.domain;
|
||||
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.common.utils.StatusUtil;
|
||||
import com.cwhelp.modules.system.domain.User;
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.NotFound;
|
||||
import org.hibernate.annotations.NotFoundAction;
|
||||
import org.hibernate.annotations.Where;
|
||||
import org.springframework.data.annotation.CreatedBy;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedBy;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/07/28
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name="bss_platform")
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
@Where(clause = StatusUtil.notDelete)
|
||||
public class BssPlatform implements Serializable {
|
||||
// 主键ID
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String name;
|
||||
// 联系人
|
||||
private String contact;
|
||||
// 联系人电话
|
||||
@Column(name = "contact_tel")
|
||||
private String contactTel;
|
||||
// 联系人身份证号码
|
||||
@Column(name = "contact_card")
|
||||
private String contactCard;
|
||||
// 邮箱
|
||||
private String email;
|
||||
// 类型
|
||||
private Integer type;
|
||||
// 备注
|
||||
private String remark;
|
||||
// 创建时间
|
||||
@CreatedDate
|
||||
private Date createDate;
|
||||
// 更新时间
|
||||
@LastModifiedDate
|
||||
private Date updateDate;
|
||||
// 创建者
|
||||
@CreatedBy
|
||||
@JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class,property = "@id")
|
||||
@ManyToOne(fetch= FetchType.LAZY)
|
||||
@NotFound(action=NotFoundAction.IGNORE)
|
||||
@JoinColumn(name="create_by")
|
||||
@JsonIgnore
|
||||
private User createBy;
|
||||
// 更新者
|
||||
@LastModifiedBy
|
||||
@JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class,property = "@id")
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@NotFound(action=NotFoundAction.IGNORE)
|
||||
@JoinColumn(name="update_by")
|
||||
@JsonIgnore
|
||||
private User updateBy;
|
||||
// 数据状态
|
||||
private Byte status = StatusEnum.OK.getCode();
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.cwhelp.modules.business.repository;
|
||||
|
||||
import com.cwhelp.modules.business.domain.BssDept;
|
||||
import com.cwhelp.modules.system.repository.BaseRepository;
|
||||
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/07/29
|
||||
*/
|
||||
public interface BssDeptRepository extends BaseRepository<BssDept, Long> {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.cwhelp.modules.business.repository;
|
||||
|
||||
import com.cwhelp.modules.business.domain.BssEmployee;
|
||||
import com.cwhelp.modules.system.repository.BaseRepository;
|
||||
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/07/31
|
||||
*/
|
||||
public interface BssEmployeeRepository extends BaseRepository<BssEmployee, Long> {
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.cwhelp.modules.business.repository;
|
||||
|
||||
import com.cwhelp.modules.business.domain.BssPlatform;
|
||||
import com.cwhelp.modules.system.repository.BaseRepository;
|
||||
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/07/28
|
||||
*/
|
||||
public interface BssPlatformRepository extends BaseRepository<BssPlatform, Long>{
|
||||
|
||||
/**
|
||||
* 查询联系人手机号码 排除当前ID
|
||||
* @param contactTel 手机号码
|
||||
* @param id ID
|
||||
* @return
|
||||
*/
|
||||
BssPlatform findByContactTelAndIdNot(String contactTel,Long id);
|
||||
|
||||
/**
|
||||
* 查询联系人身份证号码 排除当前ID
|
||||
* @param contactCard 身份号码
|
||||
* @param id ID
|
||||
* @return
|
||||
*/
|
||||
BssPlatform findByContactCardAndIdNot(String contactCard,Long id);
|
||||
|
||||
/**
|
||||
* 查询企业邮箱 排除当前ID
|
||||
* @param email 企业邮箱
|
||||
* @param id ID
|
||||
* @return
|
||||
*/
|
||||
BssPlatform findByEmailAndIdNot(String email,Long id);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.cwhelp.modules.business.service;
|
||||
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.modules.business.domain.BssDept;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/07/29
|
||||
*/
|
||||
public interface BssDeptService {
|
||||
|
||||
/**
|
||||
* 获取分页列表数据
|
||||
* @param example 查询实例
|
||||
* @return 返回分页数据
|
||||
*/
|
||||
Page<BssDept> getPageList(Example<BssDept> example);
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
* @param id 主键ID
|
||||
*/
|
||||
BssDept getById(Long id);
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param bssDept 实体对象
|
||||
*/
|
||||
BssDept save(BssDept bssDept);
|
||||
|
||||
/**
|
||||
* 状态(启用,冻结,删除)/批量状态处理
|
||||
*/
|
||||
@Transactional
|
||||
Boolean updateStatus(StatusEnum statusEnum, List<Long> idList);
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.cwhelp.modules.business.service;
|
||||
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.modules.business.domain.BssEmployee;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/07/31
|
||||
*/
|
||||
public interface BssEmployeeService {
|
||||
|
||||
/**
|
||||
* 获取分页列表数据
|
||||
* @param example 查询实例
|
||||
* @return 返回分页数据
|
||||
*/
|
||||
Page<BssEmployee> getPageList(Example<BssEmployee> example);
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
* @param id 主键ID
|
||||
*/
|
||||
BssEmployee getById(Long id);
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param bssEmployee 实体对象
|
||||
*/
|
||||
BssEmployee save(BssEmployee bssEmployee);
|
||||
|
||||
/**
|
||||
* 状态(启用,冻结,删除)/批量状态处理
|
||||
*/
|
||||
@Transactional
|
||||
Boolean updateStatus(StatusEnum statusEnum, List<Long> idList);
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package com.cwhelp.modules.business.service;
|
||||
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.modules.business.domain.BssPlatform;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/07/28
|
||||
*/
|
||||
public interface BssPlatformService {
|
||||
|
||||
/**
|
||||
* 获取分页列表数据
|
||||
* @param example 查询实例
|
||||
* @return 返回分页数据
|
||||
*/
|
||||
Page<BssPlatform> getPageList(Example<BssPlatform> example);
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
* @param id 主键ID
|
||||
*/
|
||||
BssPlatform getById(Long id);
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param bssPlatform 实体对象
|
||||
*/
|
||||
BssPlatform save(BssPlatform bssPlatform);
|
||||
|
||||
/**
|
||||
* 状态(启用,冻结,删除)/批量状态处理
|
||||
*/
|
||||
@Transactional
|
||||
Boolean updateStatus(StatusEnum statusEnum, List<Long> idList);
|
||||
|
||||
/**
|
||||
* 获取平台列表数据
|
||||
* @param example 查询实例
|
||||
* @param sort 排序对象
|
||||
*/
|
||||
List<BssPlatform> getListByExample(Example<BssPlatform> example, Sort sort);
|
||||
|
||||
boolean repeatByContactTel(BssPlatform bssPlatform);
|
||||
boolean repeatByContactCard(BssPlatform bssPlatform);
|
||||
boolean repeatByEmail(BssPlatform bssPlatform);
|
||||
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.cwhelp.modules.business.service.impl;
|
||||
|
||||
import com.cwhelp.common.data.PageSort;
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.modules.business.domain.BssDept;
|
||||
import com.cwhelp.modules.business.repository.BssDeptRepository;
|
||||
import com.cwhelp.modules.business.service.BssDeptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/07/29
|
||||
*/
|
||||
@Service
|
||||
public class BssDeptServiceImpl implements BssDeptService {
|
||||
|
||||
@Autowired
|
||||
private BssDeptRepository bssDeptRepository;
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
* @param id 主键ID
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public BssDept getById(Long id) {
|
||||
return bssDeptRepository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页列表数据
|
||||
* @param example 查询实例
|
||||
* @return 返回分页数据
|
||||
*/
|
||||
@Override
|
||||
public Page<BssDept> getPageList(Example<BssDept> example) {
|
||||
// 创建分页对象
|
||||
PageRequest page = PageSort.pageRequest();
|
||||
return bssDeptRepository.findAll(example, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param bssDept 实体对象
|
||||
*/
|
||||
@Override
|
||||
public BssDept save(BssDept bssDept) {
|
||||
return bssDeptRepository.save(bssDept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态(启用,冻结,删除)/批量状态处理
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean updateStatus(StatusEnum statusEnum, List<Long> idList) {
|
||||
return bssDeptRepository.updateStatus(statusEnum.getCode(), idList) > 0;
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.cwhelp.modules.business.service.impl;
|
||||
|
||||
import com.cwhelp.common.data.PageSort;
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.modules.business.domain.BssEmployee;
|
||||
import com.cwhelp.modules.business.repository.BssEmployeeRepository;
|
||||
import com.cwhelp.modules.business.service.BssEmployeeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/07/31
|
||||
*/
|
||||
@Service
|
||||
public class BssEmployeeServiceImpl implements BssEmployeeService {
|
||||
|
||||
@Autowired
|
||||
private BssEmployeeRepository bssEmployeeRepository;
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
* @param id 主键ID
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public BssEmployee getById(Long id) {
|
||||
return bssEmployeeRepository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页列表数据
|
||||
* @param example 查询实例
|
||||
* @return 返回分页数据
|
||||
*/
|
||||
@Override
|
||||
public Page<BssEmployee> getPageList(Example<BssEmployee> example) {
|
||||
// 创建分页对象
|
||||
PageRequest page = PageSort.pageRequest();
|
||||
return bssEmployeeRepository.findAll(example, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param bssEmployee 实体对象
|
||||
*/
|
||||
@Override
|
||||
public BssEmployee save(BssEmployee bssEmployee) {
|
||||
return bssEmployeeRepository.save(bssEmployee);
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态(启用,冻结,删除)/批量状态处理
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean updateStatus(StatusEnum statusEnum, List<Long> idList) {
|
||||
return bssEmployeeRepository.updateStatus(statusEnum.getCode(), idList) > 0;
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.cwhelp.modules.business.service.impl;
|
||||
|
||||
import com.cwhelp.common.data.PageSort;
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.modules.business.domain.BssPlatform;
|
||||
import com.cwhelp.modules.business.repository.BssPlatformRepository;
|
||||
import com.cwhelp.modules.business.service.BssPlatformService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/07/28
|
||||
*/
|
||||
@Service
|
||||
public class BssPlatformServiceImpl implements BssPlatformService {
|
||||
|
||||
@Autowired
|
||||
private BssPlatformRepository bssPlatformRepository;
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
* @param id 主键ID
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public BssPlatform getById(Long id) {
|
||||
return bssPlatformRepository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页列表数据
|
||||
* @param example 查询实例
|
||||
* @return 返回分页数据
|
||||
*/
|
||||
@Override
|
||||
public Page<BssPlatform> getPageList(Example<BssPlatform> example) {
|
||||
// 创建分页对象
|
||||
PageRequest page = PageSort.pageRequest();
|
||||
return bssPlatformRepository.findAll(example, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param bssPlatform 实体对象
|
||||
*/
|
||||
@Override
|
||||
public BssPlatform save(BssPlatform bssPlatform) {
|
||||
return bssPlatformRepository.save(bssPlatform);
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态(启用,冻结,删除)/批量状态处理
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean updateStatus(StatusEnum statusEnum, List<Long> idList) {
|
||||
return bssPlatformRepository.updateStatus(statusEnum.getCode(), idList) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门列表数据
|
||||
* @param example 查询实例
|
||||
* @param sort 排序对象
|
||||
*/
|
||||
@Override
|
||||
public List<BssPlatform> getListByExample(Example<BssPlatform> example, Sort sort) {
|
||||
return bssPlatformRepository.findAll(example, sort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean repeatByContactTel(BssPlatform bssPlatform) {
|
||||
Long id = bssPlatform.getId() != null ? bssPlatform.getId() : Long.MIN_VALUE;
|
||||
return bssPlatformRepository.findByContactTelAndIdNot(bssPlatform.getContactTel(), id) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean repeatByContactCard(BssPlatform bssPlatform) {
|
||||
Long id = bssPlatform.getId() != null ? bssPlatform.getId() : Long.MIN_VALUE;
|
||||
return bssPlatformRepository.findByContactCardAndIdNot(bssPlatform.getContactCard(), id) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean repeatByEmail(BssPlatform bssPlatform) {
|
||||
Long id = bssPlatform.getId() != null ? bssPlatform.getId() : Long.MIN_VALUE;
|
||||
return bssPlatformRepository.findByEmailAndIdNot(bssPlatform.getEmail(), id) != null;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.cwhelp.modules.system.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.common.utils.StatusUtil;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.NotFound;
|
||||
import org.hibernate.annotations.NotFoundAction;
|
||||
import org.hibernate.annotations.Where;
|
||||
@@ -20,7 +21,8 @@ import java.util.Date;
|
||||
/**
|
||||
* @author yan.y
|
||||
*/
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name="sys_dept")
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.cwhelp.modules.system.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.common.utils.StatusUtil;
|
||||
import com.cwhelp.component.excel.annotation.Excel;
|
||||
import com.cwhelp.component.excel.enums.ExcelType;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
import com.cwhelp.modules.business.domain.BssPlatform;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
@@ -46,6 +45,7 @@ public class User implements Serializable {
|
||||
private String picture;
|
||||
@Excel(value = "性别", dict = "USER_SEX")
|
||||
private String sex;
|
||||
private String type;
|
||||
@Excel("手机号码")
|
||||
private String phone;
|
||||
@Excel("电子邮箱")
|
||||
@@ -66,6 +66,12 @@ public class User implements Serializable {
|
||||
@JsonIgnore
|
||||
private Dept dept;
|
||||
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@JoinColumn(name="bss_platform_id")
|
||||
@JsonIgnore
|
||||
private BssPlatform bssPlatform;
|
||||
|
||||
|
||||
@ManyToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "sys_user_role",
|
||||
joinColumns = @JoinColumn(name="user_id"),
|
||||
|
||||
+25
-1
@@ -2,6 +2,8 @@ package com.cwhelp.modules.system.service.impl;
|
||||
|
||||
import com.cwhelp.common.data.PageSort;
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.modules.business.domain.BssPlatform;
|
||||
import com.cwhelp.modules.business.repository.BssPlatformRepository;
|
||||
import com.cwhelp.modules.system.domain.Dept;
|
||||
import com.cwhelp.modules.system.domain.User;
|
||||
import com.cwhelp.modules.system.repository.UserRepository;
|
||||
@@ -31,6 +33,9 @@ public class UserServiceImpl implements UserService {
|
||||
@Autowired
|
||||
private DeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private BssPlatformRepository bssPlatformRepository;
|
||||
|
||||
/**
|
||||
* 根据用户名查询用户数据
|
||||
* @param username 用户名
|
||||
@@ -71,7 +76,6 @@ public class UserServiceImpl implements UserService {
|
||||
public Page<User> getPageList(User user) {
|
||||
// 创建分页对象
|
||||
PageRequest page = PageSort.pageRequest(Sort.Direction.ASC);
|
||||
|
||||
// 使用Specification复杂查询
|
||||
return userRepository.findAll(new Specification<User>(){
|
||||
|
||||
@@ -100,6 +104,26 @@ public class UserServiceImpl implements UserService {
|
||||
deptIn.forEach(in::value);
|
||||
preList.add(in);
|
||||
}
|
||||
// 1 为财务帮平台超级账号
|
||||
if (1 == user.getBssPlatform().getId()) {
|
||||
// 查询所有平台的账号
|
||||
BssPlatform bssPlatform = user.getBssPlatform();
|
||||
List<Long> bssPlatformIn = new ArrayList<>();
|
||||
bssPlatformIn.add(bssPlatform.getId());
|
||||
List<BssPlatform> bssPlatforms = bssPlatformRepository.findAll();
|
||||
bssPlatforms.forEach(item -> bssPlatformIn.add(item.getId()));
|
||||
|
||||
Join<User, BssPlatform> join = root.join("bssPlatform", JoinType.INNER);
|
||||
CriteriaBuilder.In<Long> in = cb.in(join.get("id").as(Long.class));
|
||||
bssPlatformIn.forEach(in::value);
|
||||
preList.add(in);
|
||||
} else {
|
||||
// 查询所有平台的账号
|
||||
BssPlatform bssPlatform = user.getBssPlatform();
|
||||
Join<User, BssPlatform> join = root.join("bssPlatform", JoinType.INNER);
|
||||
Predicate eq = cb.equal(join.get("id").as(Long.class),bssPlatform.getId());
|
||||
preList.add(eq);
|
||||
}
|
||||
|
||||
// 数据状态
|
||||
if(user.getStatus() != null){
|
||||
|
||||
Reference in New Issue
Block a user