diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java index 732e53ded..b74712528 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java @@ -1,12 +1,14 @@ package com.fuint.common.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuint.common.dto.AccountDto; import com.fuint.common.dto.AccountInfo; import com.fuint.common.service.AccountService; import com.fuint.common.service.StaffService; +import com.fuint.common.util.TokenUtil; import com.fuint.framework.annoation.OperationServiceLog; import com.fuint.framework.exception.BusinessCheckException; import com.fuint.framework.exception.BusinessRuntimeException; @@ -14,6 +16,8 @@ import com.fuint.framework.pagination.PaginationRequest; import com.fuint.framework.pagination.PaginationResponse; import com.fuint.repository.mapper.*; import com.fuint.repository.model.*; +import com.fuint.system.dept.entity.SysDept; +import com.fuint.system.dept.service.ISysDeptService; import com.fuint.utils.Digests; import com.fuint.utils.Encodes; import com.github.pagehelper.Page; @@ -21,6 +25,7 @@ import com.github.pagehelper.PageHelper; import org.apache.commons.lang.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageRequest; import org.springframework.stereotype.Service; @@ -57,7 +62,10 @@ public class AccountServiceImpl extends ServiceImpl im * 员工接口 */ @Autowired + @Lazy private StaffService staffService; + @Autowired + private ISysDeptService deptService; /** * 分页查询账号列表 @@ -120,7 +128,12 @@ public class AccountServiceImpl extends ServiceImpl im return paginationResponse; } - + @Override + public IPage listAccount(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, TAccount accountInfo) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + SysDept sysDept = deptService.selectDeptById(nowAccountInfo.getDeptId()); + return baseMapper.listAccount(page, accountInfo,sysDept.getAncestors()); + } @Override public AccountInfo getAccountByName(String userName) { Map param = new HashMap(); @@ -136,6 +149,7 @@ public class AccountServiceImpl extends ServiceImpl im accountInfo.setStaffId(account.getStaffId()); accountInfo.setStoreId(account.getStoreId()); accountInfo.setMerchantId(account.getMerchantId()); + accountInfo.setDeptId(account.getDeptId()); if (account.getMerchantId() != null && account.getMerchantId() > 0) { MtMerchant mtMerchant = mtMerchantMapper.selectById(account.getMerchantId()); if (mtMerchant != null) { @@ -178,8 +192,8 @@ public class AccountServiceImpl extends ServiceImpl im account.setStaffId(tAccount.getStaffId()); account.setMerchantId(tAccount.getMerchantId()); account.setStoreId(tAccount.getStoreId()); - account.setCreateDate(new Date()); - account.setModifyDate(new Date()); + account.setCreateTime(new Date()); + account.setUpdateTime(new Date()); account.setStoreId(tAccount.getStoreId()); account.setStaffId(tAccount.getStaffId()); account.setPassword(tAccount.getPassword()); @@ -228,7 +242,7 @@ public class AccountServiceImpl extends ServiceImpl im if (oldAccount == null) { throw new BusinessCheckException("账户不存在."); } - tAccount.setModifyDate(new Date()); + tAccount.setUpdateTime(new Date()); if (duties != null && duties.size() > 0) { if (tAccount.getAcctId() != null && tAccount.getAcctId() > 0) { tAccountDutyMapper.deleteDutiesByAccountId(tAccount.getAcctId()); @@ -283,7 +297,7 @@ public class AccountServiceImpl extends ServiceImpl im public void deleteAccount(Long userId) { TAccount tAccount = tAccountMapper.selectById(userId); tAccount.setAccountStatus(-1); - tAccount.setModifyDate(new Date()); + tAccount.setUpdateTime(new Date()); tAccountMapper.updateById(tAccount); } diff --git a/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/TAccount.java b/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/TAccount.java index cffb26f0d..9a01b9e1b 100644 --- a/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/TAccount.java +++ b/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/TAccount.java @@ -23,7 +23,7 @@ import lombok.Setter; @Setter @TableName("t_account") @ApiModel(value = "TAccount对象", description = "后台管理员表") -public class TAccount implements Serializable { +public class TAccount extends BaseEntity implements Serializable { private static final long serialVersionUID = 1L; @@ -75,10 +75,8 @@ public class TAccount implements Serializable { @ApiModelProperty("账户头像地址") private String avatar; - - @ApiModelProperty("创建用户") - private String createUser; - - @ApiModelProperty("修改用户") - private String updateUser; + //机构主键 + private Long deptId; + @TableField(exist = false) + private String deptName; }