@@ -0,0 +1,48 @@
|
||||
package com.yunhai.userhome.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* Logo 实体(镜像 Wallpaper 模式:超管设置系统默认,学校设置自身)。
|
||||
* <p>type:0 系统默认(schId=0) | 1 学校(schId=学校ID);一校一行,type+sch_id 唯一。</p>
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "logo", uniqueConstraints = {@UniqueConstraint(columnNames = {"type", "sch_id"}, name = "uk_type_sch")})
|
||||
public class Logo {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@NotNull(groups = Update.class)
|
||||
private Integer id;
|
||||
|
||||
/** 0:系统默认 | 1:学校 */
|
||||
private Integer type;
|
||||
|
||||
@Column(name = "sch_id")
|
||||
private Integer schId;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
@Column(name = "logo_url")
|
||||
private String logoUrl;
|
||||
|
||||
@Transient
|
||||
private Boolean isEdit = false;
|
||||
|
||||
public @interface Update {}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.yunhai.userhome.repository;
|
||||
|
||||
import com.yunhai.userhome.entity.Logo;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface LogoRepository extends JpaRepository<Logo, Integer>, JpaSpecificationExecutor<Logo> {
|
||||
|
||||
List<Logo> findBySchIdAndType(Integer schId, Integer type);
|
||||
|
||||
Optional<Logo> findByTypeAndSchId(Integer type, Integer schId);
|
||||
}
|
||||
Reference in New Issue
Block a user