From ceddee9e85e2082473592c9dc6d84a9c541e6c5e Mon Sep 17 00:00:00 2001 From: 13405411873 <1994398261@qq.com> Date: Wed, 11 Oct 2023 13:22:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configure/dev/application.properties | 2 +- fuintBackend/fuint-application/pom.xml | 4 + .../controller/ChainStoreInfoController.java | 88 +++++ .../business/store/entity/ChainStoreInfo.java | 127 ++++++++ .../store/mapper/ChainStoreInfoMapper.java | 15 + .../store/mapper/xml/ChainStoreInfoMapper.xml | 6 + .../store/service/ChainStoreInfoService.java | 15 + .../impl/ChainStoreInfoServiceImpl.java | 19 ++ .../com/fuint/common/domain/TreeSelect.java | 12 +- .../com/fuint/common/dto/AccountInfo.java | 5 +- .../fuint/common/service/AccountService.java | 3 + .../service/impl/AccountServiceImpl.java | 22 +- .../dept/controller/SysDeptController.java | 126 ++++++++ .../com/fuint/system/dept/entity/SysDept.java | 64 ++++ .../system/dept/mapper/SysDeptMapper.java | 120 +++++++ .../system/dept/mapper/xml/SysDeptMapper.xml | 140 ++++++++ .../system/dept/service/ISysDeptService.java | 114 +++++++ .../dept/service/impl/SysDeptServiceImpl.java | 304 ++++++++++++++++++ .../controller/SysDictDataController.java | 2 +- .../controller/SysDictTypeController.java | 2 +- .../com/fuint/system/dict/util/DictUtils.java | 4 +- .../controller/BackendAccountController.java | 54 +--- .../exception/GlobalExceptionHandler.java | 2 +- .../fuint/framework/web/BaseController.java | 9 + .../repository/mapper/TAccountMapper.java | 5 +- .../com/fuint/repository/model/TAccount.java | 21 +- .../main/resources/mapper/TAccountMapper.xml | 18 ++ 27 files changed, 1233 insertions(+), 70 deletions(-) create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/store/controller/ChainStoreInfoController.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/store/entity/ChainStoreInfo.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/ChainStoreInfoMapper.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/xml/ChainStoreInfoMapper.xml create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/ChainStoreInfoService.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/impl/ChainStoreInfoServiceImpl.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/controller/SysDeptController.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/entity/SysDept.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/mapper/SysDeptMapper.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/mapper/xml/SysDeptMapper.xml create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/ISysDeptService.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/impl/SysDeptServiceImpl.java rename fuintBackend/fuint-application/src/main/java/com/fuint/{module/backendApi => system/user}/controller/BackendAccountController.java (85%) diff --git a/fuintBackend/configure/dev/application.properties b/fuintBackend/configure/dev/application.properties index e3e904661..0cbce30b1 100644 --- a/fuintBackend/configure/dev/application.properties +++ b/fuintBackend/configure/dev/application.properties @@ -26,7 +26,7 @@ spring.redis.pool.min-idle=0 spring.redis.timeout=5000 # 系统名称 -system.name = fuint会员营销管理系统 +system.name = 蓝鲸智慧油站系统 # 前端h5地址 website.url=https://www.fuint.cn/h5/ diff --git a/fuintBackend/fuint-application/pom.xml b/fuintBackend/fuint-application/pom.xml index 595f8bc21..04724c120 100644 --- a/fuintBackend/fuint-application/pom.xml +++ b/fuintBackend/fuint-application/pom.xml @@ -126,6 +126,10 @@ IJPay-AliPay 2.9.6 + + org.springframework.boot + spring-boot-starter-validation + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/controller/ChainStoreInfoController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/controller/ChainStoreInfoController.java new file mode 100644 index 000000000..7ab800a4c --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/controller/ChainStoreInfoController.java @@ -0,0 +1,88 @@ +package com.fuint.business.store.controller; + + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.api.ApiController; +import com.baomidou.mybatisplus.extension.api.R; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.store.entity.ChainStoreInfo; +import com.fuint.business.store.service.ChainStoreInfoService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.io.Serializable; +import java.util.List; + +/** + * (ChainStoreInfo)表控制层 + * + * @author makejava + * @since 2023-10-11 13:17:02 + */ +@RestController +@RequestMapping("chainStoreInfo") +public class ChainStoreInfoController extends ApiController { + /** + * 服务对象 + */ + @Resource + private ChainStoreInfoService chainStoreInfoService; + + /** + * 分页查询所有数据 + * + * @param page 分页对象 + * @param chainStoreInfo 查询实体 + * @return 所有数据 + */ + @GetMapping + public R selectAll(Page page, ChainStoreInfo chainStoreInfo) { + return success(this.chainStoreInfoService.page(page, new QueryWrapper<>(chainStoreInfo))); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + public R selectOne(@PathVariable Serializable id) { + return success(this.chainStoreInfoService.getById(id)); + } + + /** + * 新增数据 + * + * @param chainStoreInfo 实体对象 + * @return 新增结果 + */ + @PostMapping + public R insert(@RequestBody ChainStoreInfo chainStoreInfo) { + return success(this.chainStoreInfoService.save(chainStoreInfo)); + } + + /** + * 修改数据 + * + * @param chainStoreInfo 实体对象 + * @return 修改结果 + */ + @PutMapping + public R update(@RequestBody ChainStoreInfo chainStoreInfo) { + return success(this.chainStoreInfoService.updateById(chainStoreInfo)); + } + + /** + * 删除数据 + * + * @param idList 主键结合 + * @return 删除结果 + */ + @DeleteMapping + public R delete(@RequestParam("idList") List idList) { + return success(this.chainStoreInfoService.removeByIds(idList)); + } +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/entity/ChainStoreInfo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/entity/ChainStoreInfo.java new file mode 100644 index 000000000..585249acb --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/entity/ChainStoreInfo.java @@ -0,0 +1,127 @@ +package com.fuint.business.store.entity; + +import java.util.Date; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import java.io.Serializable; + +/** + * (ChainStoreInfo)表实体类 + * + * @author makejava + * @since 2023-10-11 13:17:02 + */ +@SuppressWarnings("serial") +public class ChainStoreInfo extends Model { + //主键 + private Integer id; + //连锁店名称 + private String storeName; + //总店地址 + private String storeAddress; + //总店联系方式 + private String storePhone; + //总店经度 + private String storeLat; + //总店纬度 + private String storeLng; + //创建时间 + private Date createTime; + //创建人 + private String createBy; + //更新时间 + private Date updateTime; + //更新人 + private String updateBy; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getStoreName() { + return storeName; + } + + public void setStoreName(String storeName) { + this.storeName = storeName; + } + + public String getStoreAddress() { + return storeAddress; + } + + public void setStoreAddress(String storeAddress) { + this.storeAddress = storeAddress; + } + + public String getStorePhone() { + return storePhone; + } + + public void setStorePhone(String storePhone) { + this.storePhone = storePhone; + } + + public String getStoreLat() { + return storeLat; + } + + public void setStoreLat(String storeLat) { + this.storeLat = storeLat; + } + + public String getStoreLng() { + return storeLng; + } + + public void setStoreLng(String storeLng) { + this.storeLng = storeLng; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + /** + * 获取主键值 + * + * @return 主键值 + */ + @Override + protected Serializable pkVal() { + return this.id; + } + } + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/ChainStoreInfoMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/ChainStoreInfoMapper.java new file mode 100644 index 000000000..75ebef240 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/ChainStoreInfoMapper.java @@ -0,0 +1,15 @@ +package com.fuint.business.store.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fuint.business.store.entity.ChainStoreInfo; + +/** + * (ChainStoreInfo)表数据库访问层 + * + * @author makejava + * @since 2023-10-11 13:17:02 + */ +public interface ChainStoreInfoMapper extends BaseMapper { + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/xml/ChainStoreInfoMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/xml/ChainStoreInfoMapper.xml new file mode 100644 index 000000000..db07839ef --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/xml/ChainStoreInfoMapper.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/ChainStoreInfoService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/ChainStoreInfoService.java new file mode 100644 index 000000000..9fdd76c37 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/ChainStoreInfoService.java @@ -0,0 +1,15 @@ +package com.fuint.business.store.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.fuint.business.store.entity.ChainStoreInfo; + +/** + * (ChainStoreInfo)表服务接口 + * + * @author makejava + * @since 2023-10-11 13:17:02 + */ +public interface ChainStoreInfoService extends IService { + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/impl/ChainStoreInfoServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/impl/ChainStoreInfoServiceImpl.java new file mode 100644 index 000000000..aa8425d81 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/impl/ChainStoreInfoServiceImpl.java @@ -0,0 +1,19 @@ +package com.fuint.business.store.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.store.mapper.ChainStoreInfoMapper; +import com.fuint.business.store.entity.ChainStoreInfo; +import com.fuint.business.store.service.ChainStoreInfoService; +import org.springframework.stereotype.Service; + +/** + * (ChainStoreInfo)表服务实现类 + * + * @author makejava + * @since 2023-10-11 13:17:02 + */ +@Service("chainStoreInfoService") +public class ChainStoreInfoServiceImpl extends ServiceImpl implements ChainStoreInfoService { + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/domain/TreeSelect.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/domain/TreeSelect.java index afdebfbbf..9b55470b1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/domain/TreeSelect.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/domain/TreeSelect.java @@ -4,6 +4,7 @@ import java.io.Serializable; import java.util.List; import java.util.stream.Collectors; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fuint.system.dept.entity.SysDept; /** * TreeSelect树结构实体类 @@ -25,10 +26,17 @@ public class TreeSelect implements Serializable { @JsonInclude(JsonInclude.Include.NON_EMPTY) private List childrens; - public TreeSelect() { - // empty + public TreeSelect() + { + } + public TreeSelect(SysDept dept) + { + this.id = dept.getDeptId(); + this.label = dept.getDeptName(); + this.childrens = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + } public TreeSelect(TreeNode menu) { this.id = menu.getId(); this.label = menu.getName(); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/AccountInfo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/AccountInfo.java index cefebc1d5..0db3ed557 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/AccountInfo.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/AccountInfo.java @@ -1,5 +1,6 @@ package com.fuint.common.dto; +import com.fuint.framework.entity.BaseEntity; import lombok.Data; import java.io.Serializable; import java.util.Date; @@ -11,7 +12,7 @@ import java.util.Date; * CopyRight https://www.fuint.cn */ @Data -public class AccountInfo implements Serializable { +public class AccountInfo implements Serializable { private Integer id; private String accountKey; @@ -30,6 +31,8 @@ public class AccountInfo implements Serializable { private Integer storeId; private String storeName; private Integer staffId; + //部门主键 + private Long deptId; private String token; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/AccountService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/AccountService.java index 062beab37..c6ead09d5 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/AccountService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/AccountService.java @@ -1,5 +1,7 @@ package com.fuint.common.service; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.fuint.common.dto.AccountDto; import com.fuint.common.dto.AccountInfo; @@ -25,6 +27,7 @@ public interface AccountService extends IService { * @return */ PaginationResponse getAccountListByPagination(PaginationRequest paginationRequest) throws BusinessCheckException; + IPage listAccount(Page page,TAccount accountInfo); /** * 根据用户名获取用户对象 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..35a53abfa 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; @@ -58,6 +62,8 @@ public class AccountServiceImpl extends ServiceImpl im */ @Autowired private StaffService staffService; + @Autowired + private ISysDeptService deptService; /** * 分页查询账号列表 @@ -121,6 +127,13 @@ 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-application/src/main/java/com/fuint/system/dept/controller/SysDeptController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/controller/SysDeptController.java new file mode 100644 index 000000000..971d6b153 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/controller/SysDeptController.java @@ -0,0 +1,126 @@ +package com.fuint.system.dept.controller; + + +import com.fuint.common.constant.UserConstants; +import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.StringUtils; +import com.fuint.common.util.TokenUtil; +import com.fuint.framework.web.BaseController; +import com.fuint.framework.web.ResponseObject; +import com.fuint.system.dept.entity.SysDept; +import com.fuint.system.dept.service.ISysDeptService; +import lombok.extern.java.Log; +import org.apache.commons.lang3.ArrayUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 部门信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/dept") +public class SysDeptController extends BaseController +{ + @Autowired + private ISysDeptService deptService; + + /** + * 获取部门列表 + */ + @GetMapping("/list") + public ResponseObject list(SysDept dept) + { + List depts = deptService.selectDeptList(dept); + return getSuccessResult(depts); + } + + /** + * 查询部门列表(排除节点) + */ + @GetMapping("/list/exclude/{deptId}") + public ResponseObject excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) + { + List depts = deptService.selectDeptList(new SysDept()); + depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); + return getSuccessResult(depts); + } + + /** + * 根据部门编号获取详细信息 + */ + @GetMapping(value = "/{deptId}") + public ResponseObject getInfo(@PathVariable Long deptId) + { + return getSuccessResult(deptService.selectDeptById(deptId)); + } + + /** + * 新增部门 + */ + @PostMapping("/add") + public ResponseObject add(@Validated @RequestBody SysDept dept) + { + if (!deptService.checkDeptNameUnique(dept)) + { + return getFailureResult("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); + } + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + dept.setCreateBy(nowAccountInfo.getId().toString()); + return getSuccessResult(deptService.insertDept(dept)); + } + + /** + * 修改部门 + */ + @PostMapping("/edit") + public ResponseObject edit(@Validated @RequestBody SysDept dept) + { + Long deptId = dept.getDeptId(); + if (!deptService.checkDeptNameUnique(dept)) + { + return getFailureResult("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); + } + else if (dept.getParentId().equals(deptId)) + { + return getFailureResult("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); + } + else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) + { + return getFailureResult("该部门包含未停用的子部门!"); + } + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + dept.setCreateBy(nowAccountInfo.getId().toString()); + return getSuccessResult(deptService.updateDept(dept)); + } + + /** + * 删除部门 + */ + @DeleteMapping("/{deptId}") + public ResponseObject remove(@PathVariable Long deptId) + { + if (deptService.hasChildByDeptId(deptId)) + { + return getFailureResult("存在下级部门,不允许删除"); + } + if (deptService.checkDeptExistUser(deptId)) + { + return getFailureResult("部门存在用户,不允许删除"); + } + return getSuccessResult(deptService.deleteDeptById(deptId)); + } + + /** + * 获取部门树列表 + */ + @GetMapping("/deptTree") + public ResponseObject deptTree(SysDept dept) + { + return getSuccessResult(deptService.selectDeptTreeList(dept)); + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/entity/SysDept.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/entity/SysDept.java new file mode 100644 index 000000000..6de1b31b6 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/entity/SysDept.java @@ -0,0 +1,64 @@ +package com.fuint.system.dept.entity; + +import com.fuint.framework.entity.BaseEntity; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +/** + * 部门表 sys_dept + * + * @author ruoyi + */ +@Data +public class SysDept extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 部门ID */ + private Long deptId; + + /** 父部门ID */ + private Long parentId; + + /** 祖级列表 */ + private String ancestors; + + /** 部门名称 */ + private String deptName; + + /** 显示顺序 */ + private Integer orderNum; + //节点类型:1代理商2连锁店3基本门店 + private String deptType; + + /** 负责人 */ + private Integer leaderAccountId; + + /** 联系电话 */ + private String phone; + + /** 邮箱 */ + private String email; + + /** 部门状态:0正常,1停用 */ + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + private String delFlag; + + /** 父部门名称 */ + private String parentName; + + /** 子部门 */ + private List children = new ArrayList(); + + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/mapper/SysDeptMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/mapper/SysDeptMapper.java new file mode 100644 index 000000000..3e2dbff8d --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/mapper/SysDeptMapper.java @@ -0,0 +1,120 @@ +package com.fuint.system.dept.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fuint.system.dept.entity.SysDept; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 部门管理 数据层 + * + * @author ruoyi + */ +public interface SysDeptMapper extends BaseMapper +{ + /** + * 查询部门管理数据 + * + * @param dept 部门信息 + * @return 部门信息集合 + */ + public List selectDeptList(@Param("dept") SysDept dept,@Param("ownDeptStr") String ownDeptStr); + + /** + * 根据角色ID查询部门树信息 + * + * @param roleId 角色ID + * @param deptCheckStrictly 部门树选择项是否关联显示 + * @return 选中部门列表 + */ + public List selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); + + /** + * 根据部门ID查询信息 + * + * @param deptId 部门ID + * @return 部门信息 + */ + public SysDept selectDeptById(Long deptId); + + /** + * 根据ID查询所有子部门 + * + * @param deptId 部门ID + * @return 部门列表 + */ + public List selectChildrenDeptById(Long deptId); + + /** + * 根据ID查询所有子部门(正常状态) + * + * @param deptId 部门ID + * @return 子部门数 + */ + public int selectNormalChildrenDeptById(Long deptId); + + /** + * 是否存在子节点 + * + * @param deptId 部门ID + * @return 结果 + */ + public int hasChildByDeptId(Long deptId); + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 + */ + public int checkDeptExistUser(Long deptId); + + /** + * 校验部门名称是否唯一 + * + * @param deptName 部门名称 + * @param parentId 父部门ID + * @return 结果 + */ + public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId); + + /** + * 新增部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int insertDept(SysDept dept); + + /** + * 修改部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int updateDept(SysDept dept); + + /** + * 修改所在部门正常状态 + * + * @param deptIds 部门ID组 + */ + public void updateDeptStatusNormal(Long[] deptIds); + + /** + * 修改子元素关系 + * + * @param depts 子元素 + * @return 结果 + */ + public int updateDeptChildren(@Param("depts") List depts); + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + public int deleteDeptById(Long deptId); +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/mapper/xml/SysDeptMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/mapper/xml/SysDeptMapper.xml new file mode 100644 index 000000000..047ecb40d --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/mapper/xml/SysDeptMapper.xml @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + insert into sys_dept( + parent_id, + dept_name, + ancestors, + order_num, + leader, + phone, + email, + status, + create_by, + create_time + )values( + #{parentId}, + #{deptName}, + #{ancestors}, + #{orderNum}, + #{leader}, + #{phone}, + #{email}, + #{status}, + #{createBy}, + sysdate() + ) + + + + update sys_dept + + parent_id = #{parentId}, + dept_name = #{deptName}, + ancestors = #{ancestors}, + order_num = #{orderNum}, + leader = #{leader}, + phone = #{phone}, + email = #{email}, + status = #{status}, + update_by = #{updateBy}, + update_time = sysdate() + + where dept_id = #{deptId} + + + + update sys_dept set ancestors = + + when #{item.deptId} then #{item.ancestors} + + where dept_id in + + #{item.deptId} + + + + + update sys_dept set status = '0' where dept_id in + + #{deptId} + + + + + update sys_dept set del_flag = '2' where dept_id = #{deptId} + + + \ No newline at end of file diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/ISysDeptService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/ISysDeptService.java new file mode 100644 index 000000000..e282f06a0 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/ISysDeptService.java @@ -0,0 +1,114 @@ +package com.fuint.system.dept.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.fuint.common.domain.TreeSelect; +import com.fuint.system.dept.entity.SysDept; + + +import java.util.List; + +/** + * 部门管理 服务层 + * + * @author ruoyi + */ +public interface ISysDeptService extends IService +{ + /** + * 查询部门管理数据 + * + * @param dept 部门信息 + * @return 部门信息集合 + */ + public List selectDeptList(SysDept dept); + + /** + * 查询部门树结构信息 + * + * @param dept 部门信息 + * @return 部门树信息集合 + */ + public List selectDeptTreeList(SysDept dept); + + /** + * 构建前端所需要树结构 + * + * @param depts 部门列表 + * @return 树结构列表 + */ + public List buildDeptTree(List depts); + + /** + * 构建前端所需要下拉树结构 + * + * @param depts 部门列表 + * @return 下拉树结构列表 + */ + public List buildDeptTreeSelect(List depts); + + + /** + * 根据部门ID查询信息 + * + * @param deptId 部门ID + * @return 部门信息 + */ + public SysDept selectDeptById(Long deptId); + + /** + * 根据ID查询所有子部门(正常状态) + * + * @param deptId 部门ID + * @return 子部门数 + */ + public int selectNormalChildrenDeptById(Long deptId); + + /** + * 是否存在部门子节点 + * + * @param deptId 部门ID + * @return 结果 + */ + public boolean hasChildByDeptId(Long deptId); + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 true 存在 false 不存在 + */ + public boolean checkDeptExistUser(Long deptId); + + /** + * 校验部门名称是否唯一 + * + * @param dept 部门信息 + * @return 结果 + */ + public boolean checkDeptNameUnique(SysDept dept); + + + /** + * 新增保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int insertDept(SysDept dept); + + /** + * 修改保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int updateDept(SysDept dept); + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + public int deleteDeptById(Long deptId); +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/impl/SysDeptServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/impl/SysDeptServiceImpl.java new file mode 100644 index 000000000..229e6eee9 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/impl/SysDeptServiceImpl.java @@ -0,0 +1,304 @@ +package com.fuint.system.dept.service.impl; + +import com.aliyun.oss.ServiceException; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.common.constant.UserConstants; +import com.fuint.common.domain.TreeSelect; +import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.Convert; +import com.fuint.common.util.SpringUtils; +import com.fuint.common.util.StringUtils; +import com.fuint.common.util.TokenUtil; +import com.fuint.system.dept.entity.SysDept; +import com.fuint.system.dept.mapper.SysDeptMapper; +import com.fuint.system.dept.service.ISysDeptService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 部门管理 服务实现 + * + * @author ruoyi + */ +@Service +public class SysDeptServiceImpl extends ServiceImpl implements ISysDeptService +{ + + /** + * 查询部门管理数据 + * + * @param dept 部门信息 + * @return 部门信息集合 + */ + @Override + public List selectDeptList(SysDept dept) + { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + SysDept sysDept = baseMapper.selectDeptById(nowAccountInfo.getDeptId()); + return baseMapper.selectDeptList(dept,sysDept.getAncestors()); + } + + /** + * 查询部门树结构信息 + * + * @param dept 部门信息 + * @return 部门树信息集合 + */ + @Override + public List selectDeptTreeList(SysDept dept) + { + List depts = this.selectDeptList(dept); + return buildDeptTreeSelect(depts); + } + + /** + * 构建前端所需要树结构 + * + * @param depts 部门列表 + * @return 树结构列表 + */ + @Override + public List buildDeptTree(List depts) + { + List returnList = new ArrayList(); + List tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList()); + for (SysDept dept : depts) + { + // 如果是顶级节点, 遍历该父节点的所有子节点 + if (!tempList.contains(dept.getParentId())) + { + recursionFn(depts, dept); + returnList.add(dept); + } + } + if (returnList.isEmpty()) + { + returnList = depts; + } + return returnList; + } + + /** + * 构建前端所需要下拉树结构 + * + * @param depts 部门列表 + * @return 下拉树结构列表 + */ + @Override + public List buildDeptTreeSelect(List depts) + { + List deptTrees = buildDeptTree(depts); + return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + + /** + * 根据部门ID查询信息 + * + * @param deptId 部门ID + * @return 部门信息 + */ + @Override + public SysDept selectDeptById(Long deptId) + { + return baseMapper.selectDeptById(deptId); + } + + /** + * 根据ID查询所有子部门(正常状态) + * + * @param deptId 部门ID + * @return 子部门数 + */ + @Override + public int selectNormalChildrenDeptById(Long deptId) + { + return baseMapper.selectNormalChildrenDeptById(deptId); + } + + /** + * 是否存在子节点 + * + * @param deptId 部门ID + * @return 结果 + */ + @Override + public boolean hasChildByDeptId(Long deptId) + { + int result = baseMapper.hasChildByDeptId(deptId); + return result > 0; + } + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 true 存在 false 不存在 + */ + @Override + public boolean checkDeptExistUser(Long deptId) + { + int result = baseMapper.checkDeptExistUser(deptId); + return result > 0; + } + + /** + * 校验部门名称是否唯一 + * + * @param dept 部门信息 + * @return 结果 + */ + @Override + public boolean checkDeptNameUnique(SysDept dept) + { + Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId(); + SysDept info = baseMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId()); + if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + + /** + * 新增保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + @Override + public int insertDept(SysDept dept) + { + if (null!=dept.getParentId()){ + SysDept info = baseMapper.selectDeptById(dept.getParentId()); + // 如果父节点不为正常状态,则不允许新增子节点 + if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) + { + throw new ServiceException("部门停用,不允许新增"); + } + dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); + } + return baseMapper.insertDept(dept); + } + + /** + * 修改保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + @Override + public int updateDept(SysDept dept) + { + SysDept newParentDept = baseMapper.selectDeptById(dept.getParentId()); + SysDept oldDept = baseMapper.selectDeptById(dept.getDeptId()); + if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) + { + String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId(); + String oldAncestors = oldDept.getAncestors(); + dept.setAncestors(newAncestors); + updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); + } + int result = baseMapper.updateDept(dept); + if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors()) + && !StringUtils.equals("0", dept.getAncestors())) + { + // 如果该部门是启用状态,则启用该部门的所有上级部门 + updateParentDeptStatusNormal(dept); + } + return result; + } + + /** + * 修改该部门的父级部门状态 + * + * @param dept 当前部门 + */ + private void updateParentDeptStatusNormal(SysDept dept) + { + String ancestors = dept.getAncestors(); + Long[] deptIds = Convert.toLongArray(ancestors); + baseMapper.updateDeptStatusNormal(deptIds); + } + + /** + * 修改子元素关系 + * + * @param deptId 被修改的部门ID + * @param newAncestors 新的父ID集合 + * @param oldAncestors 旧的父ID集合 + */ + public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) + { + List children = baseMapper.selectChildrenDeptById(deptId); + for (SysDept child : children) + { + child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors)); + } + if (children.size() > 0) + { + baseMapper.updateDeptChildren(children); + } + } + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + @Override + public int deleteDeptById(Long deptId) + { + return baseMapper.deleteDeptById(deptId); + } + + /** + * 递归列表 + */ + private void recursionFn(List list, SysDept t) + { + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (SysDept tChild : childList) + { + if (hasChild(list, tChild)) + { + recursionFn(list, tChild); + } + } + } + + /** + * 得到子节点列表 + */ + private List getChildList(List list, SysDept t) + { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) + { + SysDept n = (SysDept) it.next(); + if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) + { + tlist.add(n); + } + } + return tlist; + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, SysDept t) + { + return getChildList(list, t).size() > 0; + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/controller/SysDictDataController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/controller/SysDictDataController.java index c4636fdf6..9ec1fef9b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/controller/SysDictDataController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/controller/SysDictDataController.java @@ -37,7 +37,7 @@ public class SysDictDataController extends BaseController @GetMapping("/list") public ResponseObject list(SysDictData dictData, - @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageNum",defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize) { Page page =new Page(pageNo,pageSize); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/controller/SysDictTypeController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/controller/SysDictTypeController.java index 9f6ff1331..1e0332fd1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/controller/SysDictTypeController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/controller/SysDictTypeController.java @@ -30,7 +30,7 @@ public class SysDictTypeController extends BaseController @GetMapping("/list") public ResponseObject list(SysDictType dictType, - @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageNum",defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize) { Page page =new Page(pageNo,pageSize); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/util/DictUtils.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/util/DictUtils.java index 2c61e1579..5544bbeaa 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/util/DictUtils.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/util/DictUtils.java @@ -40,10 +40,10 @@ public class DictUtils */ public static List getDictCache(String key) { - JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key)); + Object arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key)); if (StringUtils.isNotNull(arrayCache)) { - return arrayCache.toList(SysDictData.class); + return JSONArray.parseArray(JSONArray.toJSONString(arrayCache),SysDictData.class); } return null; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendAccountController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/user/controller/BackendAccountController.java similarity index 85% rename from fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendAccountController.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/system/user/controller/BackendAccountController.java index 931a4f9a5..e8014c123 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendAccountController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/user/controller/BackendAccountController.java @@ -1,5 +1,7 @@ -package com.fuint.module.backendApi.controller; +package com.fuint.system.user.controller; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.common.util.Constants; import com.fuint.common.dto.AccountDto; import com.fuint.common.dto.AccountInfo; @@ -69,52 +71,18 @@ public class BackendAccountController extends BaseController { /** * 账户信息列表 * - * @param request HttpServletRequest对象 * @return 账户信息列表 */ @ApiOperation(value = "账户信息列表") @RequestMapping(value = "/list", method = RequestMethod.GET) @CrossOrigin - public ResponseObject list(HttpServletRequest request) throws BusinessCheckException { - String token = request.getHeader("Access-Token"); - Integer page = request.getParameter("page") == null ? Constants.PAGE_NUMBER : Integer.parseInt(request.getParameter("page")); - Integer pageSize = request.getParameter("pageSize") == null ? Constants.PAGE_SIZE : Integer.parseInt(request.getParameter("pageSize")); - String accountName = request.getParameter("accountName") == null ? "" : request.getParameter("accountName"); - String realName = request.getParameter("realName") == null ? "" : request.getParameter("realName"); - String accountStatus = request.getParameter("accountStatus") == null ? "" : request.getParameter("accountStatus"); + public ResponseObject list(TAccount accountInfo, + @RequestParam(value = "pageNum",defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize) throws BusinessCheckException { - AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token); - if (accountInfo == null) { - return getFailureResult(1001, "请先登录"); - } - - PaginationRequest paginationRequest = new PaginationRequest(); - paginationRequest.setCurrentPage(page); - paginationRequest.setPageSize(pageSize); - - Map searchParams = new HashMap<>(); - if (StringUtil.isNotEmpty(accountName)) { - searchParams.put("name", accountName); - } - if (StringUtil.isNotEmpty(realName)) { - searchParams.put("realName", realName); - } - if (StringUtil.isNotEmpty(accountStatus)) { - searchParams.put("status", accountStatus); - } - if (StringUtil.isNotEmpty(accountStatus)) { - searchParams.put("status", accountStatus); - } - if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) { - searchParams.put("merchantId", accountInfo.getMerchantId()); - } - if (accountInfo.getStoreId() != null && accountInfo.getStoreId() > 0) { - searchParams.put("storeId", accountInfo.getStoreId()); - } - - paginationRequest.setSearchParams(searchParams); - PaginationResponse paginationResponse = tAccountService.getAccountListByPagination(paginationRequest); - return getSuccessResult(paginationResponse); + Page page =new Page(pageNo,pageSize); + IPage res = tAccountService.listAccount(page,accountInfo); + return getSuccessResult(res); } /** @@ -170,9 +138,9 @@ public class BackendAccountController extends BaseController { accountDto.setAccountKey(tAccount.getAccountKey()); accountDto.setAccountName(tAccount.getAccountName()); accountDto.setAccountStatus(tAccount.getAccountStatus()); - accountDto.setCreateDate(tAccount.getCreateDate()); + accountDto.setCreateDate(tAccount.getCreateTime()); accountDto.setRealName(tAccount.getRealName()); - accountDto.setModifyDate(tAccount.getModifyDate()); + accountDto.setModifyDate(tAccount.getUpdateTime()); accountDto.setStaffId(tAccount.getStaffId()); accountDto.setMerchantId(tAccount.getMerchantId()); if (tAccount.getStoreId() > 0) { diff --git a/fuintBackend/fuint-framework/src/main/java/com/fuint/framework/exception/GlobalExceptionHandler.java b/fuintBackend/fuint-framework/src/main/java/com/fuint/framework/exception/GlobalExceptionHandler.java index 7b58724ce..25d25e5c9 100644 --- a/fuintBackend/fuint-framework/src/main/java/com/fuint/framework/exception/GlobalExceptionHandler.java +++ b/fuintBackend/fuint-framework/src/main/java/com/fuint/framework/exception/GlobalExceptionHandler.java @@ -90,7 +90,7 @@ public class GlobalExceptionHandler { public ResponseObject handleException(LoginEffectiveException e, HttpServletRequest request) { String requestURI = request.getRequestURI(); log.error("登录信息失效", requestURI, e); - return new ResponseObject(101, e.getMessage(), null); + return new ResponseObject(1001, e.getMessage(), null); } /** diff --git a/fuintBackend/fuint-framework/src/main/java/com/fuint/framework/web/BaseController.java b/fuintBackend/fuint-framework/src/main/java/com/fuint/framework/web/BaseController.java index de3a6cb5e..a8650ebb2 100644 --- a/fuintBackend/fuint-framework/src/main/java/com/fuint/framework/web/BaseController.java +++ b/fuintBackend/fuint-framework/src/main/java/com/fuint/framework/web/BaseController.java @@ -75,4 +75,13 @@ public class BaseController { public ResponseObject getFailureResult(int errorCode, String message, Object data) { return new ResponseObject(errorCode, message, data); } + + /** + * 获取错返回结果(无参数替换) + * + * @return + */ + public ResponseObject getFailureResult(String message) { + return new ResponseObject(201, message, null); + } } \ No newline at end of file diff --git a/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/mapper/TAccountMapper.java b/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/mapper/TAccountMapper.java index 287a6e6f4..bd222f3c3 100644 --- a/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/mapper/TAccountMapper.java +++ b/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/mapper/TAccountMapper.java @@ -1,7 +1,10 @@ package com.fuint.repository.mapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.repository.model.TAccount; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; /** * 后台账号 Mapper 接口 @@ -10,5 +13,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; * CopyRight https://www.fuint.cn */ public interface TAccountMapper extends BaseMapper { - + IPage listAccount(Page page, @Param("accountInfo") TAccount accountInfo,@Param("ancestors") String ancestors); } 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 20a8e5dde..d4d41fea7 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 @@ -1,10 +1,13 @@ package com.fuint.repository.model; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.util.Date; + +import com.fuint.repository.model.base.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; @@ -20,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; @@ -43,12 +46,6 @@ public class TAccount implements Serializable { @ApiModelProperty("0 未激活 1已激活") private Integer isActive; - @ApiModelProperty("创建时间") - private Date createDate; - - @ApiModelProperty("修改时间") - private Date modifyDate; - @ApiModelProperty("随机码") private String salt; @@ -72,10 +69,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; } diff --git a/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml b/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml index 74fe45708..f29179945 100644 --- a/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml +++ b/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml @@ -1,5 +1,23 @@ +