java接口开发根据数据字典内容编写对应的接口
1.在页面中:
<el-form-item label="课程等级" prop="grade"><b v-for="grade in gradeList"> //遍历gradeList
<el-radio v-model="courseForm.grade" :label="grade.sdId" >{{grade.sdName}}</el-radio>
</b>
</el-form-item>
data() {return {
gradeList:[]
}
}
2.方法:
//查询数据字典//查询课程等级
systemApi.sys_getDictionary("200").then(res=>{
this.gradeList = res.dvalue;
})
/*数据字典 */export const sys_getDictionary= dType => {
return http.requestQuickGet(apiUrl+\'/sys/dictionary/get/\'+dType)
}
3.java接口:
3.1数据模型
@Data@ToString
@Document(collection = "sys_dictionary")
public class SysDictionary {
@Id
private String id;
@Field("d_name")
private String dName;
@Field("d_type")
private String dType;
@Field("d_value")
private List<SysDictionaryValue> dValue;
}
3.2 SysDictionaryValue类型:
@Data@ToString
public class SysDictionaryValue {
@Field("sd_id")
private String sdId;
@Field("sd_name")
private String sdName;
@Field("sd_status")
private String sdStatus;
}
3.3API接口调用
@Api(value = "数据字典接口",description = "提供数据字典接口的管理、查询功能")public interface SysDicthinaryControllerApi {
//数据字典
@ApiOperation(value="数据字典查询接口")
public SysDictionary getByType(String type);
}
以上是 java接口开发根据数据字典内容编写对应的接口 的全部内容, 来源链接: utcz.com/z/390422.html