spring data@query连接

tjvv9vkg  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(142)

我有三个实体与以下关系

FormEntity OnetoOne ValidationEntity 
FormEntity OnetoMany MszEntity

msz实体有一些基于语言id的消息,如eng、hin、rsa、chn。所以我创建了jpql查询,但问题是它返回了所有的语言记录
@query

@Query("select a From FormEntity As a join a.ValidationEntity As b join 
 a.MszEntity as c where a.formId =:formId and 
 c.validationLanguageId.languageId='ENG'")

响应

{
        "formFieldId": 1,
        "formId": "Login",
        "formFields": "username",
        "ValidationEntity ": {
            "formFieldId": 1,
            "required": true,
            "numberMin": 2
        },
        "spdFormFieldsValidationMszInfo": [
            {
                "formFieldId": 1,
                "versionId": 1,
                "languageId": "ENG",
                "required": "ENG- Please Enter Username",
                "numberMin": "ENG- Min 2 Number Required"
            },
            {
                "formFieldId": 1,
                "versionId": 1,
                "languageId": "CHA",
                "required": "CHA- Please Enter Username",
                "numberMin": "CHA- Min 2 Number Required"
            }
        ]
 }

预期结果

{
        "formFieldId": 1,
        "formId": "Login",
        "formFields": "username",
        "ValidationEntity ": {
            "formFieldId": 1,
            "required": true,
            "numberMin": 2
        },
        "spdFormFieldsValidationMszInfo": [
            {
                "formFieldId": 1,
                "versionId": 1,
                "languageId": "ENG",
                "required": "ENG- Please Enter Username",
                "numberMin": "ENG- Min 2 Number Required"
            }
        ]
 }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题