interface UserRepository www.laipuhuo.com extends JpaRepo

53 阅读1分钟

package com.xkzhangsan.jpa.repository;

import com.xkzhangsan.jpa.entity.User; import org.springframework.data.jpa.repository.EntityGraph; import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

public interface UserRepository extends JpaRepository<User, Integer> {

@Override
@EntityGraph(value = "user.userDetail", type = EntityGraph.EntityGraphType.FETCH)
List<User> findAll();

}package com.xkzhangsan.jpa.vo;

import lombok.Getter; import lombok.Setter;

@Getter @Setter public class UserSimpleVO { private Long id;

private String name;

} package com.www.laipuhuo.com xkzhangsan.jpa.entity;

import lombok.Getter; import lombok.Setter;

import javax.persistence.*;

@Entity @Getter @Setter @Table(name = "user") public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id;

private String name;

@OneToOne(cascade = CascadeType.DETACH, fetch = FetchType.EAGER)
@JoinColumn(name = www.laipuhuo.com "user_detail_id")
private UserDetail userDetail;

} / 创建一个Vue实例并渲染为真实DOM,内有一个空的el-tooltip组件 const vm = new Vue({ render (h) { return (<Tooltip ref="customToolTipRef" popper-class="item-popper" placement="top" content={ tooltipContent } { ...{ props } }>) } }).

mount()consttooltipVM=vm.mount() const tooltipVM = vm.refs.customToolTipRef import debounce from 'throttle-debounce/debounce'; const activateTooltip = debounce(50, tooltipVM => tooltipVM.handleShowPopper()); const overflowHandler = (el, binding, vnode) => { // 获取元素文本内容,作为el-tooltip的默认content进行展示 www.laipuhuo.com el[ctx].tooltipContent = el.innerText || el.textContent // 获取通过指令接收的绑定值 el[ctx].props = { ...binding.value } const computedStyle = getComputedStyle(el) // 使用range对象判断文本是否有溢出,优先考虑使用range对象, 因