|
|
@@ -3,14 +3,19 @@ package com.jzg.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.jzg.core.page.HttpResult;
|
|
|
import com.jzg.entity.po.SysSystem;
|
|
|
import com.jzg.entity.vo.SysSystemVo;
|
|
|
import com.jzg.mapper.SysSystemMapper;
|
|
|
import com.jzg.service.SysSystemService;
|
|
|
import com.jzg.util.StringUtils;
|
|
|
+import jakarta.validation.constraints.NotEmpty;
|
|
|
import jodd.util.StringUtil;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* 租户管理表 服务层处理 sys_system
|
|
|
*
|
|
|
@@ -26,7 +31,7 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public SysSystem getBySystemCode(String systemCode) {
|
|
|
+ public SysSystem getBySystemCode(String systemCode ) {
|
|
|
return this.getOne(new LambdaQueryWrapper<SysSystem>()
|
|
|
.eq(SysSystem::getSysCode, systemCode));
|
|
|
}
|
|
|
@@ -37,23 +42,42 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public boolean isExists(String systemCode) {
|
|
|
+ public boolean isExistsCode(String systemCode ,String id) {
|
|
|
long count = this.count(new LambdaQueryWrapper<SysSystem>()
|
|
|
- .eq(SysSystem::getSysCode, systemCode));
|
|
|
+ .eq(SysSystem::getSysCode, systemCode)
|
|
|
+ .ne(StringUtils.isNotNull(id),SysSystem::getId, id)
|
|
|
+ );
|
|
|
+ return count > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean isExistsName(String systemName, String id) {
|
|
|
+ long count = this.count(new LambdaQueryWrapper<SysSystem>()
|
|
|
+ .eq(SysSystem::getSysCode, systemName)
|
|
|
+ .ne(StringUtils.isNotNull(id),SysSystem::getId, id)
|
|
|
+ );
|
|
|
return count > 0;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Page<SysSystem> queryPage(Page page, SysSystemVo sysSystemVo) {
|
|
|
LambdaQueryWrapper<SysSystem> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(StringUtils.isNotEmpty(sysSystemVo.getProvinceId()), SysSystem::getProvinceId, sysSystemVo.getProvinceId())
|
|
|
- .eq(StringUtils.isNotEmpty(sysSystemVo.getCityId()), SysSystem::getCityId, sysSystemVo.getCityId())
|
|
|
- .eq(StringUtils.isNotEmpty(sysSystemVo.getDistrictId()), SysSystem::getDistrictId, sysSystemVo.getDistrictId())
|
|
|
- .eq(StringUtils.isNotNull(sysSystemVo.getSysType()), SysSystem::getSysType, sysSystemVo.getSysType())
|
|
|
- .eq(StringUtils.isNotEmpty(sysSystemVo.getSearchValue()), SysSystem::getSysName, sysSystemVo.getSearchValue())
|
|
|
- .eq(StringUtils.isNotEmpty(sysSystemVo.getSearchValue()), SysSystem::getSysCode, sysSystemVo.getSearchValue())
|
|
|
- .eq(StringUtils.isNotEmpty(sysSystemVo.getContactValue()), SysSystem::getContact, sysSystemVo.getContactValue())
|
|
|
- .eq(StringUtils.isNotEmpty(sysSystemVo.getContactValue()), SysSystem::getTelephone, sysSystemVo.getContactValue());
|
|
|
+ wrapper.eq(StringUtils.isNotEmpty(sysSystemVo.getProvinceId()),
|
|
|
+ SysSystem::getProvinceId, sysSystemVo.getProvinceId())
|
|
|
+ .eq(StringUtils.isNotEmpty(sysSystemVo.getCityId()),
|
|
|
+ SysSystem::getCityId, sysSystemVo.getCityId())
|
|
|
+ .eq(StringUtils.isNotEmpty(sysSystemVo.getDistrictId()),
|
|
|
+ SysSystem::getDistrictId, sysSystemVo.getDistrictId())
|
|
|
+ .eq(StringUtils.isNotNull(sysSystemVo.getSysType()),
|
|
|
+ SysSystem::getSysType, sysSystemVo.getSysType())
|
|
|
+ .eq(StringUtils.isNotEmpty(sysSystemVo.getSearchValue()),
|
|
|
+ SysSystem::getSysName, sysSystemVo.getSearchValue()).or()
|
|
|
+ .eq(StringUtils.isNotEmpty(sysSystemVo.getSearchValue()),
|
|
|
+ SysSystem::getSysCode, sysSystemVo.getSearchValue())
|
|
|
+ .eq(StringUtils.isNotEmpty(sysSystemVo.getContactValue()),
|
|
|
+ SysSystem::getContact, sysSystemVo.getContactValue()).or()
|
|
|
+ .eq(StringUtils.isNotEmpty(sysSystemVo.getContactValue()),
|
|
|
+ SysSystem::getTelephone, sysSystemVo.getContactValue());
|
|
|
Page<SysSystem> sysPage = page(page, wrapper);
|
|
|
return sysPage;
|
|
|
}
|
|
|
@@ -63,6 +87,42 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean sysAdd(SysSystemVo sysSystemVo) {
|
|
|
+ SysSystem sysSystem = new SysSystem();
|
|
|
+ BeanUtils.copyProperties(sysSystemVo, sysSystem);
|
|
|
+
|
|
|
+ // 新增管理员信息
|
|
|
+
|
|
|
+ // 初始化租户基本信息
|
|
|
+
|
|
|
+ return save(sysSystem);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean sysEdit(SysSystemVo sysSystemVo) {
|
|
|
+ SysSystem sysSystem = new SysSystem();
|
|
|
+ BeanUtils.copyProperties(sysSystemVo, sysSystem);
|
|
|
+
|
|
|
+ // 修改管理员信息
|
|
|
+
|
|
|
+ // 初始化租户基本信息
|
|
|
+ return updateById(sysSystem);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean changeStatus(SysSystemVo sysSystemVo) {
|
|
|
+ SysSystem sysSystem = new SysSystem();
|
|
|
+ sysSystem.setId(sysSystemVo.getId());
|
|
|
+ sysSystem.setAvailable(sysSystemVo.getAvailable());
|
|
|
+ return updateById(sysSystem);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean deleteWithValidByIds(List<Long> ids) {
|
|
|
+ return baseMapper.deleteByIds(ids) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|