封版
This commit is contained in:
@@ -11,6 +11,7 @@ import com.gxwebsoft.common.system.entity.Tenant;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.entity.UserCollection;
|
||||
import com.gxwebsoft.common.system.mapper.CompanyMapper;
|
||||
import com.gxwebsoft.common.system.mapper.TenantMapper;
|
||||
import com.gxwebsoft.common.system.param.CompanyParam;
|
||||
import com.gxwebsoft.common.system.service.CompanyService;
|
||||
import com.gxwebsoft.common.system.service.TenantService;
|
||||
@@ -47,8 +48,11 @@ public class CompanyController extends BaseController {
|
||||
@Resource
|
||||
private CompanyMapper companyMapper;
|
||||
@Resource
|
||||
private TenantMapper tenantMapper;
|
||||
@Resource
|
||||
private UserCollectionService userCollectionService;
|
||||
|
||||
|
||||
@ApiOperation("分页查询企业信息不限租户")
|
||||
@GetMapping("/pageAll")
|
||||
public ApiResult<PageResult<Company>> pageAll(CompanyParam param) {
|
||||
@@ -59,12 +63,15 @@ public class CompanyController extends BaseController {
|
||||
final List<UserCollection> myFocus = userCollectionService.list(new LambdaQueryWrapper<UserCollection>().eq(UserCollection::getUserId, getLoginUserId()));
|
||||
if (!CollectionUtils.isEmpty(myFocus)) {
|
||||
final Set<Integer> collect = myFocus.stream().map(UserCollection::getTid).collect(Collectors.toSet());
|
||||
if (param.getVersion() != null && param.getVersion().equals(99)) {
|
||||
param.setVersion(null);
|
||||
param.setCompanyIds(collect);
|
||||
if (param.getVersion() != null) {
|
||||
// 我的收藏
|
||||
if (param.getVersion().equals(99)) {
|
||||
param.setVersion(null);
|
||||
param.setCompanyIds(collect);
|
||||
}
|
||||
}
|
||||
final PageResult<Company> result = companyService.pageRelAll(param);
|
||||
System.out.println("collect = " + collect);
|
||||
// System.out.println("collect = " + collect);
|
||||
result.getList().forEach(d -> {
|
||||
d.setCollection(collect.contains(d.getCompanyId()));
|
||||
});
|
||||
@@ -254,4 +261,48 @@ public class CompanyController extends BaseController {
|
||||
public ApiResult<Company> companyInfoAll(@PathVariable("companyId") Integer companyId) {
|
||||
return success(companyMapper.getCompanyAll(companyId));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:company:updateAll')")
|
||||
@OperationLog
|
||||
@ApiOperation("修改企业信息")
|
||||
@PutMapping("/updateCompanyAll")
|
||||
public ApiResult<?> updateCompanyAll(@RequestBody Company company) {
|
||||
if (companyMapper.updateByIdAll(company)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:company:removeAll')")
|
||||
@OperationLog
|
||||
@ApiOperation("删除企业信息")
|
||||
@DeleteMapping("/removeAll/{id}")
|
||||
public ApiResult<?> removeAll(@PathVariable("id") Integer id) {
|
||||
if (companyMapper.removeCompanyAll(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:company:removeAll')")
|
||||
@OperationLog
|
||||
@ApiOperation("恢复租户")
|
||||
@DeleteMapping("/undeleteAll/{id}")
|
||||
public ApiResult<?> undeleteAll(@PathVariable("id") Integer id) {
|
||||
if (companyMapper.undeleteAll(id)) {
|
||||
return success("恢复成功");
|
||||
}
|
||||
return fail("恢复失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:company:destructionAll')")
|
||||
@OperationLog
|
||||
@ApiOperation("销毁租户")
|
||||
@DeleteMapping("/destructionAll/{id}")
|
||||
public ApiResult<?> destructionAll(@PathVariable("id") Integer id) {
|
||||
if (tenantMapper.destructionAll(id)) {
|
||||
return success("销毁成功");
|
||||
}
|
||||
return fail("销毁失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,4 +49,13 @@ public interface CompanyMapper extends BaseMapper<Company> {
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
void updateByCompanyId(@Param("param") Company company);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
boolean removeCompanyAll(Integer id);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
boolean undeleteAll(Integer id);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
boolean updateByIdAll(Company company);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gxwebsoft.common.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.common.system.entity.Tenant;
|
||||
@@ -35,4 +36,7 @@ public interface TenantMapper extends BaseMapper<Tenant> {
|
||||
*/
|
||||
List<Tenant> selectListRel(@Param("param") TenantParam param);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
boolean destructionAll(Integer id);
|
||||
|
||||
}
|
||||
|
||||
@@ -166,4 +166,12 @@
|
||||
UPDATE sys_company SET storage = #{param.storage} WHERE company_id = #{param.companyId}
|
||||
</update>
|
||||
|
||||
<!-- 删除企业信息-->
|
||||
<update id="removeCompanyAll">
|
||||
UPDATE sys_company SET deleted = 1 WHERE company_id = #{param.companyId}
|
||||
</update>
|
||||
|
||||
<update id="undeleteAll">
|
||||
UPDATE sys_company SET deleted = 0 WHERE company_id = #{param.companyId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
@@ -60,4 +60,9 @@
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 销毁租户-->
|
||||
<delete id="destructionAll">
|
||||
DELETE FROM sys_tenant WHERE tenant_id = #{param.tenantId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -45,4 +45,8 @@ public interface CompanyService extends IService<Company> {
|
||||
PageResult<Company> pageRelAll(CompanyParam param);
|
||||
|
||||
void updateByCompanyId(Company company);
|
||||
|
||||
boolean removeCompanyAll(Integer companyId);
|
||||
|
||||
boolean undeleteAll(Integer companyId);
|
||||
}
|
||||
|
||||
@@ -41,4 +41,6 @@ public interface TenantService extends IService<Tenant> {
|
||||
Tenant getByIdRel(Integer tenantId);
|
||||
|
||||
boolean initialization(Company company);
|
||||
|
||||
boolean destructionAll(Integer tenantId);
|
||||
}
|
||||
|
||||
@@ -66,4 +66,22 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
||||
baseMapper.updateByCompanyId(company);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCompanyAll(Integer companyId){
|
||||
if (baseMapper.removeCompanyAll(companyId)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean undeleteAll(Integer companyId){
|
||||
if (baseMapper.undeleteAll(companyId)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -608,4 +608,12 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
|
||||
redisUtil.set(key, tenant);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean destructionAll(Integer tenantId){
|
||||
if (baseMapper.destructionAll(tenantId)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user