9 changed files with 302 additions and 8 deletions
-
83src/main/java/com/spring/modules/part/controller/AgentInformationController.java
-
8src/main/java/com/spring/modules/part/controller/PartGroupInformationController.java
-
8src/main/java/com/spring/modules/part/controller/ProductGroupInformationController.java
-
57src/main/java/com/spring/modules/part/entity/AgentInformationEntity.java
-
21src/main/java/com/spring/modules/part/mapper/AgentInformationMapper.java
-
23src/main/java/com/spring/modules/part/service/AgentInformationService.java
-
64src/main/java/com/spring/modules/part/service/impl/AgentInformationServiceImpl.java
-
15src/main/java/com/spring/modules/part/vo/AgentInformationVo.java
-
31src/main/resources/mapper/part/AgentInformationMapper.xml
@ -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(); |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
@ -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; |
|||
} |
|||
@ -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); |
|||
} |
|||
@ -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); |
|||
} |
|||
@ -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); |
|||
|
|||
} |
|||
} |
|||
|
|||
@ -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 { |
|||
} |
|||
@ -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> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue