消息订阅
This commit is contained in:
parent
61477e7923
commit
11abb773d7
|
|
@ -1,33 +0,0 @@
|
|||
package com.czg.product.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 耗材分组关联关系
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-20
|
||||
*/
|
||||
@Data
|
||||
public class ConsGroupRelationDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 分组 id
|
||||
*/
|
||||
private Long groupId;
|
||||
/**
|
||||
* 耗材 Id
|
||||
*/
|
||||
private Long consId;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
package com.czg.product.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 耗材分组关联关系
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-20
|
||||
*/
|
||||
@Data
|
||||
@Table("tb_cons_group_relation")
|
||||
public class ConsGroupRelation implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 分组 id
|
||||
*/
|
||||
@Id(keyType = KeyType.None)
|
||||
private Long groupId;
|
||||
/**
|
||||
* 耗材 Id
|
||||
*/
|
||||
@Id(keyType = KeyType.None)
|
||||
private Long consId;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
package com.czg.product.service;
|
||||
|
||||
import com.czg.product.entity.ConsGroupRelation;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
/**
|
||||
* 耗材分组关联关系
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-20
|
||||
*/
|
||||
public interface ConsGroupRelationService extends IService<ConsGroupRelation> {
|
||||
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
package com.czg.service.product.mapper;
|
||||
|
||||
import com.czg.product.entity.ConsGroupRelation;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 耗材分组关联关系
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-20
|
||||
*/
|
||||
@Mapper
|
||||
public interface ConsGroupRelationMapper extends BaseMapper<ConsGroupRelation> {
|
||||
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.czg.service.product.service.impl;
|
||||
|
||||
import com.czg.product.entity.ConsGroupRelation;
|
||||
import com.czg.product.service.ConsGroupRelationService;
|
||||
import com.czg.service.product.mapper.ConsGroupRelationMapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 耗材分组关联关系
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-20
|
||||
*/
|
||||
@Service
|
||||
public class ConsGroupRelationServiceImpl extends ServiceImpl<ConsGroupRelationMapper, ConsGroupRelation> implements ConsGroupRelationService {
|
||||
|
||||
}
|
||||
|
|
@ -1,19 +1,16 @@
|
|||
package com.czg.service.product.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.enums.StatusEnum;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.product.dto.ConsGroupDTO;
|
||||
import com.czg.product.dto.ConsInfoDTO;
|
||||
import com.czg.product.entity.ConsGroup;
|
||||
import com.czg.product.entity.ConsGroupRelation;
|
||||
import com.czg.product.entity.ConsInfo;
|
||||
import com.czg.product.service.ConsGroupService;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.product.mapper.ConsGroupMapper;
|
||||
import com.czg.service.product.mapper.ConsGroupRelationMapper;
|
||||
import com.czg.service.product.mapper.ConsInfoMapper;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
|
|
@ -25,6 +22,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 耗材分组
|
||||
|
|
@ -36,7 +34,6 @@ import java.util.List;
|
|||
@Service
|
||||
public class ConsGroupServiceImpl extends ServiceImpl<ConsGroupMapper, ConsGroup> implements ConsGroupService {
|
||||
|
||||
private final ConsGroupRelationMapper consGroupRelationMapper;
|
||||
private final ConsInfoMapper consInfoMapper;
|
||||
|
||||
private QueryWrapper buildQueryWrapper(ConsGroupDTO param) {
|
||||
|
|
@ -67,9 +64,8 @@ public class ConsGroupServiceImpl extends ServiceImpl<ConsGroupMapper, ConsGroup
|
|||
public ConsGroupDTO getConsGroupById(Long id) {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
ConsGroupDTO dto = super.getOneAs(query().eq(ConsGroup::getId, id).eq(ConsGroup::getShopId, shopId), ConsGroupDTO.class);
|
||||
List<Long> consIds = consGroupRelationMapper.selectListByQueryAs(query().select(ConsGroupRelation::getConsId).eq(ConsGroupRelation::getGroupId, dto.getId()), Long.class);
|
||||
dto.setConsIds(consIds);
|
||||
List<ConsInfoDTO> consInfoList = consInfoMapper.selectListByQueryAs(query().eq(ConsInfo::getConsGroupId, dto.getId()), ConsInfoDTO.class);
|
||||
dto.setConsIds(consInfoList.stream().map(ConsInfoDTO::getId).collect(Collectors.toList()));
|
||||
dto.setConsInfoList(consInfoList);
|
||||
return dto;
|
||||
}
|
||||
|
|
@ -86,17 +82,6 @@ public class ConsGroupServiceImpl extends ServiceImpl<ConsGroupMapper, ConsGroup
|
|||
//entity.setStatus(StatusEnum.ENABLED.value());
|
||||
entity.setShopId(shopId);
|
||||
super.save(entity);
|
||||
List<Long> consIds = dto.getConsIds();
|
||||
if (CollUtil.isEmpty(consIds)) {
|
||||
return;
|
||||
}
|
||||
for (Long consId : consIds) {
|
||||
ConsGroupRelation relation = new ConsGroupRelation();
|
||||
relation.setConsId(consId);
|
||||
relation.setGroupId(entity.getId());
|
||||
relation.setSort(consId.intValue());
|
||||
consGroupRelationMapper.insert(relation);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -109,18 +94,6 @@ public class ConsGroupServiceImpl extends ServiceImpl<ConsGroupMapper, ConsGroup
|
|||
}
|
||||
ConsGroup entity = BeanUtil.copyProperties(dto, ConsGroup.class);
|
||||
super.updateById(entity);
|
||||
List<Long> consIds = dto.getConsIds();
|
||||
if (CollUtil.isEmpty(consIds)) {
|
||||
return;
|
||||
}
|
||||
consGroupRelationMapper.deleteByQuery(query().eq(ConsGroupRelation::getGroupId, entity.getId()));
|
||||
for (Long consId : consIds) {
|
||||
ConsGroupRelation relation = new ConsGroupRelation();
|
||||
relation.setConsId(consId);
|
||||
relation.setGroupId(entity.getId());
|
||||
relation.setSort(consId.intValue());
|
||||
consGroupRelationMapper.insert(relation);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -10,14 +10,16 @@ import com.czg.exception.CzgException;
|
|||
import com.czg.product.dto.ConsInfoDTO;
|
||||
import com.czg.product.dto.ProductBriefDTO;
|
||||
import com.czg.product.entity.ConsGroup;
|
||||
import com.czg.product.entity.ConsGroupRelation;
|
||||
import com.czg.product.entity.ConsInfo;
|
||||
import com.czg.product.param.ConsInfoParam;
|
||||
import com.czg.product.param.ConsSubUnitParam;
|
||||
import com.czg.product.service.ConsInfoService;
|
||||
import com.czg.product.vo.ConsStatisticsVo;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.product.mapper.*;
|
||||
import com.czg.service.product.mapper.ConsGroupMapper;
|
||||
import com.czg.service.product.mapper.ConsInfoMapper;
|
||||
import com.czg.service.product.mapper.ConsStockFlowMapper;
|
||||
import com.czg.service.product.mapper.ProdConsRelationMapper;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
|
|
@ -42,7 +44,6 @@ import java.util.stream.Collectors;
|
|||
@AllArgsConstructor
|
||||
public class ConsInfoServiceImpl extends ServiceImpl<ConsInfoMapper, ConsInfo> implements ConsInfoService {
|
||||
|
||||
private final ConsGroupRelationMapper consGroupRelationMapper;
|
||||
private final ProdConsRelationMapper prodConsRelationMapper;
|
||||
private final ConsGroupMapper consGroupMapper;
|
||||
private final ConsStockFlowMapper consStockFlowMapper;
|
||||
|
|
@ -122,11 +123,6 @@ public class ConsInfoServiceImpl extends ServiceImpl<ConsInfoMapper, ConsInfo> i
|
|||
entity.setIsStock(YesNoEnum.NO.value());
|
||||
entity.setShopId(shopId);
|
||||
super.save(entity);
|
||||
ConsGroupRelation relation = new ConsGroupRelation();
|
||||
relation.setConsId(entity.getId());
|
||||
relation.setGroupId(dto.getConsGroupId());
|
||||
relation.setSort(entity.getId().intValue());
|
||||
consGroupRelationMapper.insert(relation);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -140,12 +136,6 @@ public class ConsInfoServiceImpl extends ServiceImpl<ConsInfoMapper, ConsInfo> i
|
|||
}
|
||||
ConsInfo entity = BeanUtil.copyProperties(dto, ConsInfo.class);
|
||||
super.updateById(entity);
|
||||
consGroupRelationMapper.deleteByQuery(query().eq(ConsGroupRelation::getConsId, dto.getId()));
|
||||
ConsGroupRelation relation = new ConsGroupRelation();
|
||||
relation.setConsId(entity.getId());
|
||||
relation.setGroupId(dto.getConsGroupId());
|
||||
relation.setSort(entity.getId().intValue());
|
||||
consGroupRelationMapper.insert(relation);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
<?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.czg.service.product.mapper.ConsGroupRelationMapper">
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue