10 changed files with 320 additions and 15 deletions
-
82src/main/java/com/spring/modules/customer/controller/CustomerGroupInformationController.java
-
61src/main/java/com/spring/modules/customer/entity/CustomerGroupInformationEntity.java
-
16src/main/java/com/spring/modules/customer/entity/CustomerInformationEntity.java
-
20src/main/java/com/spring/modules/customer/mapper/CustomerGroupInformationMapper.java
-
22src/main/java/com/spring/modules/customer/service/CustomerGroupInformationService.java
-
72src/main/java/com/spring/modules/customer/service/impl/CustomerGroupInformationServiceImpl.java
-
14src/main/java/com/spring/modules/customer/service/impl/CustomerInformationServiceImpl.java
-
8src/main/java/com/spring/modules/customer/vo/CustomerInformationVo.java
-
35src/main/resources/mapper/customer/CustomerGroupInformationMapper.xml
-
5src/main/resources/mapper/customer/CustomerInformationMapper.xml
@ -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(); |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
@ -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<CustomerGroupInformationEntity> informationList; |
|||
} |
|||
@ -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<CustomerGroupInformationEntity> { |
|||
IPage<CustomerGroupInformationEntity> customerGroupInformationSearch(Page<CustomerGroupInformationEntity> CustomerGroupInformationEntityPage, @Param("query") CustomerGroupInformationEntity data); |
|||
} |
|||
@ -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); |
|||
} |
|||
@ -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<CustomerGroupInformationMapper,CustomerGroupInformationEntity> implements CustomerGroupInformationService { |
|||
|
|||
@Autowired |
|||
private CustomerGroupInformationMapper customerGroupInformationMapper; |
|||
|
|||
@Override |
|||
public PageUtils customerGroupInformationSearch(CustomerGroupInformationEntity data) { |
|||
|
|||
IPage<CustomerGroupInformationEntity> resultList = this.customerGroupInformationMapper.customerGroupInformationSearch(new Page<CustomerGroupInformationEntity>(data.getPage(), data.getLimit()), data); |
|||
|
|||
return new PageUtils(resultList); |
|||
} |
|||
|
|||
@Override |
|||
public void customerGroupInformationSave(CustomerGroupInformationEntity data) { |
|||
// 校验 |
|||
HashMap<String, Object> 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<CustomerGroupInformationEntity> 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<String, Object> map = new HashMap<>(); |
|||
map.put("site", data.getSite()); |
|||
map.put("customer_group_id", data.getCustomerGroupId()); |
|||
|
|||
customerGroupInformationMapper.deleteByMap(map); |
|||
|
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,35 @@ |
|||
<?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.spring.modules.customer.mapper.CustomerGroupInformationMapper"> |
|||
|
|||
<!-- 信息列表 --> |
|||
<select id="customerGroupInformationSearch" parameterType="com.spring.modules.customer.entity.CustomerGroupInformationEntity" resultType="com.spring.modules.customer.entity.CustomerGroupInformationEntity"> |
|||
SELECT |
|||
site, |
|||
customer_group_id, |
|||
customer_group_name, |
|||
active, |
|||
type, |
|||
create_by, |
|||
create_date, |
|||
update_by, |
|||
update_date |
|||
FROM plm_customer_group |
|||
<where> |
|||
site = #{query.site} |
|||
<if test = "query.customerGroupId != null and query.customerGroupId != ''"> |
|||
AND customer_group_id like #{query.customerGroupId} |
|||
</if> |
|||
<if test = "query.customerGroupName != null and query.customerGroupName != ''"> |
|||
AND customer_group_name like #{query.customerGroupName} |
|||
</if> |
|||
<if test = "query.active != null and query.active != ''"> |
|||
AND active = #{query.active} |
|||
</if> |
|||
<if test = "query.type != null and query.type != ''"> |
|||
AND type = #{query.type} |
|||
</if> |
|||
</where> |
|||
</select> |
|||
|
|||
</mapper> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue