Skip to content

Commit

Permalink
feat: 在存在enum的情况下自动化代码时候会校验其赋值并且在错误时候自动包裹
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelmaxQm committed Oct 18, 2024
1 parent b0eedfd commit 9786886
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions web/src/view/systemTools/autoCode/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,20 @@ const enterForm = async(isPreview) => {
return false
}
form.value.humpPackageName = toSQLLine(form.value.packageName)
form.value.fields.forEach(item => {
if(item.fieldType === 'enum'){
// 判断一下 item.dataTypeLong 按照,切割后的每个元素是否都使用 '' 包裹,如果没包 则修改为包裹起来的 然后再转为字符串赋值给 item.dataTypeLong
const arr = item.dataTypeLong.split(',')
arr.forEach((ele, index) => {
if(ele.indexOf("'") === -1){
arr[index] = `'${ele}'`
}
})
item.dataTypeLong = arr.join(',')
}
})
delete form.value.primaryField
if (isPreview) {
const data = await preview(form.value)
Expand Down

0 comments on commit 9786886

Please sign in to comment.