From 70a80d17b80e2d3bc9609b65089df309e74ad796 Mon Sep 17 00:00:00 2001 From: yuejiayang <146344614+YangLei105@users.noreply.github.com> Date: Mon, 8 Jan 2024 14:31:46 +0800 Subject: [PATCH] 2024.1.8 --- .../CustomerGroupInformationController.java | 82 +++++++++++++++++++ .../CustomerGroupInformationEntity.java | 61 ++++++++++++++ .../entity/CustomerInformationEntity.java | 16 +++- .../CustomerGroupInformationMapper.java | 20 +++++ .../CustomerGroupInformationService.java | 22 +++++ .../CustomerGroupInformationServiceImpl.java | 72 ++++++++++++++++ .../impl/CustomerInformationServiceImpl.java | 14 ---- .../customer/vo/CustomerInformationVo.java | 8 ++ .../CustomerGroupInformationMapper.xml | 35 ++++++++ .../customer/CustomerInformationMapper.xml | 5 ++ 10 files changed, 320 insertions(+), 15 deletions(-) create mode 100644 src/main/java/com/spring/modules/customer/controller/CustomerGroupInformationController.java create mode 100644 src/main/java/com/spring/modules/customer/entity/CustomerGroupInformationEntity.java create mode 100644 src/main/java/com/spring/modules/customer/mapper/CustomerGroupInformationMapper.java create mode 100644 src/main/java/com/spring/modules/customer/service/CustomerGroupInformationService.java create mode 100644 src/main/java/com/spring/modules/customer/service/impl/CustomerGroupInformationServiceImpl.java create mode 100644 src/main/resources/mapper/customer/CustomerGroupInformationMapper.xml diff --git a/src/main/java/com/spring/modules/customer/controller/CustomerGroupInformationController.java b/src/main/java/com/spring/modules/customer/controller/CustomerGroupInformationController.java new file mode 100644 index 00000000..45d307a1 --- /dev/null +++ b/src/main/java/com/spring/modules/customer/controller/CustomerGroupInformationController.java @@ -0,0 +1,82 @@ +package com.spring.modules.customer.controller; + +import com.spring.common.utils.PageUtils; +import com.spring.common.utils.R; +import com.spring.modules.customer.entity.CustomerGroupInformationEntity; +import com.spring.modules.customer.service.CustomerGroupInformationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("plm/customerGroupInformation") +public class CustomerGroupInformationController { + + @Autowired + private CustomerGroupInformationService customerGroupInformationService; + + /** + * @description: 获取客户组列表 + * @author: jiayang_yue + * @date: 2024/1/8 13:12 + * @param: [data] + * @return: com.spring.common.utils.R + **/ + @PostMapping(value="/customerGroupInformationSearch") + @ResponseBody + public R customerGroupInformationSearch(@RequestBody CustomerGroupInformationEntity data) { + PageUtils page = customerGroupInformationService.customerGroupInformationSearch(data); + return R.ok().put("page", page); + } + + + /** + * @description: 新增客户组信息 + * @auther: jiayang_yue + * @date: 2024/1/8 13:12 + * @param: [data] + * @return: com.spring.common.utils.R + **/ + @PostMapping(value="/customerGroupInformationSave") + @ResponseBody + public R customerGroupInformationSave(@RequestBody CustomerGroupInformationEntity data){ + customerGroupInformationService.customerGroupInformationSave(data); + return R.ok(); + } + + /** + * @description: 编辑客户组信息 + * @auther: jiayang_yue + * @date: 2024/1/8 13:12 + * @param: [data] + * @return: com.spring.common.utils.R + **/ + @PostMapping(value="/customerGroupInformationEdit") + @ResponseBody + public R customerGroupInformationEdit(@RequestBody CustomerGroupInformationEntity data){ + customerGroupInformationService.customerGroupInformationEdit(data); + return R.ok(); + } + + /** + * @description: 删除客户组信息 + * @auther: jiayang_yue + * @date: 2024/1/8 13:12 + * @param: [data] + * @return: com.spring.common.utils.R + **/ + @PostMapping(value="/customerGroupInformationDelete") + @ResponseBody + public R customerGroupInformationDelete(@RequestBody CustomerGroupInformationEntity data){ + customerGroupInformationService.customerGroupInformationDelete(data); + return R.ok(); + } + +} + + + + + + + + diff --git a/src/main/java/com/spring/modules/customer/entity/CustomerGroupInformationEntity.java b/src/main/java/com/spring/modules/customer/entity/CustomerGroupInformationEntity.java new file mode 100644 index 00000000..8270d24d --- /dev/null +++ b/src/main/java/com/spring/modules/customer/entity/CustomerGroupInformationEntity.java @@ -0,0 +1,61 @@ +package com.spring.modules.customer.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.spring.common.utils.QueryPage; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +@Data +@TableName("plm_customer_group") +public class CustomerGroupInformationEntity extends QueryPage implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 工厂 + **/ + private String site; + /** + * 客户组编码 + **/ + private String customerGroupId; + /** + * 客户组名称 + **/ + private String customerGroupName; + /** + * 是否可用 + **/ + private String active; + /** + * 客户组 + **/ + private String type; + /** + * 创建时间 + **/ + @TableField(fill = FieldFill.INSERT) + private Date createDate; + /** + * 创建人 + **/ + private String createBy; + /** + * 更新时间 + **/ + @TableField(fill = FieldFill.UPDATE) + private Date updateDate; + /** + * 更新人 + **/ + private String updateBy; + /** + * 数据集 + */ + @TableField(exist = false) + private List informationList; +} diff --git a/src/main/java/com/spring/modules/customer/entity/CustomerInformationEntity.java b/src/main/java/com/spring/modules/customer/entity/CustomerInformationEntity.java index 66689a78..1ea1fd34 100644 --- a/src/main/java/com/spring/modules/customer/entity/CustomerInformationEntity.java +++ b/src/main/java/com/spring/modules/customer/entity/CustomerInformationEntity.java @@ -40,13 +40,27 @@ public class CustomerInformationEntity extends QueryPage implements Serializable */ private BigDecimal potentialRevenueOfYear; /** - * 关键客户 + * 重要程度 */ private String importantCustomer; + /** + * 客户组1 + **/ + @TableField("customer_group_id1") + private String customerGroupId1; + /** + * 客户组2 + **/ + @TableField("customer_group_id2") + private String customerGroupId2; /** * 客户状态 */ private String customerStatus; + /** + * 客户类型 + */ + private String customerType; /** * 客户描述 */ diff --git a/src/main/java/com/spring/modules/customer/mapper/CustomerGroupInformationMapper.java b/src/main/java/com/spring/modules/customer/mapper/CustomerGroupInformationMapper.java new file mode 100644 index 00000000..28c64317 --- /dev/null +++ b/src/main/java/com/spring/modules/customer/mapper/CustomerGroupInformationMapper.java @@ -0,0 +1,20 @@ +package com.spring.modules.customer.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.spring.modules.customer.entity.CustomerGroupInformationEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * @description: + * @author: jiayang_yue + * @date: 2023/11/15 10:15 + * @param: + * @return: + */ +@Mapper +public interface CustomerGroupInformationMapper extends BaseMapper { + IPage customerGroupInformationSearch(Page CustomerGroupInformationEntityPage, @Param("query") CustomerGroupInformationEntity data); +} diff --git a/src/main/java/com/spring/modules/customer/service/CustomerGroupInformationService.java b/src/main/java/com/spring/modules/customer/service/CustomerGroupInformationService.java new file mode 100644 index 00000000..9fbd3a99 --- /dev/null +++ b/src/main/java/com/spring/modules/customer/service/CustomerGroupInformationService.java @@ -0,0 +1,22 @@ +package com.spring.modules.customer.service; + +import com.spring.common.utils.PageUtils; +import com.spring.modules.customer.entity.CustomerGroupInformationEntity; + +/** + * @description: + * @author: jiayang_yue + * @date: 2023/11/15 10:15 + * @param: + * @return: + */ +public interface CustomerGroupInformationService { + + PageUtils customerGroupInformationSearch(CustomerGroupInformationEntity data); + + void customerGroupInformationSave(CustomerGroupInformationEntity data); + + void customerGroupInformationEdit(CustomerGroupInformationEntity data); + + void customerGroupInformationDelete(CustomerGroupInformationEntity data); +} diff --git a/src/main/java/com/spring/modules/customer/service/impl/CustomerGroupInformationServiceImpl.java b/src/main/java/com/spring/modules/customer/service/impl/CustomerGroupInformationServiceImpl.java new file mode 100644 index 00000000..b9e31d3c --- /dev/null +++ b/src/main/java/com/spring/modules/customer/service/impl/CustomerGroupInformationServiceImpl.java @@ -0,0 +1,72 @@ +package com.spring.modules.customer.service.impl; + +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.spring.common.utils.PageUtils; +import com.spring.modules.customer.entity.CustomerGroupInformationEntity; +import com.spring.modules.customer.mapper.CustomerGroupInformationMapper; +import com.spring.modules.customer.service.CustomerGroupInformationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; + +/** + * @description: + * @author: jiayang_yue + * @date: 2023/11/15 10:15 + * @param: + * @return: + */ +@Service +public class CustomerGroupInformationServiceImpl extends ServiceImpl implements CustomerGroupInformationService { + + @Autowired + private CustomerGroupInformationMapper customerGroupInformationMapper; + + @Override + public PageUtils customerGroupInformationSearch(CustomerGroupInformationEntity data) { + + IPage resultList = this.customerGroupInformationMapper.customerGroupInformationSearch(new Page(data.getPage(), data.getLimit()), data); + + return new PageUtils(resultList); + } + + @Override + public void customerGroupInformationSave(CustomerGroupInformationEntity data) { + // 校验 + HashMap map = new HashMap<>(); + map.put("site", data.getSite()); + map.put("customer_group_id", data.getCustomerGroupId()); + int count = customerGroupInformationMapper.selectByMap(map).size(); + if (count > 0) { + throw new RuntimeException("商品组编码已存在!"); + } + customerGroupInformationMapper.insert(data); + + } + + @Override + public void customerGroupInformationEdit(CustomerGroupInformationEntity data) { + + UpdateWrapper updateInformationWrapper = new UpdateWrapper<>(); + updateInformationWrapper.eq("customer_group_id", data.getCustomerGroupId()); + updateInformationWrapper.eq("site",data.getSite()); + customerGroupInformationMapper.update(data,updateInformationWrapper); + + } + + @Override + public void customerGroupInformationDelete(CustomerGroupInformationEntity data) { + + HashMap map = new HashMap<>(); + map.put("site", data.getSite()); + map.put("customer_group_id", data.getCustomerGroupId()); + + customerGroupInformationMapper.deleteByMap(map); + + } +} + diff --git a/src/main/java/com/spring/modules/customer/service/impl/CustomerInformationServiceImpl.java b/src/main/java/com/spring/modules/customer/service/impl/CustomerInformationServiceImpl.java index 90bff411..de7f2ee5 100644 --- a/src/main/java/com/spring/modules/customer/service/impl/CustomerInformationServiceImpl.java +++ b/src/main/java/com/spring/modules/customer/service/impl/CustomerInformationServiceImpl.java @@ -67,20 +67,6 @@ public class CustomerInformationServiceImpl extends ServiceImpl + + + + + + + diff --git a/src/main/resources/mapper/customer/CustomerInformationMapper.xml b/src/main/resources/mapper/customer/CustomerInformationMapper.xml index 16612024..68cb47f4 100644 --- a/src/main/resources/mapper/customer/CustomerInformationMapper.xml +++ b/src/main/resources/mapper/customer/CustomerInformationMapper.xml @@ -12,7 +12,12 @@ turnover_of_year, potential_revenue_of_year, important_customer, + customer_group_id1, + dbo.get_customer_group_name(site, customer_group_id1, '1') as customerGroupName1, + customer_group_id2, + dbo.get_customer_group_name(site, customer_group_id2, '2') as customerGroupName2, customer_status, + customer_type, customer_description, customer_industry, create_date,