SupplierV1InnerServiceSMOImpl.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright 2017-2020 吴学文 and java110 team.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.java110.scm.smo.impl;
  17. import com.java110.scm.dao.ISupplierV1ServiceDao;
  18. import com.java110.intf.scm.ISupplierV1InnerServiceSMO;
  19. import com.java110.dto.supplier.SupplierDto;
  20. import com.java110.po.supplier.SupplierPo;
  21. import com.java110.utils.util.BeanConvertUtil;
  22. import com.java110.core.base.smo.BaseServiceSMO;
  23. import com.java110.dto.user.UserDto;
  24. import com.java110.dto.PageDto;
  25. import org.springframework.beans.factory.annotation.Autowired;
  26. import org.springframework.web.bind.annotation.RequestBody;
  27. import org.springframework.web.bind.annotation.RestController;
  28. import java.util.ArrayList;
  29. import java.util.List;
  30. /**
  31. * 类表述: 服务之前调用的接口实现类,不对外提供接口能力 只用于接口建调用
  32. * add by 吴学文 at 2022-11-16 22:41:15 mail: 928255095@qq.com
  33. * open source address: https://gitee.com/wuxw7/MicroCommunity
  34. * 官网:http://www.homecommunity.cn
  35. * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
  36. * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
  37. */
  38. @RestController
  39. public class SupplierV1InnerServiceSMOImpl extends BaseServiceSMO implements ISupplierV1InnerServiceSMO {
  40. @Autowired
  41. private ISupplierV1ServiceDao supplierV1ServiceDaoImpl;
  42. @Override
  43. public int saveSupplier(@RequestBody SupplierPo supplierPo) {
  44. int saveFlag = supplierV1ServiceDaoImpl.saveSupplierInfo(BeanConvertUtil.beanCovertMap(supplierPo));
  45. return saveFlag;
  46. }
  47. @Override
  48. public int updateSupplier(@RequestBody SupplierPo supplierPo) {
  49. int saveFlag = supplierV1ServiceDaoImpl.updateSupplierInfo(BeanConvertUtil.beanCovertMap(supplierPo));
  50. return saveFlag;
  51. }
  52. @Override
  53. public int deleteSupplier(@RequestBody SupplierPo supplierPo) {
  54. supplierPo.setStatusCd("1");
  55. int saveFlag = supplierV1ServiceDaoImpl.updateSupplierInfo(BeanConvertUtil.beanCovertMap(supplierPo));
  56. return saveFlag;
  57. }
  58. @Override
  59. public List<SupplierDto> querySuppliers(@RequestBody SupplierDto supplierDto) {
  60. //校验是否传了 分页信息
  61. int page = supplierDto.getPage();
  62. if (page != PageDto.DEFAULT_PAGE) {
  63. supplierDto.setPage((page - 1) * supplierDto.getRow());
  64. }
  65. List<SupplierDto> suppliers = BeanConvertUtil.covertBeanList(supplierV1ServiceDaoImpl.getSupplierInfo(BeanConvertUtil.beanCovertMap(supplierDto)), SupplierDto.class);
  66. return suppliers;
  67. }
  68. @Override
  69. public int querySuppliersCount(@RequestBody SupplierDto supplierDto) {
  70. return supplierV1ServiceDaoImpl.querySuppliersCount(BeanConvertUtil.beanCovertMap(supplierDto)); }
  71. }