Browse Source

2023.11.17 代理商的增删改查

master
yuejiayang 2 years ago
parent
commit
3c02b67050
  1. 83
      src/main/java/com/spring/modules/part/controller/AgentInformationController.java
  2. 8
      src/main/java/com/spring/modules/part/controller/PartGroupInformationController.java
  3. 8
      src/main/java/com/spring/modules/part/controller/ProductGroupInformationController.java
  4. 57
      src/main/java/com/spring/modules/part/entity/AgentInformationEntity.java
  5. 21
      src/main/java/com/spring/modules/part/mapper/AgentInformationMapper.java
  6. 23
      src/main/java/com/spring/modules/part/service/AgentInformationService.java
  7. 64
      src/main/java/com/spring/modules/part/service/impl/AgentInformationServiceImpl.java
  8. 15
      src/main/java/com/spring/modules/part/vo/AgentInformationVo.java
  9. 31
      src/main/resources/mapper/part/AgentInformationMapper.xml

83
src/main/java/com/spring/modules/part/controller/AgentInformationController.java

@ -0,0 +1,83 @@
package com.spring.modules.part.controller;
import com.spring.common.utils.PageUtils;
import com.spring.common.utils.R;
import com.spring.modules.part.entity.AgentInformationEntity;
import com.spring.modules.part.service.AgentInformationService;
import com.spring.modules.part.vo.AgentInformationVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("plm/agentInformation")
public class AgentInformationController {
@Autowired
private AgentInformationService agentInformationService;
/**
* @description: 获取代理商列表
* @author: jiayang_yang
* @date: 2023/11/14 10:38
* @param: [data]
* @return: com.spring.common.utils.R
**/
@PostMapping(value="/agentInformationSearch")
@ResponseBody
public R agentInformationSearch(@RequestBody AgentInformationVo data) {
PageUtils page = agentInformationService.agentInformationSearch(data);
return R.ok().put("page", page);
}
/**
* @description: 新增代理商信息
* @auther: jiayang_yue
* @date: 2023/11/14 10:38
* @param: [data]
* @return: com.spring.common.utils.R
**/
@PostMapping(value="/agentInformationSave")
@ResponseBody
public R agentInformationSave(@RequestBody AgentInformationEntity data){
agentInformationService.agentInformationSave(data);
return R.ok();
}
/**
* @description: 编辑代理商信息
* @auther: jiayang_yue
* @date: 2023/11/14 10:38
* @param: [data]
* @return: com.spring.common.utils.R
**/
@PostMapping(value="/agentInformationEdit")
@ResponseBody
public R agentInformationEdit(@RequestBody AgentInformationEntity data){
agentInformationService.agentInformationEdit(data);
return R.ok();
}
/**
* @description: 删除代理商信息
* @auther: jiayang_yue
* @date: 2023/11/14 10:38
* @param: [data]
* @return: com.spring.common.utils.R
**/
@PostMapping(value="/agentInformationDelete")
@ResponseBody
public R agentInformationDelete(@RequestBody AgentInformationEntity data){
agentInformationService.agentInformationDelete(data);
return R.ok();
}
}

8
src/main/java/com/spring/modules/part/controller/PartGroupInformationController.java

@ -16,7 +16,7 @@ public class PartGroupInformationController {
private PartGroupInformationService partGroupInformationService;
/**
* @description: 获取分列表
* @description: 获取分列表
* @author: fengyuan_yang
* @date: 2023/11/14 10:38
* @param: [data]
@ -31,7 +31,7 @@ public class PartGroupInformationController {
/**
* @description: 新增分信息
* @description: 新增分信息
* @auther: jiayang_yue
* @date: 2023/11/14 10:38
* @param: [data]
@ -45,7 +45,7 @@ public class PartGroupInformationController {
}
/**
* @description: 编辑分信息
* @description: 编辑分信息
* @auther: jiayang_yue
* @date: 2023/11/14 10:38
* @param: [data]
@ -59,7 +59,7 @@ public class PartGroupInformationController {
}
/**
* @description: 删除分信息
* @description: 删除分信息
* @auther: jiayang_yue
* @date: 2023/11/14 10:38
* @param: [data]

8
src/main/java/com/spring/modules/part/controller/ProductGroupInformationController.java

@ -16,7 +16,7 @@ public class ProductGroupInformationController {
private ProductGroupInformationService productGroupInformationService;
/**
* @description: 获取分类列表
* @description: 获取商品组列表
* @author: jiayang_yue
* @date: 2023/11/15 10:15
* @param: [data]
@ -31,7 +31,7 @@ public class ProductGroupInformationController {
/**
* @description: 新增分类信息
* @description: 新增商品组信息
* @auther: jiayang_yue
* @date: 2023/11/15 10:15
* @param: [data]
@ -45,7 +45,7 @@ public class ProductGroupInformationController {
}
/**
* @description: 编辑分类信息
* @description: 编辑商品组信息
* @auther: jiayang_yue
* @date: 2023/11/15 10:15
* @param: [data]
@ -59,7 +59,7 @@ public class ProductGroupInformationController {
}
/**
* @description: 删除分类信息
* @description: 删除商品组信息
* @auther: jiayang_yue
* @date: 2023/11/15 10:15
* @param: [data]

57
src/main/java/com/spring/modules/part/entity/AgentInformationEntity.java

@ -0,0 +1,57 @@
package com.spring.modules.part.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("agent")
public class AgentInformationEntity extends QueryPage implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 工厂
**/
private String site;
/**
* 代理商编码
**/
private String agentId;
/**
* 代理商名称
**/
private String agentName;
/**
* 是否可用
**/
private String active;
/**
* 创建时间
**/
@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<AgentInformationEntity> informationList;
}

21
src/main/java/com/spring/modules/part/mapper/AgentInformationMapper.java

@ -0,0 +1,21 @@
package com.spring.modules.part.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.part.entity.AgentInformationEntity;
import com.spring.modules.part.vo.AgentInformationVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @description:
* @author: jiayang-yue
* @date: 2023/11/14 10:58
* @param:
* @return:
*/
@Mapper
public interface AgentInformationMapper extends BaseMapper<AgentInformationEntity> {
IPage<AgentInformationVo> agentInformationSearch(Page<AgentInformationVo> AgentInformationVoPage, @Param("query") AgentInformationVo data);
}

23
src/main/java/com/spring/modules/part/service/AgentInformationService.java

@ -0,0 +1,23 @@
package com.spring.modules.part.service;
import com.spring.common.utils.PageUtils;
import com.spring.modules.part.entity.AgentInformationEntity;
import com.spring.modules.part.vo.AgentInformationVo;
/**
* @description:
* @author: jiayang-yue
* @date: 2023/11/14 10:52
* @param:
* @return:
*/
public interface AgentInformationService {
PageUtils agentInformationSearch(AgentInformationVo data);
void agentInformationSave(AgentInformationEntity data);
void agentInformationEdit(AgentInformationEntity data);
void agentInformationDelete(AgentInformationEntity data);
}

64
src/main/java/com/spring/modules/part/service/impl/AgentInformationServiceImpl.java

@ -0,0 +1,64 @@
package com.spring.modules.part.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.part.entity.AgentInformationEntity;
import com.spring.modules.part.mapper.AgentInformationMapper;
import com.spring.modules.part.service.AgentInformationService;
import com.spring.modules.part.vo.AgentInformationVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
/**
* @description:
* @author: jiayang-yue
* @date: 2023/11/14 10:55
* @param:
* @return:
*/
@Service
public class AgentInformationServiceImpl extends ServiceImpl<AgentInformationMapper,AgentInformationEntity> implements AgentInformationService {
@Autowired
private AgentInformationMapper agentInformationMapper;
@Override
public PageUtils agentInformationSearch(AgentInformationVo data) {
IPage<AgentInformationVo> resultList = this.agentInformationMapper.agentInformationSearch(new Page<AgentInformationVo>(data.getPage(), data.getLimit()), data);
return new PageUtils(resultList);
}
@Override
public void agentInformationSave(AgentInformationEntity data) {
agentInformationMapper.insert(data);
}
@Override
public void agentInformationEdit(AgentInformationEntity data) {
UpdateWrapper<AgentInformationEntity> updateInformationWrapper = new UpdateWrapper<>();
updateInformationWrapper.eq("agent_id", data.getAgentId());
updateInformationWrapper.eq("site",data.getSite());
agentInformationMapper.update(data,updateInformationWrapper);
}
@Override
public void agentInformationDelete(AgentInformationEntity data) {
HashMap<String, Object> map = new HashMap<>();
map.put("site", data.getSite());
map.put("agent_id", data.getAgentId());
agentInformationMapper.deleteByMap(map);
}
}

15
src/main/java/com/spring/modules/part/vo/AgentInformationVo.java

@ -0,0 +1,15 @@
package com.spring.modules.part.vo;
import com.spring.modules.part.entity.AgentInformationEntity;
import lombok.Data;
/**
* @description:
* @author: jiayang-yue
* @date: 2023/11/14 10:57
* @param:
* @return:
*/
@Data
public class AgentInformationVo extends AgentInformationEntity {
}

31
src/main/resources/mapper/part/AgentInformationMapper.xml

@ -0,0 +1,31 @@
<?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.part.mapper.AgentInformationMapper">
<!-- 单位信息列表 -->
<select id="agentInformationSearch" parameterType="com.spring.modules.part.vo.AgentInformationVo" resultType="com.spring.modules.part.vo.AgentInformationVo">
SELECT
site,
agent_id,
agent_name,
active,
create_by,
create_date,
update_by,
update_date
FROM agent
<where>
site = #{query.site}
<if test = "query.agentId != null and query.agentId != ''">
AND agent_id like #{query.agentId}
</if>
<if test = "query.agentName != null and query.agentName != ''">
AND agent_name like #{query.agentName}
</if>
<if test = "query.active != null and query.active != ''">
AND active = #{query.active}
</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save