class GenGroupServiceImpl extends ServiceImpl<GenGroupMapper, GenGroupEntity> implements GenGroupService {

	private final GenTemplateGroupService genTemplateGroupService;

	/**
	 * 新增模板分组
	 * @param genTemplateGroup
	 */
	@Override
	public void saveGenGroup(TemplateGroupDTO genTemplateGroup) {
		// 1.保存group
		GenGroupEntity groupEntity = new GenGroupEntity();
		BeanUtil.copyProperties(genTemplateGroup, groupEntity);
		baseMapper.insert(groupEntity);
		// 2.保存关系
		List<GenTemplateGroupEntity> goals = new LinkedList<>();
		for (Long TemplateId : genTemplateGroup.getTemplateId()) {
			GenTemplateGroupEntity templateGroup = new GenTemplateGroupEntity();
			templateGroup.setTemplateId(TemplateId).setGroupId(groupEntity.getId());
			goals.add(templateGroup);
		}
		genTemplateGroupService.saveBatch(goals);

	}

	/**
	 * 按照ids删除
	 * @param ids groupIds
	 */
	@Override
	public void delGroupAndTemplate(Long[] ids) {
		// 删除分组
		this.removeBatchByIds(CollUtil.toList(ids));
		// 删除关系
		genTemplateGroupService
			.remove(Wrappers.<GenTemplateGroupEntity>lambdaQuery().in(GenTemplateGroupEntity::getGroupId, ids));
	}

	/**
	 * 按照id查询
	 * @param id
	 * @return
	 */
	@Override
	public GroupVo getGroupVoById(Long id) {
		return baseMapper.getGroupVoById(id);
	}

	/**
	 * 根据id更新
	 * @param groupVo
	 */
	@Override
	public void updateGroupAndTemplateById(GroupVo groupVo) {<FILL_FUNCTION_BODY>}

}

		// 1.更新自身
		GenGroupEntity groupEntity = new GenGroupEntity();
		BeanUtil.copyProperties(groupVo, groupEntity);
		this.updateById(groupEntity);
		// 2.更新模板
		// 2.1根据id删除之前的模板
		genTemplateGroupService.remove(
				Wrappers.<GenTemplateGroupEntity>lambdaQuery().eq(GenTemplateGroupEntity::getGroupId, groupVo.getId()));
		// 2.2根据ids创建新的模板分组赋值
		List<GenTemplateGroupEntity> goals = new LinkedList<>();
		for (Long templateId : groupVo.getTemplateId()) {
			goals.add(new GenTemplateGroupEntity().setGroupId(groupVo.getId()).setTemplateId(templateId));
		}
		genTemplateGroupService.saveBatch(goals);
	
<no_super_class>