放弃幻想,认清现实,准备斗争
一、根据编码获取数据字典
1、controller
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<Dict> list = dictService.findByDictCode(dictCode); return R.ok().data("dictList", list); } }
2、service
接口:DictService
List<Dict> findByDictCode(String dictCode);
实现:DictServiceImpl
@Override public List<Dict> findByDictCode(String dictCode) { QueryWrapper<Dict> dictQueryWrapper = new QueryWrapper<>(); dictQueryWrapper.eq("dict_code", dictCode); Dict dict = baseMapper.selectOne(dictQueryWrapper); return this.listByParentId(dict.getId()); }
二、前端展示借款人信息
1、展示下拉列表
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 }) },
页面加载时调用
1. created() { 2. this.initSelected() 3. },
今日BUG
前端数据接受异常,页面一直无法展示,也无法跳转到汇付宝中
一直在前端查找,但是一直找不到结果,前端也拿到了数据,但是一直弄不出来,我把注意力放在后端用户,单独拿起表单的数据可以跳转过去,最后才发现,原来是前端的数据是拿到了,但是后端的这个参数是不一样的,(key value)对不上号