@Table(name = "st_microcode")
@Entity
@Data
public class StMicrocode {
@Column(nullable = true, name = "id")
@Id
private String id;
@Column(nullable = true, name = "id1")
private String id1;
@Column(nullable = true, name = "code")
private String code;
@Column(nullable = true, name = "name")
private String name;
@Column(nullable = true, name = "setvalue")
private String setvalue;
@Column(nullable = true, name = "issys")
private String issys;
@Column(nullable = true, name = "setting")
private Long setting;
@Column(nullable = true, name = "isset")
private Long isset;
@Column(nullable = true, name = "indexno")
private Long indexno;
@Column(nullable = true, name = "memo")
private String memo;
@Column(nullable = true, name = "status")
private String status;
@Column(nullable = true, name = "belong_comid")
private String belongComid;
@Column(nullable = true, name = "id2")
private String id2;
}
自定义查询返回的dto
@Data
@AllArgsConstructor
public class MicroCodeDto {
private String id;
private String code;
private String name;
}
查询方法
@Query(value = "select new com.hencego.web_service.dto.MicroCodeDto(a.id,a.code,a.name) from StMicrocode a where a.code like ?1 and a.status = '1'")
List<MicroCodeDto> findAllXDMCheckOptions(String flag);