更新根据id获取下级地区接口
This commit is contained in:
@ -231,11 +231,11 @@ public class CountryRegionController {
|
|||||||
|
|
||||||
@GetMapping("/getParentByCode")
|
@GetMapping("/getParentByCode")
|
||||||
@ApiOperation(value = "根据id 查询下级区域")
|
@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
|
@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> {
|
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);
|
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 {
|
public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngBRegion> implements ICountryRegionService {
|
||||||
|
|
||||||
@Override
|
@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<>();
|
Map<String,Object> result = new HashMap<>();
|
||||||
LambdaQueryWrapper<LngBRegion> queryWrapper = new LambdaQueryWrapper<LngBRegion>();
|
LambdaQueryWrapper<LngBRegion> queryWrapper = new LambdaQueryWrapper<LngBRegion>();
|
||||||
queryWrapper.eq(LngBRegion::getCode,code);
|
queryWrapper.eq(LngBRegion::getCode,code);
|
||||||
@ -51,17 +51,17 @@ public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngB
|
|||||||
List<String> excludeTypeList = CollectionUtils.newArrayList();
|
List<String> excludeTypeList = CollectionUtils.newArrayList();
|
||||||
if(StringUtils.isNotBlank(startPCode)) {
|
if(StringUtils.isNotBlank(startPCode)) {
|
||||||
LambdaQueryWrapper<LngBRegion> qw = new LambdaQueryWrapper<LngBRegion>();
|
LambdaQueryWrapper<LngBRegion> qw = new LambdaQueryWrapper<LngBRegion>();
|
||||||
queryWrapper.eq(LngBRegion::getCode,startPCode);
|
qw.eq(LngBRegion::getCode,startPCode);
|
||||||
LngBRegion tempPr = this.getOne(qw);
|
LngBRegion tempPr = this.getOne(qw);
|
||||||
excludeTypeList.add(tempPr.getRegionTypeCode());
|
excludeTypeList.add(tempPr.getRegionTypeCode());
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotBlank(startPCode)) {
|
if(StringUtils.isNotBlank(excludeType)) {
|
||||||
excludeTypeList.add(excludeType);
|
excludeTypeList.add(excludeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
LambdaQueryWrapper<LngBRegion> tempQw = Wrappers.<LngBRegion>query().lambda()
|
LambdaQueryWrapper<LngBRegion> tempQw = Wrappers.<LngBRegion>query().lambda()
|
||||||
.ne(StringUtils.isNotBlank(excludeType),LngBRegion::getRegionTypeCode, excludeType)
|
.notIn(StringUtils.isNotBlank(excludeType),LngBRegion::getRegionTypeCode, excludeTypeList);
|
||||||
.eq(StringUtils.isNotBlank(startPCode),LngBRegion::getCode, startPCode);
|
//.eq(StringUtils.isNotBlank(startPCode),LngBRegion::getCode, startPCode);
|
||||||
List<LngBRegion> allList = this.list(tempQw);
|
List<LngBRegion> allList = this.list(tempQw);
|
||||||
Map<Long,LngBRegion> map = allList.stream().collect(Collectors.toMap(LngBRegion::getId,
|
Map<Long,LngBRegion> map = allList.stream().collect(Collectors.toMap(LngBRegion::getId,
|
||||||
obj -> obj));
|
obj -> obj));
|
||||||
|
|||||||
@ -1,36 +1,39 @@
|
|||||||
package com.xjrsoft.module.sales.controller;
|
package com.xjrsoft.module.sales.controller;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import java.util.List;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
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.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.xjrsoft.common.model.result.R;
|
||||||
import com.xjrsoft.common.constant.GlobalConstant;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
||||||
import com.xjrsoft.common.page.ConventPage;
|
import com.xjrsoft.common.page.ConventPage;
|
||||||
import com.xjrsoft.common.page.PageOutput;
|
import com.xjrsoft.common.page.PageOutput;
|
||||||
import com.xjrsoft.common.model.result.R;
|
|
||||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||||
import com.xjrsoft.module.sales.dto.AddLngCustomerDto;
|
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerDto;
|
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
||||||
|
|
||||||
import com.xjrsoft.module.sales.dto.LngCustomerPageDto;
|
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.entity.LngCustomer;
|
||||||
import com.xjrsoft.module.sales.service.ICustomerService;
|
import com.xjrsoft.module.sales.service.ICustomerService;
|
||||||
import com.xjrsoft.module.sales.vo.LngCustomerPageVo;
|
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 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.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title: 客户
|
* @title: 客户
|
||||||
@ -39,8 +42,8 @@ import java.util.List;
|
|||||||
* @Version 1.0
|
* @Version 1.0
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/sales" + "/customer")
|
@RequestMapping("/sales/customer")
|
||||||
@Api(value = "/sales" + "/customer",tags = "客户代码")
|
@Api(value = "/sales/customer",tags = "客户管理")
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class CustomerController {
|
public class CustomerController {
|
||||||
|
|
||||||
@ -64,8 +67,7 @@ public class CustomerController {
|
|||||||
.like(StrUtil.isNotBlank(dto.getNatureCode()),LngCustomer::getNatureCode,dto.getNatureCode())
|
.like(StrUtil.isNotBlank(dto.getNatureCode()),LngCustomer::getNatureCode,dto.getNatureCode())
|
||||||
.like(StrUtil.isNotBlank(dto.getValid()),LngCustomer::getValid,dto.getValid())
|
.like(StrUtil.isNotBlank(dto.getValid()),LngCustomer::getValid,dto.getValid())
|
||||||
.like(StrUtil.isNotBlank(dto.getApproCode()),LngCustomer::getApproCode,dto.getApproCode())
|
.like(StrUtil.isNotBlank(dto.getApproCode()),LngCustomer::getApproCode,dto.getApproCode())
|
||||||
.orderByDesc(LngCustomer::getId)
|
.orderByDesc(LngCustomer::getId);
|
||||||
.select(LngCustomer.class,x -> VoToColumnUtil.fieldsToColumns(LngCustomerPageVo.class).contains(x.getProperty()));
|
|
||||||
IPage<LngCustomer> page = customerService.page(ConventPage.getPage(dto), queryWrapper);
|
IPage<LngCustomer> page = customerService.page(ConventPage.getPage(dto), queryWrapper);
|
||||||
PageOutput<LngCustomerPageVo> pageOutput = ConventPage.getPageOutput(page, LngCustomerPageVo.class);
|
PageOutput<LngCustomerPageVo> pageOutput = ConventPage.getPageOutput(page, LngCustomerPageVo.class);
|
||||||
return R.ok(pageOutput);
|
return R.ok(pageOutput);
|
||||||
@ -110,7 +112,7 @@ public class CustomerController {
|
|||||||
@ApiOperation(value = "删除")
|
@ApiOperation(value = "删除")
|
||||||
@SaCheckPermission("customer:delete")
|
@SaCheckPermission("customer:delete")
|
||||||
public R delete(@Valid @RequestBody List<Long> ids){
|
public R delete(@Valid @RequestBody List<Long> ids){
|
||||||
return R.ok(dataService.deleteByIds(UpdateLngCustomerDto.class, ids));
|
return R.ok(dataService.deleteByIds(UpdateLngCustomerDto.class, ids));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +120,7 @@ public class CustomerController {
|
|||||||
@ApiOperation(value = "启用LngCustomer")
|
@ApiOperation(value = "启用LngCustomer")
|
||||||
@SaCheckPermission("customer:enable")
|
@SaCheckPermission("customer:enable")
|
||||||
public R enable(@Valid @RequestBody List<Long> ids){
|
public R enable(@Valid @RequestBody List<Long> ids){
|
||||||
return R.ok(dataService.enable(UpdateLngCustomerDto.class,ids));
|
return R.ok(dataService.enable(UpdateLngCustomerDto.class,ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -126,7 +128,7 @@ public class CustomerController {
|
|||||||
@ApiOperation(value = "禁用LngCustomer")
|
@ApiOperation(value = "禁用LngCustomer")
|
||||||
@SaCheckPermission("customer:disable")
|
@SaCheckPermission("customer:disable")
|
||||||
public R disable(@Valid @RequestBody List<Long> ids){
|
public R disable(@Valid @RequestBody List<Long> ids){
|
||||||
return R.ok(dataService.disable(UpdateLngCustomerDto.class,ids));
|
return R.ok(dataService.disable(UpdateLngCustomerDto.class,ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,20 +1,17 @@
|
|||||||
package com.xjrsoft.module.sales.entity;
|
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.FieldFill;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
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.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.Version;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.github.yulichang.annotation.EntityMapping;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
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