Skip to content

Commit

Permalink
fixed:#1695 对资源属性进行检测
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelmaxQm committed Apr 7, 2024
1 parent d1e0554 commit 7bc7c30
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion web/src/view/systemTools/autoCode/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,8 @@ defineOptions({
})
const gormModelList = ['id', 'created_at', 'updated_at', 'deleted_at']
const dataModelList = ['created_by', 'updated_by', 'deleted_by']
const typeOptions = ref([
{
label: '字符串',
Expand Down Expand Up @@ -955,7 +957,7 @@ const getColumnFunc = async() => {
form.value.fields = []
res.data.columns &&
res.data.columns.forEach(item => {
if (!form.value.gvaModel || (!gormModelList.some(gormfd => gormfd === item.columnName))) {
if (needAppend(item)) {
const fbHump = toHump(item.columnName)
form.value.fields.push({
fieldName: toUpperCase(fbHump),
Expand All @@ -977,6 +979,18 @@ const getColumnFunc = async() => {
})
}
}
const needAppend = (item) => {
let isAppend = true
if (form.value.gvaModel && gormModelList.some(gormfd => gormfd === item.columnName)) {
isAppend = false
}
if (form.value.autoCreateResource && dataModelList.some(datafd => datafd === item.columnName)) {
isAppend = false
}
return isAppend
}
const setFdMap = async() => {
const fdTypes = ['string', 'int', 'bool', 'float64', 'time.Time']
fdTypes.forEach(async fdtype => {
Expand Down

0 comments on commit 7bc7c30

Please sign in to comment.