区域,公司id 改INT
This commit is contained in:
parent
c3fdc0f393
commit
0cc6bebe99
|
|
@ -120,12 +120,12 @@ public class BaseAreaController extends ControllerBase {
|
||||||
@PostMapping("del")
|
@PostMapping("del")
|
||||||
@MethodInfoMark(value = "删除" ,menuName = "区域管理")
|
@MethodInfoMark(value = "删除" ,menuName = "区域管理")
|
||||||
@ApiMark(moduleName = "区域管理", apiName = "删除")
|
@ApiMark(moduleName = "区域管理", apiName = "删除")
|
||||||
public ApiResult<Boolean> del(@RequestBody List<Long> ids){
|
public ApiResult<Boolean> del(@RequestBody List<Integer> ids){
|
||||||
VUtils.trueThrow(CollUtil.isEmpty(ids)).throwMessage(STATE.ParamErr,"请选择要删除的行");
|
VUtils.trueThrow(CollUtil.isEmpty(ids)).throwMessage(STATE.ParamErr,"请选择要删除的行");
|
||||||
//检查下面是否有
|
//检查下面是否有
|
||||||
List<TBaseArea> delNodes = baseAreaService.getBaseMapper().selectByIds(ids);
|
List<TBaseArea> delNodes = baseAreaService.getBaseMapper().selectByIds(ids);
|
||||||
List<String> hasChildNodes=new ArrayList<>();
|
List<String> hasChildNodes=new ArrayList<>();
|
||||||
List<Long> childIds=new ArrayList<>();
|
List<Integer> childIds=new ArrayList<>();
|
||||||
for ( TBaseArea delNode: delNodes) {
|
for ( TBaseArea delNode: delNodes) {
|
||||||
childIds.clear();
|
childIds.clear();
|
||||||
adminBaseAreaService.getAllChildIds( Convert.convert(TBaseAreaVO.class,delNode) ,childIds);
|
adminBaseAreaService.getAllChildIds( Convert.convert(TBaseAreaVO.class,delNode) ,childIds);
|
||||||
|
|
@ -153,7 +153,7 @@ public class BaseAreaController extends ControllerBase {
|
||||||
@PostMapping("enable")
|
@PostMapping("enable")
|
||||||
@MethodInfoMark(value = "启用" ,menuName = "区域管理")
|
@MethodInfoMark(value = "启用" ,menuName = "区域管理")
|
||||||
@ApiMark(moduleName = "区域管理", apiName = "启用")
|
@ApiMark(moduleName = "区域管理", apiName = "启用")
|
||||||
public ApiResult<Boolean> enable(@RequestBody List<Long> ids){
|
public ApiResult<Boolean> enable(@RequestBody List<Integer> ids){
|
||||||
VUtils.trueThrow(CollUtil.isEmpty(ids)).throwMessage(STATE.ParamErr,"请选择要启用的行");
|
VUtils.trueThrow(CollUtil.isEmpty(ids)).throwMessage(STATE.ParamErr,"请选择要启用的行");
|
||||||
|
|
||||||
baseAreaService.upState(1, ids, AdminUserUtil.getUserNo(), AdminUserUtil.getUserName());
|
baseAreaService.upState(1, ids, AdminUserUtil.getUserNo(), AdminUserUtil.getUserName());
|
||||||
|
|
@ -169,10 +169,10 @@ public class BaseAreaController extends ControllerBase {
|
||||||
@PostMapping("disable")
|
@PostMapping("disable")
|
||||||
@MethodInfoMark(value = "禁用" ,menuName = "区域管理")
|
@MethodInfoMark(value = "禁用" ,menuName = "区域管理")
|
||||||
@ApiMark(moduleName = "区域管理", apiName = "禁用")
|
@ApiMark(moduleName = "区域管理", apiName = "禁用")
|
||||||
public ApiResult<Boolean> disable(@RequestBody List<Long> ids){
|
public ApiResult<Boolean> disable(@RequestBody List<Integer> ids){
|
||||||
VUtils.trueThrow(CollUtil.isEmpty(ids)).throwMessage(STATE.ParamErr,"请选择要禁用的行");
|
VUtils.trueThrow(CollUtil.isEmpty(ids)).throwMessage(STATE.ParamErr,"请选择要禁用的行");
|
||||||
List<TBaseArea> tBaseAreas = baseAreaService.getBaseMapper().selectByIds(ids);
|
List<TBaseArea> tBaseAreas = baseAreaService.getBaseMapper().selectByIds(ids);
|
||||||
List<Long> allIds=new ArrayList<>();
|
List<Integer> allIds=new ArrayList<>();
|
||||||
allIds.addAll(ids);
|
allIds.addAll(ids);
|
||||||
for (TBaseArea baseArea :tBaseAreas) {
|
for (TBaseArea baseArea :tBaseAreas) {
|
||||||
adminBaseAreaService.getAllChildIds(Convert.convert(TBaseAreaVO.class,baseArea) , allIds);
|
adminBaseAreaService.getAllChildIds(Convert.convert(TBaseAreaVO.class,baseArea) , allIds);
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ public class CustomerController extends ControllerBase {
|
||||||
@PostMapping("del")
|
@PostMapping("del")
|
||||||
@MethodInfoMark(value = "删除" ,menuName = "客户管理")
|
@MethodInfoMark(value = "删除" ,menuName = "客户管理")
|
||||||
@ApiMark(moduleName = "客户管理", apiName = "删除")
|
@ApiMark(moduleName = "客户管理", apiName = "删除")
|
||||||
public ApiResult<Boolean> del(@RequestBody List<Long> ids){
|
public ApiResult<Boolean> del(@RequestBody List<Integer> ids){
|
||||||
VUtils.trueThrow(CollUtil.isEmpty(ids)).throwMessage(STATE.ParamErr,"请选择要删除的行");
|
VUtils.trueThrow(CollUtil.isEmpty(ids)).throwMessage(STATE.ParamErr,"请选择要删除的行");
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import javax.validation.constraints.NotBlank;
|
||||||
@Data
|
@Data
|
||||||
public class BaseAreaEditDTO {
|
public class BaseAreaEditDTO {
|
||||||
|
|
||||||
private Long id=0L;
|
private Integer id=0;
|
||||||
|
|
||||||
|
|
||||||
private Long parentAreaRowId=0L;
|
private Long parentAreaRowId=0L;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ public class CustomerDTO {
|
||||||
/**
|
/**
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ public class AdminBaseAreaService {
|
||||||
List<TBaseAreaVO> allAreaList = Convert.toList(TBaseAreaVO.class,baseAreaService.lambdaQuery()
|
List<TBaseAreaVO> allAreaList = Convert.toList(TBaseAreaVO.class,baseAreaService.lambdaQuery()
|
||||||
.eq(TBaseArea::getDelIs,0)
|
.eq(TBaseArea::getDelIs,0)
|
||||||
.list()) ;
|
.list()) ;
|
||||||
Map<Long, TBaseAreaVO> collect = allAreaList.stream().collect(Collectors.toMap(TBaseAreaVO::getId, Function.identity()));
|
Map<Integer, TBaseAreaVO> collect = allAreaList.stream().collect(Collectors.toMap(TBaseAreaVO::getId, Function.identity()));
|
||||||
List<TBaseAreaVO> allParents=new ArrayList<>();
|
List<TBaseAreaVO> allParents=new ArrayList<>();
|
||||||
for (TBaseAreaVO data:dataResult){
|
for (TBaseAreaVO data:dataResult){
|
||||||
allParents.addAll(getAllParents(data, collect));
|
allParents.addAll(getAllParents(data, collect));
|
||||||
|
|
@ -54,7 +54,7 @@ public class AdminBaseAreaService {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public List<Long> getAllChildIds(TBaseAreaVO node, List<Long> ids) {
|
public List<Integer> getAllChildIds(TBaseAreaVO node, List<Integer> ids) {
|
||||||
List<TBaseAreaVO> immediateChildren = findChildDepartmentsByParentId(node.getId());
|
List<TBaseAreaVO> immediateChildren = findChildDepartmentsByParentId(node.getId());
|
||||||
ids.addAll(immediateChildren.stream().map(u->u.getId()).collect(Collectors.toSet()));
|
ids.addAll(immediateChildren.stream().map(u->u.getId()).collect(Collectors.toSet()));
|
||||||
for (TBaseAreaVO child : immediateChildren) {
|
for (TBaseAreaVO child : immediateChildren) {
|
||||||
|
|
@ -74,13 +74,13 @@ public class AdminBaseAreaService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TBaseAreaVO> findChildDepartmentsByParentId(Long parentId) {
|
private List<TBaseAreaVO> findChildDepartmentsByParentId(Integer parentId) {
|
||||||
List<TBaseArea> areas = baseAreaService.lambdaQuery().eq(TBaseArea::getParentAreaRowId, parentId).eq(TBaseArea::getDelIs,0).list();
|
List<TBaseArea> areas = baseAreaService.lambdaQuery().eq(TBaseArea::getParentAreaRowId, parentId).eq(TBaseArea::getDelIs,0).list();
|
||||||
return Convert.toList(TBaseAreaVO.class,areas);
|
return Convert.toList(TBaseAreaVO.class,areas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private List<TBaseAreaVO> getAllParents(TBaseAreaVO node, Map<Long, TBaseAreaVO> idToNodeMap) {
|
private List<TBaseAreaVO> getAllParents(TBaseAreaVO node, Map<Integer, TBaseAreaVO> idToNodeMap) {
|
||||||
List<TBaseAreaVO> parents = new ArrayList<>();
|
List<TBaseAreaVO> parents = new ArrayList<>();
|
||||||
Long parentId = node.getParentAreaRowId();
|
Long parentId = node.getParentAreaRowId();
|
||||||
while (parentId != null && parentId>0) {
|
while (parentId != null && parentId>0) {
|
||||||
|
|
@ -100,7 +100,7 @@ public class AdminBaseAreaService {
|
||||||
*/
|
*/
|
||||||
private List<TBaseAreaVO> buildTree(List<TBaseAreaVO> nodes) {
|
private List<TBaseAreaVO> buildTree(List<TBaseAreaVO> nodes) {
|
||||||
// 使用Map存储id到Node的映射,便于快速查找父节点
|
// 使用Map存储id到Node的映射,便于快速查找父节点
|
||||||
Map<Long, TBaseAreaVO> idToNodeMap = nodes.stream()
|
Map<Integer, TBaseAreaVO> idToNodeMap = nodes.stream()
|
||||||
.collect(Collectors.toMap(TBaseAreaVO::getId,area->area, (existing, replacement) -> existing));
|
.collect(Collectors.toMap(TBaseAreaVO::getId,area->area, (existing, replacement) -> existing));
|
||||||
|
|
||||||
List<TBaseAreaVO> roots = new ArrayList<>();
|
List<TBaseAreaVO> roots = new ArrayList<>();
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import java.util.List;
|
||||||
public class AreaSimpleVO {
|
public class AreaSimpleVO {
|
||||||
|
|
||||||
//区域id
|
//区域id
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
//区域名称
|
//区域名称
|
||||||
private String name;
|
private String name;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import lombok.experimental.Accessors;
|
||||||
public class CompanySimpleVO {
|
public class CompanySimpleVO {
|
||||||
|
|
||||||
// 公司id
|
// 公司id
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
// 公司编码
|
// 公司编码
|
||||||
private String code;
|
private String code;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import java.util.List;
|
||||||
public class CompanyVO {
|
public class CompanyVO {
|
||||||
|
|
||||||
//公司id
|
//公司id
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
//公司名称
|
//公司名称
|
||||||
private String name;
|
private String name;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ public class TBaseAreaVO implements Serializable {
|
||||||
/**
|
/**
|
||||||
* row_id
|
* row_id
|
||||||
*/
|
*/
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区域编码
|
* 区域编码
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ public class TBaseArea implements Serializable {
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区域编码
|
* 区域编码
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,13 @@ package com.nflg.mobilebroken.repository.entity;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 客户管理
|
* 客户管理
|
||||||
|
|
@ -29,7 +30,7 @@ public class TBaseCustomer implements Serializable {
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 代理公司编码
|
* 代理公司编码
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ public interface TBaseAreaMapper extends BaseMapper<TBaseArea> {
|
||||||
|
|
||||||
void delByIds(@Param("ids")List<Long> ids ,@Param("userNo")String userNo , @Param("userName")String userName);
|
void delByIds(@Param("ids")List<Long> ids ,@Param("userNo")String userNo , @Param("userName")String userName);
|
||||||
|
|
||||||
void upState(@Param("areaState") Integer areaState , @Param("ids")List<Long> ids ,@Param("userNo")String userNo , @Param("userName")String userName);
|
void upState(@Param("areaState") Integer areaState , @Param("ids")List<Integer> ids ,@Param("userNo")String userNo , @Param("userName")String userName);
|
||||||
|
|
||||||
Integer getCount();
|
Integer getCount();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ public interface ITBaseAreaService extends IService<TBaseArea> {
|
||||||
|
|
||||||
void delByIds(@Param("ids") List<Long> ids, String userNo, String userName);
|
void delByIds(@Param("ids") List<Long> ids, String userNo, String userName);
|
||||||
|
|
||||||
void upState(@Param("areaState") Integer areaState , @Param("ids")List<Long> ids ,@Param("userNo")String userNo , @Param("userName")String userName);
|
void upState(@Param("areaState") Integer areaState , @Param("ids")List<Integer> ids ,@Param("userNo")String userNo , @Param("userName")String userName);
|
||||||
|
|
||||||
|
|
||||||
Integer getCount();
|
Integer getCount();
|
||||||
|
|
|
||||||
|
|
@ -416,7 +416,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
|
||||||
@Override
|
@Override
|
||||||
public List<CompanyVO> searchSimpleUsers(SimpleUsersSearchRequest request) {
|
public List<CompanyVO> searchSimpleUsers(SimpleUsersSearchRequest request) {
|
||||||
List<CompanyVO> datas = new ArrayList<>();
|
List<CompanyVO> datas = new ArrayList<>();
|
||||||
Set<Long> companyIds = customerService.lambdaQuery()
|
Set<Integer> companyIds = customerService.lambdaQuery()
|
||||||
.select(TBaseCustomer::getId)
|
.select(TBaseCustomer::getId)
|
||||||
.eq(TBaseCustomer::getEnableState, 1)
|
.eq(TBaseCustomer::getEnableState, 1)
|
||||||
.eq(TBaseCustomer::getDelIs, 0)
|
.eq(TBaseCustomer::getDelIs, 0)
|
||||||
|
|
@ -426,7 +426,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
|
||||||
.map(TBaseCustomer::getId)
|
.map(TBaseCustomer::getId)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
if (StrUtil.isNotBlank(request.getName())) {
|
if (StrUtil.isNotBlank(request.getName())) {
|
||||||
Set<Long> userCompanyIds = lambdaQuery()
|
Set<Integer> userCompanyIds = lambdaQuery()
|
||||||
.select(AppUser::getCompanyId)
|
.select(AppUser::getCompanyId)
|
||||||
.eq(AppUser::getState, UserState.Activated.getState())
|
.eq(AppUser::getState, UserState.Activated.getState())
|
||||||
.eq(AppUser::getIsPrimary, true)
|
.eq(AppUser::getIsPrimary, true)
|
||||||
|
|
@ -435,7 +435,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
|
||||||
.list()
|
.list()
|
||||||
.stream()
|
.stream()
|
||||||
.flatMap(s -> Arrays.stream(s.getCompanyId().split(",")))
|
.flatMap(s -> Arrays.stream(s.getCompanyId().split(",")))
|
||||||
.map(Long::parseLong)
|
.map(Integer::parseInt)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
companyIds.addAll(userCompanyIds);
|
companyIds.addAll(userCompanyIds);
|
||||||
}
|
}
|
||||||
|
|
@ -494,7 +494,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
|
||||||
return getBaseMapper().selectOne(queryWrapper);
|
return getBaseMapper().selectOne(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<AppUserVO> getByCompanyId(Long companyId) {
|
private List<AppUserVO> getByCompanyId(Integer companyId) {
|
||||||
return lambdaQuery()
|
return lambdaQuery()
|
||||||
.eq(AppUser::getCompanyId, companyId.toString())
|
.eq(AppUser::getCompanyId, companyId.toString())
|
||||||
.eq(AppUser::getState, UserState.Activated.getState())
|
.eq(AppUser::getState, UserState.Activated.getState())
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ public class TBaseAreaServiceImpl extends ServiceImpl<TBaseAreaMapper, TBaseArea
|
||||||
this.getBaseMapper().delByIds(ids,userNo,userName);
|
this.getBaseMapper().delByIds(ids,userNo,userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void upState(@Param("areaState") Integer areaState , @Param("ids")List<Long> ids ,@Param("userNo")String userNo , @Param("userName")String userName){
|
public void upState(@Param("areaState") Integer areaState , @Param("ids")List<Integer> ids ,@Param("userNo")String userNo , @Param("userName")String userName){
|
||||||
this.getBaseMapper().upState(areaState, ids, userNo,userName);
|
this.getBaseMapper().upState(areaState, ids, userNo,userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue