放弃幻想,认清现实,准备斗争
sevice-core中添加接口方法
- @Api(tags = "数据字典")
- @RestController
- @RequestMapping("/api/core/dict")
- @Slf4j
- public class DictController {
-
- @Resource
- private DictService dictService;
-
- @ApiOperation("根据dictCode获取下级节点")
- @GetMapping("/findByDictCode/{dictCode}")
- public R findByDictCode(
- @ApiParam(value = "节点编码", required = true)
- @PathVariable String dictCode) {
- List
list = dictService.findByDictCode(dictCode); - return R.ok().data("dictList", list);
- }
- }
接口:DictService
List findByDictCode(String dictCode);
实现:DictServiceImpl
- @Override
- public List
findByDictCode(String dictCode) { - QueryWrapper
dictQueryWrapper = new QueryWrapper<>(); - dictQueryWrapper.eq("dict_code", dictCode);
- Dict dict = baseMapper.selectOne(dictQueryWrapper);
- return this.listByParentId(dict.getId());
- }
pages/user/borrower.vue中调用接口
定义methods:
- initSelected() {
- //学历列表
- this.$axios
- .$get('/api/core/dict/findByDictCode/education')
- .then((response) => {
- this.educationList = response.data.dictList
- })
-
- //行业列表
- this.$axios
- .$get('/api/core/dict/findByDictCode/industry')
- .then((response) => {
- this.industryList = response.data.dictList
- })
-
- //收入列表
- this.$axios
- .$get('/api/core/dict/findByDictCode/income')
- .then((response) => {
- this.incomeList = response.data.dictList
- })
-
- //还款来源列表
- this.$axios
- .$get('/api/core/dict/findByDictCode/returnSource')
- .then((response) => {
- this.returnSourceList = response.data.dictList
- })
-
- //联系人关系列表
- this.$axios
- .$get('/api/core/dict/findByDictCode/relation')
- .then((response) => {
- this.contactsRelationList = response.data.dictList
- })
- },
页面加载时调用
- created() {
- this.initSelected()
- },
前端数据接受异常,页面一直无法展示,也无法跳转到汇付宝中
一直在前端查找,但是一直找不到结果,前端也拿到了数据,但是一直弄不出来,我把注意力放在后端用户,单独拿起表单的数据可以跳转过去,最后才发现,原来是前端的数据是拿到了,但是后端的这个参数是不一样的,(key value)对不上号