更新根据id获取下级地区接口
This commit is contained in:
@ -231,11 +231,11 @@ public class CountryRegionController {
|
||||
|
||||
@GetMapping("/getParentByCode")
|
||||
@ApiOperation(value = "根据id 查询下级区域")
|
||||
public R getRegionByParentId(@RequestParam(required = true) String code,@RequestParam(required = false) String excludeType,
|
||||
public R getParentByCode(@RequestParam(required = true) String code,@RequestParam(required = false) String excludeType,
|
||||
@RequestParam(required = false) String startPCode
|
||||
) {
|
||||
|
||||
return R.ok(countryRegionService.getRegionByParentId(code,excludeType,startPCode));
|
||||
return R.ok(countryRegionService.getParentByCode(code,excludeType,startPCode));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ import com.xjrsoft.module.mdm.vo.LngBRegionVo;
|
||||
public interface ICountryRegionService extends IService<LngBRegion> {
|
||||
|
||||
|
||||
Map<String, Object> getRegionByParentId(String code, String excludeType, String startPCode);
|
||||
Map<String, Object> getParentByCode(String code, String excludeType, String startPCode);
|
||||
|
||||
List<LngBRegionVo> child(Long pid,String excludeType, String keyword,String startPCode);
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ import shade.powerjob.com.google.common.collect.Lists;
|
||||
public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngBRegion> implements ICountryRegionService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getRegionByParentId(String code,String excludeType,String startPCode) {
|
||||
public Map<String, Object> getParentByCode(String code,String excludeType,String startPCode) {
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
LambdaQueryWrapper<LngBRegion> queryWrapper = new LambdaQueryWrapper<LngBRegion>();
|
||||
queryWrapper.eq(LngBRegion::getCode,code);
|
||||
@ -51,17 +51,17 @@ public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngB
|
||||
List<String> excludeTypeList = CollectionUtils.newArrayList();
|
||||
if(StringUtils.isNotBlank(startPCode)) {
|
||||
LambdaQueryWrapper<LngBRegion> qw = new LambdaQueryWrapper<LngBRegion>();
|
||||
queryWrapper.eq(LngBRegion::getCode,startPCode);
|
||||
qw.eq(LngBRegion::getCode,startPCode);
|
||||
LngBRegion tempPr = this.getOne(qw);
|
||||
excludeTypeList.add(tempPr.getRegionTypeCode());
|
||||
}
|
||||
if(StringUtils.isNotBlank(startPCode)) {
|
||||
if(StringUtils.isNotBlank(excludeType)) {
|
||||
excludeTypeList.add(excludeType);
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<LngBRegion> tempQw = Wrappers.<LngBRegion>query().lambda()
|
||||
.ne(StringUtils.isNotBlank(excludeType),LngBRegion::getRegionTypeCode, excludeType)
|
||||
.eq(StringUtils.isNotBlank(startPCode),LngBRegion::getCode, startPCode);
|
||||
.notIn(StringUtils.isNotBlank(excludeType),LngBRegion::getRegionTypeCode, excludeTypeList);
|
||||
//.eq(StringUtils.isNotBlank(startPCode),LngBRegion::getCode, startPCode);
|
||||
List<LngBRegion> allList = this.list(tempQw);
|
||||
Map<Long,LngBRegion> map = allList.stream().collect(Collectors.toMap(LngBRegion::getId,
|
||||
obj -> obj));
|
||||
|
||||
@ -1,36 +1,39 @@
|
||||
package com.xjrsoft.module.sales.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.page.ConventPage;
|
||||
import com.xjrsoft.common.page.PageOutput;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||
import com.xjrsoft.module.sales.dto.AddLngCustomerDto;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerDto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||
import com.xjrsoft.module.sales.dto.LngCustomerPageDto;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerDto;
|
||||
import com.xjrsoft.module.sales.entity.LngCustomer;
|
||||
import com.xjrsoft.module.sales.service.ICustomerService;
|
||||
import com.xjrsoft.module.sales.vo.LngCustomerPageVo;
|
||||
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.sales.vo.LngCustomerVo;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: 客户
|
||||
@ -39,8 +42,8 @@ import java.util.List;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sales" + "/customer")
|
||||
@Api(value = "/sales" + "/customer",tags = "客户代码")
|
||||
@RequestMapping("/sales/customer")
|
||||
@Api(value = "/sales/customer",tags = "客户管理")
|
||||
@AllArgsConstructor
|
||||
public class CustomerController {
|
||||
|
||||
@ -64,8 +67,7 @@ public class CustomerController {
|
||||
.like(StrUtil.isNotBlank(dto.getNatureCode()),LngCustomer::getNatureCode,dto.getNatureCode())
|
||||
.like(StrUtil.isNotBlank(dto.getValid()),LngCustomer::getValid,dto.getValid())
|
||||
.like(StrUtil.isNotBlank(dto.getApproCode()),LngCustomer::getApproCode,dto.getApproCode())
|
||||
.orderByDesc(LngCustomer::getId)
|
||||
.select(LngCustomer.class,x -> VoToColumnUtil.fieldsToColumns(LngCustomerPageVo.class).contains(x.getProperty()));
|
||||
.orderByDesc(LngCustomer::getId);
|
||||
IPage<LngCustomer> page = customerService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<LngCustomerPageVo> pageOutput = ConventPage.getPageOutput(page, LngCustomerPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
|
||||
@ -1,20 +1,17 @@
|
||||
package com.xjrsoft.module.sales.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.github.yulichang.annotation.EntityMapping;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user