24 changed files with 998 additions and 15 deletions
@ -0,0 +1,103 @@ |
|||||
|
package com.qs.serve.modules.bms.controller; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.annotation.SysLog; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.model.enums.BizType; |
||||
|
import com.qs.serve.common.model.enums.SystemModule; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import com.qs.serve.modules.bms.entity.BmsSupplierUser; |
||||
|
import com.qs.serve.modules.bms.service.BmsSupplierUserService; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 基础档案 客户分配 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-13 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("bms/supplierUser") |
||||
|
public class BmsSupplierUserController { |
||||
|
|
||||
|
private BmsSupplierUserService bmsSupplierUserService; |
||||
|
|
||||
|
/** |
||||
|
* 翻页查询 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/page") |
||||
|
@PreAuthorize("hasRole('bms:supplierUser:query')") |
||||
|
public R<PageVo<BmsSupplierUser>> getPage(BmsSupplierUser param){ |
||||
|
PageUtil.startPage(); |
||||
|
LambdaQueryWrapper<BmsSupplierUser> supplierUserWrapper = new LambdaQueryWrapper<>(param); |
||||
|
List<BmsSupplierUser> list = bmsSupplierUserService.list(supplierUserWrapper); |
||||
|
return R.byPageHelperList(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
@SysLog(module = SystemModule.BASE, title = "供应商分配", biz = BizType.QUERY) |
||||
|
@PreAuthorize("hasRole('bms:supplierUser:query')") |
||||
|
public R<BmsSupplierUser> getById(@PathVariable("id") String id){ |
||||
|
BmsSupplierUser bmsSupplierUser = bmsSupplierUserService.getById(id); |
||||
|
return R.ok(bmsSupplierUser); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 根据ID更新 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/updateById") |
||||
|
@SysLog(module = SystemModule.BASE, title = "供应商分配", biz = BizType.UPDATE) |
||||
|
@PreAuthorize("hasRole('bms:supplierUser:update')") |
||||
|
public R<?> updateById(@RequestBody @Valid BmsSupplierUser param){ |
||||
|
boolean result = bmsSupplierUserService.updateById(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增供应商分配 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/save") |
||||
|
@SysLog(module = SystemModule.BASE, title = "供应商分配", biz = BizType.INSERT) |
||||
|
@PreAuthorize("hasRole('bms:supplierUser:insert')") |
||||
|
public R<?> save(@RequestBody @Valid BmsSupplierUser param){ |
||||
|
boolean result = bmsSupplierUserService.save(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除供应商分配 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@DeleteMapping("/deleteById/{id}") |
||||
|
@SysLog(module = SystemModule.BASE, title = "供应商分配", biz = BizType.DELETE) |
||||
|
@PreAuthorize("hasRole('bms:supplierUser:delete')") |
||||
|
public R<?> deleteById(@PathVariable("id") String id){ |
||||
|
boolean result = bmsSupplierUserService.removeById(id); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,60 @@ |
|||||
|
package com.qs.serve.modules.bms.controller.api; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.annotation.SysLog; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.model.enums.BizType; |
||||
|
import com.qs.serve.common.model.enums.SystemModule; |
||||
|
import com.qs.serve.common.util.CopierUtil; |
||||
|
import com.qs.serve.common.util.IdUtil; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import com.qs.serve.common.util.ValidateTools; |
||||
|
import com.qs.serve.modules.bms.entity.BmsRegion; |
||||
|
import com.qs.serve.modules.bms.entity.vo.BmsRegionBatchBo; |
||||
|
import com.qs.serve.modules.bms.entity.vo.BmsRegionTreeVo; |
||||
|
import com.qs.serve.modules.bms.service.BmsRegionService; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* API基础档案 区域档案 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-10 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/api/region") |
||||
|
public class BmsRegionApi { |
||||
|
|
||||
|
private BmsRegionService bmsRegionService; |
||||
|
|
||||
|
/** |
||||
|
* 树查询 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/tree") |
||||
|
public R<List<BmsRegionTreeVo>> getTree(BmsRegion param){ |
||||
|
return R.ok(bmsRegionService.getTree(param)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
public R<BmsRegion> getById(@PathVariable("id") String id){ |
||||
|
BmsRegion bmsRegion = bmsRegionService.getById(id); |
||||
|
return R.ok(bmsRegion); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,140 @@ |
|||||
|
package com.qs.serve.modules.bms.controller.api; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.annotation.SysLog; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.model.enums.BizType; |
||||
|
import com.qs.serve.common.model.enums.SystemModule; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import com.qs.serve.modules.bms.entity.BmsSupplierAddress; |
||||
|
import com.qs.serve.modules.bms.service.BmsSupplierAddressService; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* API基础档案 客户收货地址 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-12 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("api/supplierAddress") |
||||
|
public class BmsSupplierAddressApi { |
||||
|
|
||||
|
private BmsSupplierAddressService bmsSupplierAddressService; |
||||
|
|
||||
|
/** |
||||
|
* 翻页查询 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/page") |
||||
|
@PreAuthorize("hasRole('bms:supplierAddress:query')") |
||||
|
public R<PageVo<BmsSupplierAddress>> getPage(BmsSupplierAddress param){ |
||||
|
PageUtil.startPage(); |
||||
|
LambdaQueryWrapper<BmsSupplierAddress> supplierAddressWrapper = new LambdaQueryWrapper<>(param); |
||||
|
List<BmsSupplierAddress> list = bmsSupplierAddressService.list(supplierAddressWrapper); |
||||
|
return R.byPageHelperList(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.QUERY) |
||||
|
@PreAuthorize("hasRole('bms:supplierAddress:query')") |
||||
|
public R<BmsSupplierAddress> getById(@PathVariable("id") String id){ |
||||
|
BmsSupplierAddress bmsSupplierAddress = bmsSupplierAddressService.getById(id); |
||||
|
return R.ok(bmsSupplierAddress); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 根据ID更新 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/updateById") |
||||
|
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.UPDATE) |
||||
|
@PreAuthorize("hasRole('bms:supplierAddress:update')") |
||||
|
public R<?> updateById(@RequestBody @Valid BmsSupplierAddress param){ |
||||
|
BmsSupplierAddress supplierAddress = bmsSupplierAddressService.getDefault(param.getSupplierId()); |
||||
|
if(supplierAddress==null){ |
||||
|
param.setDefaultFlag(1); |
||||
|
}else { |
||||
|
param.setDefaultFlag(0); |
||||
|
} |
||||
|
boolean result = bmsSupplierAddressService.updateById(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/save") |
||||
|
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.INSERT) |
||||
|
@PreAuthorize("hasRole('bms:supplierAddress:insert')") |
||||
|
public R<?> save(@RequestBody @Valid BmsSupplierAddress param){ |
||||
|
BmsSupplierAddress supplierAddress = bmsSupplierAddressService.getDefault(param.getSupplierId()); |
||||
|
if(supplierAddress==null){ |
||||
|
param.setDefaultFlag(1); |
||||
|
}else { |
||||
|
param.setDefaultFlag(0); |
||||
|
} |
||||
|
boolean result = bmsSupplierAddressService.save(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 设置默认的地址 |
||||
|
* @param id 地址ID |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/setDefault") |
||||
|
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.INSERT) |
||||
|
@PreAuthorize("hasRole('bms:supplierAddress:insert')") |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public R<?> setDefault(@RequestBody @Valid Long id){ |
||||
|
BmsSupplierAddress supplierAddress = bmsSupplierAddressService.getById(id); |
||||
|
List<BmsSupplierAddress> list = bmsSupplierAddressService.listBySupplierId(supplierAddress.getSupplierId()); |
||||
|
//设置其它
|
||||
|
for (BmsSupplierAddress address : list) { |
||||
|
if(!address.getId().equals(id)){ |
||||
|
address.setDefaultFlag(0); |
||||
|
bmsSupplierAddressService.updateById(address); |
||||
|
} |
||||
|
} |
||||
|
//设置默认
|
||||
|
supplierAddress.setDefaultFlag(1); |
||||
|
bmsSupplierAddressService.updateById(supplierAddress); |
||||
|
return R.ok(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@DeleteMapping("/deleteById/{id}") |
||||
|
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.DELETE) |
||||
|
@PreAuthorize("hasRole('bms:supplierAddress:delete')") |
||||
|
public R<?> deleteById(@PathVariable("id") String id){ |
||||
|
boolean result = bmsSupplierAddressService.removeById(id); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,100 @@ |
|||||
|
package com.qs.serve.modules.bms.controller.api; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.annotation.SysLog; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.model.enums.BizType; |
||||
|
import com.qs.serve.common.model.enums.SystemModule; |
||||
|
import com.qs.serve.common.util.CopierUtil; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import com.qs.serve.common.util.TreeUtil; |
||||
|
import com.qs.serve.modules.bms.entity.BmsSupplier; |
||||
|
import com.qs.serve.modules.bms.entity.vo.BmsSupplierBatchBo; |
||||
|
import com.qs.serve.modules.bms.entity.vo.BmsSupplierBo; |
||||
|
import com.qs.serve.modules.bms.entity.vo.BmsSupplierTreeVo; |
||||
|
import com.qs.serve.modules.bms.service.BmsSupplierService; |
||||
|
import com.qs.serve.modules.wx.entity.WxUser; |
||||
|
import com.qs.serve.modules.wx.service.WxUserService; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* API基础档案 客户 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-10 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/api/supplier") |
||||
|
public class BmsSupplierApi { |
||||
|
|
||||
|
private final BmsSupplierService bmsSupplierService; |
||||
|
private final WxUserService wxUserService; |
||||
|
|
||||
|
/** |
||||
|
* 翻页查询 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/page") |
||||
|
@PreAuthorize("hasRole('bms:supplier:query')") |
||||
|
public R<PageVo<BmsSupplier>> getPage(BmsSupplier param){ |
||||
|
WxUser wxUser = wxUserService.getCurrentWxUser(); |
||||
|
if(wxUser.getSysUserId()==null||wxUser.getSysUserId().equals("0")){ |
||||
|
return R.byEmptyList(); |
||||
|
} |
||||
|
param.setCurrUserId(wxUser.getSysUserId()); |
||||
|
PageUtil.startPage(); |
||||
|
List<BmsSupplier> list = bmsSupplierService.selectSupplierList(param); |
||||
|
return R.byPageHelperList(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 树查询 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/tree") |
||||
|
@PreAuthorize("hasRole('bms:supplier:query')") |
||||
|
public R<List<BmsSupplierTreeVo>> getTree(BmsSupplier param){ |
||||
|
WxUser wxUser = wxUserService.getCurrentWxUser(); |
||||
|
if(wxUser.getSysUserId()==null||wxUser.getSysUserId().equals("0")){ |
||||
|
return R.ok(new ArrayList<>()); |
||||
|
} |
||||
|
param.setCurrUserId(wxUser.getSysUserId()); |
||||
|
List<BmsSupplier> list = bmsSupplierService.selectSupplierList(param); |
||||
|
List<BmsSupplierTreeVo> list2 = list.stream().map(supplier->{ |
||||
|
BmsSupplierTreeVo treeNode = CopierUtil.copy(supplier,new BmsSupplierTreeVo()); |
||||
|
treeNode.setId(supplier.getId()); |
||||
|
treeNode.setParentId(supplier.getPid()); |
||||
|
treeNode.setSort(0); |
||||
|
return treeNode; |
||||
|
}).collect(Collectors.toList()); |
||||
|
list2 = TreeUtil.buildByRecursive(list2,TreeUtil.DEFAULT_PID_STRING); |
||||
|
return R.ok(list2); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
@SysLog(module = SystemModule.BASE, title = "供应商", biz = BizType.QUERY) |
||||
|
@PreAuthorize("hasRole('bms:supplier:query')") |
||||
|
public R<BmsSupplier> getById(@PathVariable("id") String id){ |
||||
|
BmsSupplier bmsSupplier = bmsSupplierService.getById(id); |
||||
|
return R.ok(bmsSupplier); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,102 @@ |
|||||
|
package com.qs.serve.modules.bms.controller.api; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.annotation.SysLog; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.model.enums.BizType; |
||||
|
import com.qs.serve.common.model.enums.SystemModule; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import com.qs.serve.modules.bms.entity.BmsSupplierBand; |
||||
|
import com.qs.serve.modules.bms.service.BmsSupplierBandService; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* API基础档案 客户银行信息 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-12 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/api/supplierBand") |
||||
|
public class BmsSupplierBandApi { |
||||
|
|
||||
|
private BmsSupplierBandService bmsSupplierBandService; |
||||
|
|
||||
|
/** |
||||
|
* 翻页查询 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/page") |
||||
|
@PreAuthorize("hasRole('bms:supplierBand:query')") |
||||
|
public R<PageVo<BmsSupplierBand>> getPage(BmsSupplierBand param){ |
||||
|
PageUtil.startPage(); |
||||
|
LambdaQueryWrapper<BmsSupplierBand> supplierBandWrapper = new LambdaQueryWrapper<>(param); |
||||
|
List<BmsSupplierBand> list = bmsSupplierBandService.list(supplierBandWrapper); |
||||
|
return R.byPageHelperList(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.QUERY) |
||||
|
@PreAuthorize("hasRole('bms:supplierBand:query')") |
||||
|
public R<BmsSupplierBand> getById(@PathVariable("id") String id){ |
||||
|
BmsSupplierBand bmsSupplierBand = bmsSupplierBandService.getById(id); |
||||
|
return R.ok(bmsSupplierBand); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 根据ID更新 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/updateById") |
||||
|
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.UPDATE) |
||||
|
@PreAuthorize("hasRole('bms:supplierBand:update')") |
||||
|
public R<?> updateById(@RequestBody @Valid BmsSupplierBand param){ |
||||
|
boolean result = bmsSupplierBandService.updateById(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/save") |
||||
|
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.INSERT) |
||||
|
@PreAuthorize("hasRole('bms:supplierBand:insert')") |
||||
|
public R<?> save(@RequestBody @Valid BmsSupplierBand param){ |
||||
|
boolean result = bmsSupplierBandService.save(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@DeleteMapping("/deleteById/{id}") |
||||
|
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.DELETE) |
||||
|
@PreAuthorize("hasRole('bms:supplierBand:delete')") |
||||
|
public R<?> deleteById(@PathVariable("id") String id){ |
||||
|
boolean result = bmsSupplierBandService.removeById(id); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,76 @@ |
|||||
|
package com.qs.serve.modules.bms.entity; |
||||
|
|
||||
|
import java.time.LocalDateTime; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import lombok.Data; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
/** |
||||
|
* 供应商分配 实体类 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-13 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("bms_supplier_user") |
||||
|
public class BmsSupplierUser implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** id */ |
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
/** 供应商id */ |
||||
|
@NotNull(message = "供应商id不能为空") |
||||
|
private Long supplierId; |
||||
|
|
||||
|
/** 用户id */ |
||||
|
@NotBlank(message = "用户id不能为空") |
||||
|
@Length(max = 32,message = "用户id长度不能超过32字") |
||||
|
private String userId; |
||||
|
|
||||
|
/** 备注 */ |
||||
|
@Length(max = 255,message = "备注长度不能超过255字") |
||||
|
private String remark; |
||||
|
|
||||
|
/** 创建时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
/** 最后更新时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
@TableField(fill = FieldFill.UPDATE) |
||||
|
private LocalDateTime updateTime; |
||||
|
|
||||
|
/** 所属租户 */ |
||||
|
@JsonIgnore |
||||
|
@JsonProperty |
||||
|
private String tenantId; |
||||
|
|
||||
|
/** 逻辑删除标记(0:显示;1:隐藏) */ |
||||
|
@JsonIgnore |
||||
|
@JsonProperty |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** 创建人 */ |
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private String createBy; |
||||
|
|
||||
|
/** 更新人 */ |
||||
|
@TableField(fill = FieldFill.UPDATE) |
||||
|
private String updateBy; |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,14 @@ |
|||||
|
package com.qs.serve.modules.bms.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.qs.serve.modules.bms.entity.BmsSupplierUser; |
||||
|
|
||||
|
/** |
||||
|
* 供应商分配 Mapper |
||||
|
* @author YenHex |
||||
|
* @date 2022-10-13 |
||||
|
*/ |
||||
|
public interface BmsSupplierUserMapper extends BaseMapper<BmsSupplierUser> { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,19 @@ |
|||||
|
package com.qs.serve.modules.bms.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.qs.serve.modules.bms.entity.BmsSupplier; |
||||
|
import com.qs.serve.modules.bms.entity.BmsSupplierUser; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 供应商分配 服务接口 |
||||
|
* @author YenHex |
||||
|
* @date 2022-10-13 |
||||
|
*/ |
||||
|
public interface BmsSupplierUserService extends IService<BmsSupplierUser> { |
||||
|
|
||||
|
//BmsSupplier list
|
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,22 @@ |
|||||
|
package com.qs.serve.modules.bms.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.qs.serve.modules.bms.entity.BmsSupplierUser; |
||||
|
import com.qs.serve.modules.bms.service.BmsSupplierUserService; |
||||
|
import com.qs.serve.modules.bms.mapper.BmsSupplierUserMapper; |
||||
|
|
||||
|
/** |
||||
|
* 供应商分配 服务实现类 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-13 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class BmsSupplierUserServiceImpl extends ServiceImpl<BmsSupplierUserMapper,BmsSupplierUser> implements BmsSupplierUserService { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,58 @@ |
|||||
|
package com.qs.serve.modules.goods.controller.api; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.annotation.SysLog; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.model.enums.BizType; |
||||
|
import com.qs.serve.common.model.enums.SystemModule; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsBrand; |
||||
|
import com.qs.serve.modules.goods.service.GoodsBrandService; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* API商品品牌 |
||||
|
* @author YenHex |
||||
|
* @since 2022/10/13 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("api/brand") |
||||
|
public class GoodsBrandApi { |
||||
|
|
||||
|
private GoodsBrandService goodsBrandService; |
||||
|
|
||||
|
/** |
||||
|
* 列表 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/list") |
||||
|
public R<List<GoodsBrand>> getPage(GoodsBrand param){ |
||||
|
LambdaQueryWrapper<GoodsBrand> brandWrapper = new LambdaQueryWrapper<>(param); |
||||
|
List<GoodsBrand> list = goodsBrandService.list(brandWrapper); |
||||
|
return R.ok(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
public R<GoodsBrand> getById(@PathVariable("id") String id){ |
||||
|
GoodsBrand goodsBrand = goodsBrandService.getById(id); |
||||
|
return R.ok(goodsBrand); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,69 @@ |
|||||
|
package com.qs.serve.modules.goods.controller.api; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.annotation.SysLog; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.model.enums.BizType; |
||||
|
import com.qs.serve.common.model.enums.SystemModule; |
||||
|
import com.qs.serve.common.util.CopierUtil; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import com.qs.serve.common.util.TreeUtil; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsCategory; |
||||
|
import com.qs.serve.modules.goods.entity.bo.GoodsCategoryTreeVo; |
||||
|
import com.qs.serve.modules.goods.service.GoodsCategoryService; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* API商品分类 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-09 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/api/category") |
||||
|
public class GoodsCategoryApi { |
||||
|
|
||||
|
private GoodsCategoryService goodsCategoryService; |
||||
|
|
||||
|
/** |
||||
|
* 树查询 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/tree") |
||||
|
public R<List<GoodsCategoryTreeVo>> getTree(GoodsCategory param){ |
||||
|
LambdaQueryWrapper<GoodsCategory> lqw = new LambdaQueryWrapper<>(param); |
||||
|
List<GoodsCategory> list = goodsCategoryService.list(lqw); |
||||
|
List<GoodsCategoryTreeVo> treeVoList = list.stream().map(cate->{ |
||||
|
GoodsCategoryTreeVo treeNode = CopierUtil.copy(cate,new GoodsCategoryTreeVo()); |
||||
|
treeNode.setId(cate.getId()+""); |
||||
|
treeNode.setParentId(cate.getParentId()); |
||||
|
treeNode.setSort(0); |
||||
|
return treeNode; |
||||
|
}).collect(Collectors.toList()); |
||||
|
treeVoList = TreeUtil.buildByRecursive(treeVoList,TreeUtil.DEFAULT_PID_STRING); |
||||
|
return R.ok(treeVoList); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
public R<GoodsCategory> getById(@PathVariable("id") String id){ |
||||
|
GoodsCategory goodsCategory = goodsCategoryService.getById(id); |
||||
|
return R.ok(goodsCategory); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,57 @@ |
|||||
|
package com.qs.serve.modules.goods.controller.api; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.annotation.SysLog; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.model.enums.BizType; |
||||
|
import com.qs.serve.common.model.enums.SystemModule; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsSeries; |
||||
|
import com.qs.serve.modules.goods.service.GoodsSeriesService; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* API商品系列 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-11 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/api/series") |
||||
|
public class GoodsSeriesApi { |
||||
|
|
||||
|
private GoodsSeriesService goodsSeriesService; |
||||
|
|
||||
|
/** |
||||
|
* 列表 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/list") |
||||
|
public R<List<GoodsSeries>> getPage(GoodsSeries param){ |
||||
|
LambdaQueryWrapper<GoodsSeries> seriesWrapper = new LambdaQueryWrapper<>(param); |
||||
|
List<GoodsSeries> list = goodsSeriesService.list(seriesWrapper); |
||||
|
return R.ok(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
public R<GoodsSeries> getById(@PathVariable("id") String id){ |
||||
|
GoodsSeries goodsSeries = goodsSeriesService.getById(id); |
||||
|
return R.ok(goodsSeries); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,60 @@ |
|||||
|
package com.qs.serve.modules.goods.controller.api; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.annotation.SysLog; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.model.enums.BizType; |
||||
|
import com.qs.serve.common.model.enums.SystemModule; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsSpu; |
||||
|
import com.qs.serve.modules.goods.entity.bo.GoodsSpuBatchTasteBo; |
||||
|
import com.qs.serve.modules.goods.entity.vo.GoodsSpuVo; |
||||
|
import com.qs.serve.modules.goods.service.GoodsSpuService; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* API商品spu |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-09 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/api/spu") |
||||
|
public class GoodsSpuApi { |
||||
|
|
||||
|
private GoodsSpuService goodsSpuService; |
||||
|
|
||||
|
/** |
||||
|
* 翻页搜索 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/page") |
||||
|
public R<PageVo<GoodsSpu>> getPage(GoodsSpu param){ |
||||
|
PageUtil.startPage(); |
||||
|
LambdaQueryWrapper<GoodsSpu> spuWrapper = new LambdaQueryWrapper<>(param); |
||||
|
List<GoodsSpu> list = goodsSpuService.list(spuWrapper); |
||||
|
return R.byPageHelperList(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
public R<GoodsSpuVo> getById(@PathVariable("id") Long id){ |
||||
|
GoodsSpuVo goodsSpu = goodsSpuService.getVoById(id); |
||||
|
return R.ok(goodsSpu); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,72 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper |
||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.qs.serve.modules.bms.mapper.BmsSupplierMapper"> |
||||
|
|
||||
|
<resultMap id="bmsSupplierMap" type="com.qs.serve.modules.bms.entity.BmsSupplier" > |
||||
|
<result property="id" column="id"/> |
||||
|
<result property="regionFirst" column="region_first"/> |
||||
|
<result property="regionSecond" column="region_second"/> |
||||
|
<result property="regionThird" column="region_third"/> |
||||
|
<result property="address" column="address"/> |
||||
|
<result property="name" column="name"/> |
||||
|
<result property="code" column="code"/> |
||||
|
<result property="pid" column="pid"/> |
||||
|
<result property="parentCode" column="parent_code"/> |
||||
|
<result property="belong" column="belong"/> |
||||
|
<result property="createTime" column="create_time"/> |
||||
|
<result property="createBy" column="create_by"/> |
||||
|
<result property="updateTime" column="update_time"/> |
||||
|
<result property="updateBy" column="update_by"/> |
||||
|
<result property="tenantId" column="tenant_id"/> |
||||
|
<result property="delFlag" column="del_flag"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<sql id="bmsSupplierSql"> |
||||
|
bms_supplier.`id`, |
||||
|
bms_supplier.`region_first`, |
||||
|
bms_supplier.`region_second`, |
||||
|
bms_supplier.`region_third`, |
||||
|
bms_supplier.`address`, |
||||
|
bms_supplier.`name`, |
||||
|
bms_supplier.`code`, |
||||
|
bms_supplier.`pid`, |
||||
|
bms_supplier.`parent_code`, |
||||
|
bms_supplier.`belong`, |
||||
|
bms_supplier.`create_time`, |
||||
|
bms_supplier.`create_by`, |
||||
|
bms_supplier.`update_time`, |
||||
|
bms_supplier.`update_by`, |
||||
|
bms_supplier.`tenant_id`, |
||||
|
bms_supplier.`del_flag` </sql> |
||||
|
|
||||
|
<select id="selectSupplierList" parameterType="com.qs.serve.modules.bms.entity.BmsSupplier" resultMap="bmsSupplierMap"> |
||||
|
SELECT <include refid="bmsSupplierSql"/> FROM `bms_supplier` `bms_supplier` |
||||
|
<if test="query.currUserId!=null and query.currUserId != ''"> |
||||
|
LEFT JOIN `bms_supplier_user` ON `bms_supplier`.`id` = `bms_supplier_user`.`supplier_id` |
||||
|
</if> |
||||
|
<where> |
||||
|
<if test="query.id != null"> and `bms_supplier`.`id` = #{query.id}</if> |
||||
|
<if test="query.regionFirst != null"> and `bms_supplier`.`region_first` = #{query.regionFirst}</if> |
||||
|
<if test="query.regionSecond != null"> and `bms_supplier`.`region_second` = #{query.regionSecond}</if> |
||||
|
<if test="query.regionThird != null"> and `bms_supplier`.`region_third` = #{query.regionThird}</if> |
||||
|
<if test="query.address != null and query.address != ''"> and `bms_supplier`.`address` = #{query.address}</if> |
||||
|
<if test="query.name != null and query.name != ''"> and `bms_supplier`.`name` = #{query.name}</if> |
||||
|
<if test="query.code != null and query.code != ''"> and `bms_supplier`.`code` = #{query.code}</if> |
||||
|
<if test="query.pid != null"> and `bms_supplier`.`pid` = #{query.pid}</if> |
||||
|
<if test="query.parentCode != null and query.parentCode != ''"> and `bms_supplier`.`parent_code` = #{query.parentCode}</if> |
||||
|
<if test="query.belong != null and query.belong != ''"> and `bms_supplier`.`belong` = #{query.belong}</if> |
||||
|
<if test="query.createTime != null"> and `bms_supplier`.`create_time` = #{query.createTime}</if> |
||||
|
<if test="query.createBy != null and query.createBy != ''"> and `bms_supplier`.`create_by` = #{query.createBy}</if> |
||||
|
<if test="query.updateTime != null"> and `bms_supplier`.`update_time` = #{query.updateTime}</if> |
||||
|
<if test="query.updateBy != null and query.updateBy != ''"> and `bms_supplier`.`update_by` = #{query.updateBy}</if> |
||||
|
<if test="query.tenantId != null and query.tenantId != ''"> and `bms_supplier`.`tenant_id` = #{query.tenantId}</if> |
||||
|
<if test="query.delFlag != null"> and `bms_supplier`.`del_flag` = #{query.delFlag}</if> |
||||
|
<if test="query.currUserId!=null and query.currUserId != ''"> |
||||
|
and `bms_supplier_user`.`user_id` = #{query.currUserId} |
||||
|
</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue