#74 fixing codestyle and tags
parent
5eae7305c4
commit
d6a11a5902
@ -1,44 +0,0 @@
|
||||
package ru.ulstu.tags.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import ru.ulstu.core.model.BaseEntity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@Entity
|
||||
@Table(name = "tag")
|
||||
public class TagDto extends BaseEntity {
|
||||
|
||||
@NotEmpty
|
||||
@Size(max = 50)
|
||||
@Column(name = "tag_name")
|
||||
private String tagName;
|
||||
|
||||
public TagDto() {
|
||||
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public TagDto(@JsonProperty("id") Integer id,
|
||||
@JsonProperty("tag_name") String tagName) {
|
||||
this.setId(id);
|
||||
this.tagName = tagName;
|
||||
}
|
||||
|
||||
public TagDto(String name) {
|
||||
this.tagName = name;
|
||||
}
|
||||
|
||||
public String getTagName() {
|
||||
return tagName;
|
||||
}
|
||||
|
||||
public void setTagName(String tagName) {
|
||||
this.tagName = tagName;
|
||||
}
|
||||
}
|
@ -1,8 +1,12 @@
|
||||
package ru.ulstu.tags.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import ru.ulstu.tags.model.TagDto;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import ru.ulstu.tags.model.Tag;
|
||||
|
||||
public interface TagRepository extends JpaRepository<TagDto, Integer> {
|
||||
public interface TagRepository extends JpaRepository<Tag, Integer> {
|
||||
|
||||
@Query("SELECT t FROM Tag t WHERE (t.tagName = :tagName)")
|
||||
Tag findByName(@Param("tagName") String tagName);
|
||||
}
|
||||
|
Loading…
Reference in New Issue