| | |
| | | |
| | | export const saveOrUpdate = (data) => { |
| | | return request({ |
| | | headers:{'Content-Type':'application/json'}, |
| | | url: '/api/ubcs-system/classifyAuth/saveOrUpdate', |
| | | method: 'post', |
| | | data: data |
| | | data: JSON.stringify(data) |
| | | }) |
| | | } |
| | | |
| | |
| | | delBtn: false, |
| | | defaultExpandAll: false, |
| | | menu: false, |
| | | lazy: true, |
| | | // lazy: true, |
| | | treeLoad: (node, resolve) => { |
| | | if (node.data != false) { |
| | | const parentId = (node.level === 0) ? 0 : node.data.oid; |
| | |
| | | //æ ç¹å»äºä»¶ |
| | | async nodeClick(data) { |
| | | try { |
| | | // console.log(data) |
| | | console.log(data) |
| | | this.TreeValue = data.label.split("</span>")[1].trim(); |
| | | // console.log('TreeValue',this.TreeValue) |
| | | this.$emit('TreeValue', this.TreeValue) |
| | |
| | | visible() { |
| | | if (this.visible) { |
| | | this.isShowDialog = this.visible; |
| | | return new Promise((resolve, reject) => { |
| | | getButtonByParentCode({ code: "classifyTree" }) |
| | | .then((res) => { |
| | | // è®°å½æé®æ°æ® |
| | | this.classifyAuthButton = res.data.data; |
| | | const list = res.data.data; |
| | | let tempData = []; |
| | | // è§è²å |
| | | tempData.push({ |
| | | label: "è§è²", |
| | | prop: "roleData", |
| | | type: "select", |
| | | width: 150, |
| | | }); |
| | | // ç¼ç 项åç±»ææ |
| | | tempData.push({ |
| | | label: "ç¼ç 项åç±»ææ", |
| | | prop: "classifyItem", |
| | | type: "text", |
| | | width: 180, |
| | | }); |
| | | list.forEach((item) => { |
| | | let columnItem = { |
| | | label: item.name, |
| | | prop: item.id, |
| | | code: item.code, |
| | | type: "checkbox", |
| | | width: 180, |
| | | }; |
| | | tempData.push(columnItem); |
| | | }); |
| | | this.classifyAuthHeader = tempData; |
| | | resolve(); |
| | | }) |
| | | .catch((err) => { |
| | | reject(err); |
| | | }); |
| | | // è·åè§è²å表 |
| | | getPage(1, -1, null).then((res) => { |
| | | this.roleList = res.data.data.records; |
| | | }); |
| | | // è·å该åç±»ä¸å·²ææçåç±»ææä¿¡æ¯ |
| | | getClassifyAuthList({ |
| | | classifyId: this.classifyData.oid, |
| | | authType: "classify_auth", |
| | | }).then((res) => { |
| | | //console.log(res.data.data); |
| | | let authDatas = res.data.data; |
| | | if (authDatas.length > 0) { |
| | | authDatas.forEach((authData, index) => { |
| | | let item = { |
| | | oid: authData.oid, |
| | | roleData: authData.roleId, |
| | | classifyItem: this.classifyData.label, |
| | | authButton:{}, |
| | | index: index, |
| | | uuid: uuidv4(), //çæå¯ä¸çid |
| | | }; |
| | | //å°æé®è®¾ç½®è¿å» |
| | | authData.buttonIdList.forEach((data) => { |
| | | Vue.set(item, data, true); |
| | | }); |
| | | this.classifyAuthData.push(item); |
| | | this.addIndex = this.classifyAuthData.length - 1; //æ·»å è¡ä¸æ çäºclassifyAuthDataçé¿åº¦-1 |
| | | this.roleHandlerMethods(authData.roleId, "create", index); |
| | | // console.log('index', index) |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | this.loadAuthPage(); |
| | | } |
| | | }, |
| | | }, |
| | |
| | | if (this.classifyAuthData.length < 0) { |
| | | return; |
| | | } |
| | | |
| | | getButtonsByRoleId({ roleId: id, code: "classifyTree" }).then((res) => { |
| | | // æ¾å°this.classifyAuthButton䏿²¡æå¯¹åºç屿§ |
| | | const filteredItems = this.classifyAuthButton.filter((item) => { |
| | |
| | | this.selectList = list; |
| | | }, |
| | | // ä¿ååç±»ææä¿¡æ¯ |
| | | submit() { |
| | | if (this.classifyAuthData.length <= 0) { |
| | | this.$message.warning("ææå表为空ï¼"); |
| | | return; |
| | | } |
| | | async submit() { |
| | | let form = { |
| | | classifyAuthList: [], |
| | | isCLear: false, //é»è®¤æ¯æ¸
空 |
| | | classifyId: this.classifyData.oid, |
| | | }; |
| | | let isRepeat = false; |
| | | // éåæ°ç»ï¼æ¯è¾åé¢ç对象çroleDataæ¯å¦ä¸åé¢ç对象ç¸ç |
| | | for (let i = 0; i < this.classifyAuthData.length - 1; i++) { |
| | | let currentRoleId = this.classifyAuthData[i].roleData; |
| | | for (let j = i + 1; j < this.classifyAuthData.length; j++) { |
| | | if (currentRoleId === this.classifyAuthData[j].roleData) { |
| | | isRepeat = true; |
| | | if(this.classifyAuthData.length > 0){ |
| | | // éåæ°ç»ï¼æ¯è¾åé¢ç对象çroleDataæ¯å¦ä¸åé¢ç对象ç¸ç |
| | | for (let i = 0; i < this.classifyAuthData.length - 1; i++) { |
| | | let currentRoleId = this.classifyAuthData[i].roleData; |
| | | for (let j = i + 1; j < this.classifyAuthData.length; j++) { |
| | | if (currentRoleId === this.classifyAuthData[j].roleData) { |
| | | isRepeat = true; |
| | | break; |
| | | } |
| | | } |
| | | if (isRepeat) { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (isRepeat) { |
| | | break; |
| | | } |
| | | } |
| | | if (isRepeat) { |
| | | this.$message.warning("è§è²åå类已ç»åå¨ï¼è¯·éæ°é
ç½®ï¼"); |
| | | return; |
| | | } |
| | | let form = []; |
| | | let flag = false; |
| | | this.classifyAuthData.forEach((item) => { |
| | | let itemButtonList = []; |
| | | //çéåºæé®å¾é为trueçå |
| | | for (let key in item) { |
| | | if (item[key] === true) { |
| | | itemButtonList.push(key); |
| | | } |
| | | } |
| | | /**妿itemButtonListä¸ºç©ºè¯ææ¯ï¼ |
| | | æ·»å äºè§è²ä½æ¯æ²¡å¾éä»»ä½çæé®*/ |
| | | if (itemButtonList.length <= 0) { |
| | | flag = true; |
| | | this.$message.warning("è§è²åå类已ç»åå¨ï¼è¯·éæ°é
ç½®ï¼"); |
| | | return; |
| | | } |
| | | let data = { |
| | | oid: item.oid, |
| | | roleId: item.roleData, |
| | | classifyId: this.classifyData.oid, |
| | | buttonIds: itemButtonList.join(","), |
| | | authType: "classify_auth", |
| | | }; |
| | | form.push(data); |
| | | }); |
| | | if (flag) { |
| | | this.$message.warning("ææªå¾éæä½çæéï¼ä¸å
许ææ"); |
| | | return; |
| | | |
| | | let flag = false; |
| | | this.classifyAuthData.forEach((item) => { |
| | | let itemButtonList = []; |
| | | //çéåºæé®å¾é为trueçå |
| | | for (let key in item) { |
| | | if (item[key] === true) { |
| | | itemButtonList.push(key); |
| | | } |
| | | } |
| | | /**妿itemButtonListä¸ºç©ºè¯ææ¯ï¼ |
| | | æ·»å äºè§è²ä½æ¯æ²¡å¾éä»»ä½çæé®*/ |
| | | if (itemButtonList.length <= 0) { |
| | | flag = true; |
| | | return; |
| | | } |
| | | let data = { |
| | | oid: item.oid, |
| | | roleId: item.roleData, |
| | | classifyId: this.classifyData.oid, |
| | | buttonIds: itemButtonList.join(","), |
| | | authType: "classify_auth", |
| | | }; |
| | | form.classifyAuthList.push(data); |
| | | }); |
| | | if (flag) { |
| | | this.$message.warning("ææªå¾éæä½çæéï¼ä¸å
许ææ"); |
| | | return; |
| | | } |
| | | }else { |
| | | // ä¸ºç©ºè¯ææ¯æ¸
空ææå表 |
| | | form.isCLear = true; |
| | | } |
| | | // console.log(form) |
| | | // console.log(JSON.stringify(form)) |
| | | // è°ç¨ä¿ååç±»ææçæ¥å£ |
| | | saveOrUpdate(form).then( |
| | | await saveOrUpdate(form).then( |
| | | (res) => { |
| | | this.$message({ |
| | | type: "success", |
| | |
| | | window.console.log(error); |
| | | } |
| | | ); |
| | | this.classifyAuthData = []; |
| | | this.loadAuthPage(); |
| | | }, |
| | | // å
¨éæé® |
| | | selectAllButton() { |
| | |
| | | }); |
| | | //console.log("this.selectList",this.selectList); |
| | | }, |
| | | // å è½½ææå表 |
| | | loadAuthPage() { |
| | | return new Promise((resolve, reject) => { |
| | | getButtonByParentCode({ code: "classifyTree" }) |
| | | .then((res) => { |
| | | // è®°å½æé®æ°æ® |
| | | this.classifyAuthButton = res.data.data; |
| | | const list = res.data.data; |
| | | let tempData = []; |
| | | // è§è²å |
| | | tempData.push({ |
| | | label: "è§è²", |
| | | prop: "roleData", |
| | | type: "select", |
| | | width: 150, |
| | | }); |
| | | // ç¼ç 项åç±»ææ |
| | | tempData.push({ |
| | | label: "ç¼ç 项åç±»ææ", |
| | | prop: "classifyItem", |
| | | type: "text", |
| | | width: 180, |
| | | }); |
| | | list.forEach((item) => { |
| | | let columnItem = { |
| | | label: item.name, |
| | | prop: item.id, |
| | | code: item.code, |
| | | type: "checkbox", |
| | | width: 180, |
| | | }; |
| | | tempData.push(columnItem); |
| | | }); |
| | | this.classifyAuthHeader = tempData; |
| | | resolve(); |
| | | }) |
| | | .catch((err) => { |
| | | reject(err); |
| | | }); |
| | | // è·åè§è²å表 |
| | | getPage(1, -1, null).then((res) => { |
| | | this.roleList = res.data.data.records; |
| | | }); |
| | | // è·å该åç±»ä¸å·²ææçåç±»ææä¿¡æ¯ |
| | | getClassifyAuthList({ |
| | | classifyId: this.classifyData.oid, |
| | | authType: "classify_auth", |
| | | }).then((res) => { |
| | | //console.log(res.data.data); |
| | | let authDatas = res.data.data; |
| | | if (authDatas.length > 0) { |
| | | authDatas.forEach((authData, index) => { |
| | | let item = { |
| | | oid: authData.oid, |
| | | roleData: authData.roleId, |
| | | classifyItem: this.classifyData.label, |
| | | authButton:{}, |
| | | index: index, |
| | | uuid: uuidv4(), //çæå¯ä¸çid |
| | | }; |
| | | //å°æé®è®¾ç½®è¿å» |
| | | authData.buttonIdList.forEach((data) => { |
| | | Vue.set(item, data, true); |
| | | }); |
| | | this.classifyAuthData.push(item); |
| | | this.addIndex = this.classifyAuthData.length - 1; //æ·»å è¡ä¸æ çäºclassifyAuthDataçé¿åº¦-1 |
| | | this.roleHandlerMethods(authData.roleId, "create", index); |
| | | // console.log('index', index) |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | visible() { |
| | | if (this.visible) { |
| | | this.isShowDialog = this.visible; |
| | | return new Promise((resolve, reject) => { |
| | | getButtonByParentCode({code: this.classifyData.attributes.id}).then(res => { |
| | | // è®°å½æé®æ°æ® |
| | | this.classifyAuthButton = res.data.data; |
| | | const list = res.data.data; |
| | | let tempData = []; |
| | | // è§è²å |
| | | tempData.push({ |
| | | label: "è§è²", |
| | | prop: "roleData", |
| | | type: "select", |
| | | width: 150, |
| | | }); |
| | | // ç¼ç 项åç±»ææ |
| | | tempData.push({ |
| | | label: "ç¼ç é¡¹æ°æ®ææ", |
| | | prop: "classifyItem", |
| | | type: "text", |
| | | width: 180, |
| | | }); |
| | | list.forEach(item => { |
| | | let columnItem = { |
| | | label: item.name, |
| | | prop: item.id, |
| | | code: item.code, |
| | | type: "checkbox", |
| | | width: 180, |
| | | }; |
| | | tempData.push(columnItem); |
| | | }) |
| | | this.classifyAuthHeader = tempData |
| | | resolve(); |
| | | }).catch(err => { |
| | | reject(err) |
| | | }); |
| | | // è·åè§è²å表 |
| | | getPage(1, -1, null).then(res => { |
| | | this.roleList = res.data.data.records; |
| | | }); |
| | | // è·å该åç±»ä¸å·²ææçåç±»ææä¿¡æ¯ |
| | | getClassifyAuthList({classifyId: this.classifyData.oid, authType: "data_auth"}).then(res => { |
| | | //console.log(res.data.data); |
| | | let authDatas = res.data.data; |
| | | if (authDatas.length > 0) { |
| | | authDatas.forEach((authData, index) => { |
| | | let item = { |
| | | oid: authData.oid, |
| | | roleData: authData.roleId, |
| | | classifyItem: this.classifyData.label, |
| | | index: index, |
| | | authButton:{}, |
| | | uuid: uuidv4(),//çæå¯ä¸çid |
| | | } |
| | | //å°æé®è®¾ç½®è¿å» |
| | | authData.buttonIdList.forEach(data => { |
| | | Vue.set(item, data, true); |
| | | }); |
| | | this.classifyAuthData.push(item); |
| | | this.addIndex = this.classifyAuthData.length - 1; //æ·»å è¡ä¸æ çäºclassifyAuthDataçé¿åº¦-1 |
| | | this.roleHandlerMethods(authData.roleId, 'create', index) |
| | | }) |
| | | } |
| | | }); |
| | | }); |
| | | this.loadAuthPage(); |
| | | } |
| | | }, |
| | | }, |
| | |
| | | this.selectList = list; |
| | | }, |
| | | // ä¿ååç±»ææä¿¡æ¯ |
| | | submit() { |
| | | if (this.classifyAuthData.length <= 0) { |
| | | this.$message.warning('ææå表为空ï¼') |
| | | return; |
| | | } |
| | | async submit() { |
| | | let form = { |
| | | classifyAuthList: [], |
| | | isCLear: false, //é»è®¤æ¯æ¸
空 |
| | | classifyId: this.classifyData.oid, |
| | | }; |
| | | let isRepeat = false; |
| | | // éåæ°ç»ï¼æ¯è¾åé¢ç对象çroleDataæ¯å¦ä¸åé¢ç对象ç¸ç |
| | | for (let i = 0; i < this.classifyAuthData.length - 1; i++) { |
| | | let currentRoleId = this.classifyAuthData[i].roleData; |
| | | for (let j = i + 1; j < this.classifyAuthData.length; j++) { |
| | | if (currentRoleId === this.classifyAuthData[j].roleData) { |
| | | isRepeat = true; |
| | | if (this.classifyAuthData.length > 0) { |
| | | // éåæ°ç»ï¼æ¯è¾åé¢ç对象çroleDataæ¯å¦ä¸åé¢ç对象ç¸ç |
| | | for (let i = 0; i < this.classifyAuthData.length - 1; i++) { |
| | | let currentRoleId = this.classifyAuthData[i].roleData; |
| | | for (let j = i + 1; j < this.classifyAuthData.length; j++) { |
| | | if (currentRoleId === this.classifyAuthData[j].roleData) { |
| | | isRepeat = true; |
| | | break; |
| | | } |
| | | } |
| | | if (isRepeat) { |
| | | break; |
| | | } |
| | | } |
| | | if (isRepeat) { |
| | | break; |
| | | } |
| | | } |
| | | if (isRepeat) { |
| | | this.$message.warning("è§è²åå类已ç»åå¨ï¼è¯·éæ°é
ç½®ï¼"); |
| | | return; |
| | | } |
| | | let form = []; |
| | | let flag = false; |
| | | this.classifyAuthData.forEach(item => { |
| | | let itemButtonList = []; |
| | | //çéåºæé®å¾é为trueçå |
| | | for (let key in item) { |
| | | if (item[key] === true) { |
| | | itemButtonList.push(key); |
| | | } |
| | | } |
| | | /**妿itemButtonListä¸ºç©ºè¯ææ¯ï¼ |
| | | æ·»å äºè§è²ä½æ¯æ²¡å¾éä»»ä½çæé®*/ |
| | | if (itemButtonList.length <= 0) { |
| | | flag = true; |
| | | this.$message.warning("è§è²åå类已ç»åå¨ï¼è¯·éæ°é
ç½®ï¼"); |
| | | return; |
| | | } |
| | | let data = { |
| | | oid: item.oid, |
| | | roleId: item.roleData, |
| | | classifyId: this.classifyData.oid, |
| | | buttonIds: itemButtonList.join(","), |
| | | authType: "data_auth", |
| | | } |
| | | form.push(data); |
| | | }); |
| | | if (flag) { |
| | | this.$message.warning('ææªå¾éæä½çæéï¼ä¸å
许ææ') |
| | | return; |
| | | } |
| | | // console.log(form) |
| | | // è°ç¨ä¿ååç±»ææçæ¥å£ |
| | | saveOrUpdate(form).then(res => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: res.data.msg, |
| | | let flag = false; |
| | | this.classifyAuthData.forEach(item => { |
| | | let itemButtonList = []; |
| | | //çéåºæé®å¾é为trueçå |
| | | for (let key in item) { |
| | | if (item[key] === true) { |
| | | itemButtonList.push(key); |
| | | } |
| | | } |
| | | /**妿itemButtonListä¸ºç©ºè¯ææ¯ï¼ |
| | | æ·»å äºè§è²ä½æ¯æ²¡å¾éä»»ä½çæé®*/ |
| | | if (itemButtonList.length <= 0) { |
| | | flag = true; |
| | | return; |
| | | } |
| | | let data = { |
| | | oid: item.oid, |
| | | roleId: item.roleData, |
| | | classifyId: this.classifyData.oid, |
| | | buttonIds: itemButtonList.join(","), |
| | | authType: "data_auth", |
| | | } |
| | | form.classifyAuthList.push(data); |
| | | }); |
| | | // this.isShowDialog = false |
| | | }, (error) => { |
| | | window.console.log(error); |
| | | }) |
| | | if (flag) { |
| | | this.$message.warning('ææªå¾éæä½çæéï¼ä¸å
许ææ') |
| | | return; |
| | | } |
| | | // console.log(form) |
| | | // è°ç¨ä¿ååç±»ææçæ¥å£ |
| | | await saveOrUpdate(form).then(res => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: res.data.msg, |
| | | }); |
| | | // this.isShowDialog = false |
| | | }, (error) => { |
| | | window.console.log(error); |
| | | }) |
| | | }else{ |
| | | // ä¸ºç©ºè¯ææ¯æ¸
空ææå表 |
| | | form.isCLear = true; |
| | | } |
| | | this.classifyAuthData = []; |
| | | this.loadAuthPage(); |
| | | }, |
| | | // å
¨éæé® |
| | | selectAllButton() { |
| | |
| | | }); |
| | | //console.log("this.selectList",this.selectList); |
| | | }, |
| | | loadAuthPage() { |
| | | return new Promise((resolve, reject) => { |
| | | console.log(this.classifyData); |
| | | getButtonByParentCode({code: this.classifyData.attributes.id}).then(res => { |
| | | // è®°å½æé®æ°æ® |
| | | this.classifyAuthButton = res.data.data; |
| | | const list = res.data.data; |
| | | let tempData = []; |
| | | // è§è²å |
| | | tempData.push({ |
| | | label: "è§è²", |
| | | prop: "roleData", |
| | | type: "select", |
| | | width: 150, |
| | | }); |
| | | // ç¼ç 项åç±»ææ |
| | | tempData.push({ |
| | | label: "ç¼ç é¡¹æ°æ®ææ", |
| | | prop: "classifyItem", |
| | | type: "text", |
| | | width: 180, |
| | | }); |
| | | list.forEach(item => { |
| | | let columnItem = { |
| | | label: item.name, |
| | | prop: item.id, |
| | | code: item.code, |
| | | type: "checkbox", |
| | | width: 180, |
| | | }; |
| | | tempData.push(columnItem); |
| | | }) |
| | | this.classifyAuthHeader = tempData |
| | | resolve(); |
| | | }).catch(err => { |
| | | reject(err) |
| | | }); |
| | | // è·åè§è²å表 |
| | | getPage(1, -1, null).then(res => { |
| | | this.roleList = res.data.data.records; |
| | | }); |
| | | // è·å该åç±»ä¸å·²ææçåç±»ææä¿¡æ¯ |
| | | getClassifyAuthList({classifyId: this.classifyData.oid, authType: "data_auth"}).then(res => { |
| | | //console.log(res.data.data); |
| | | let authDatas = res.data.data; |
| | | if (authDatas.length > 0) { |
| | | authDatas.forEach((authData, index) => { |
| | | let item = { |
| | | oid: authData.oid, |
| | | roleData: authData.roleId, |
| | | classifyItem: this.classifyData.label, |
| | | index: index, |
| | | authButton:{}, |
| | | uuid: uuidv4(),//çæå¯ä¸çid |
| | | } |
| | | //å°æé®è®¾ç½®è¿å» |
| | | authData.buttonIdList.forEach(data => { |
| | | Vue.set(item, data, true); |
| | | }); |
| | | this.classifyAuthData.push(item); |
| | | this.addIndex = this.classifyAuthData.length - 1; //æ·»å è¡ä¸æ çäºclassifyAuthDataçé¿åº¦-1 |
| | | this.roleHandlerMethods(authData.roleId, 'create', index) |
| | | }) |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.system.dto; |
| | | |
| | | import com.vci.ubcs.system.entity.ClassifyAuth; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author ludc |
| | | * @date 2024/1/24 17:57 |
| | | */ |
| | | @Data |
| | | public class ClassifyAuthDTO { |
| | | |
| | | |
| | | private List<ClassifyAuth> classifyAuthList; |
| | | |
| | | /** |
| | | * æ¯å¦æ¸
空 trueæ¯æ¸
空ï¼false䏿¯æ¸
空 |
| | | */ |
| | | // @NotBlank(message = "å¿
ä¼ åæ°isCLearä¸è½ä¸ºç©º") |
| | | private Boolean isCLear; |
| | | |
| | | /** |
| | | * åç±»id |
| | | */ |
| | | // @NotBlank(message = "å¿
ä¼ åæ°classifyIdä¸è½ä¸ºç©º") |
| | | private String classifyId; |
| | | } |
| | |
| | | } |
| | | if(StringUtils.isNotBlank(id) || StringUtils.isNotBlank(lcStatus) ){ |
| | | //String tableName = this.getTableName(treeQueryObject.getConditionMap().get("btmTypeId"),treeQueryObject.getConditionMap().get("id"), treeQueryObject.getConditionMap().get("lcStatus")); |
| | | // TODO: 2024-1-24 23:25æå»æäºæå è½½ï¼å 为ä¼å½±åæ°æ®ææè¿æ»¤ï¼èä¸è¿å¿æè§æ²¡å¿
è¦åæå è½½ |
| | | doList = codeClassifyMapper |
| | | .selectCodeClassifyDOByTree( |
| | | treeQueryObject.getConditionMap().get("id"), |
| | |
| | | if(!viewClassByRoleIds.isSuccess() && viewClassByRoleIds.getData().isEmpty()){ |
| | | throw new ServiceException("ä¸»æ°æ®æ¥çæéæªé
ç½®ï¼æé
ç½®æè¯¯ï¼"); |
| | | } |
| | | long startTime = System.currentTimeMillis(); |
| | | // è¿æ»¤ |
| | | filterTreeNodes(tree,viewClassByRoleIds.getData()); |
| | | long endTime = System.currentTimeMillis(); |
| | | System.out.println(("æ§è¡æ¶é´ï¼"+(endTime-startTime)/1000)+"s"); |
| | | } |
| | | // å è½½åç±»æ¯å¦å
·æååç±» |
| | | tree.parallelStream().forEach(item -> { |
| | |
| | | /*Boolean checkHasChild = checkHasChild(tree.getOid()); |
| | | tree.setLeaf(!checkHasChild);*/ |
| | | if (classifyIds.contains(tree.getOid())) { |
| | | // 妿顶å±èç¹åå¨äº classifyIds ä¸ï¼ç´æ¥ä¿çå
¶åèç¹éå |
| | | // 妿顶å±èç¹åå¨ classifyIds ï¼ç´æ¥ä¿çå
¶åèç¹éå |
| | | continue; |
| | | } |
| | | if (tree.getChildren() != null && !tree.getChildren().isEmpty()) { |
| | |
| | | left join pl_code_resemblerule coderesembleruleoid |
| | | on codeclassify0.codeResembleRuleOid = coderesembleruleoid.oid |
| | | where codeclassify0.lcstatus = #{lcstatus} |
| | | <if test="parentcodeclassifyoid != null and parentcodeclassifyoid != ''"> |
| | | and codeclassify0.parentcodeclassifyoid = #{parentcodeclassifyoid} |
| | | </if> |
| | | <if test="parentcodeclassifyoid == null or parentcodeclassifyoid == ''"> |
| | | and codeclassify0.parentcodeclassifyoid is null |
| | | and codeclassify0.id = #{id} |
| | | </if> |
| | | and codeclassify0.parentcodeclassifyoid = ( |
| | | SELECT |
| | | OID |
| | | FROM |
| | | PL_CODE_CLASSIFY |
| | | WHERE |
| | | parentcodeclassifyoid IS NULL |
| | | AND id = #{id} |
| | | ) |
| | | or codeclassify0.parentcodeclassifyoid IS NULL |
| | | and codeclassify0.id = #{id} |
| | | <if test="tenantId != null and tenantId != ''"> |
| | | and codeclassify0.tenant_id = #{tenantId} |
| | | </if> |
| | |
| | | package com.vci.ubcs.system.controller; |
| | | |
| | | import com.vci.ubcs.system.dto.ClassifyAuthDTO; |
| | | import com.vci.ubcs.system.entity.ClassifyAuth; |
| | | import com.vci.ubcs.system.service.IClassifyAuthService; |
| | | import com.vci.ubcs.system.vo.ClassifyAuthVO; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | /** |
| | | * åç±»ææä¿åæ¥å£ |
| | | * @param classifyAuthList |
| | | * @param classifyAuthListDTO |
| | | * @return |
| | | */ |
| | | @PostMapping("/saveOrUpdate") |
| | | public R saveOrUpdate(@RequestBody List<ClassifyAuth> classifyAuthList) { |
| | | return classifyAuthService.submit(classifyAuthList); |
| | | public R saveOrUpdate(@RequestBody @Valid ClassifyAuthDTO classifyAuthListDTO) throws ServiceException { |
| | | return classifyAuthService.submit(classifyAuthListDTO); |
| | | } |
| | | |
| | | /** |
| | |
| | | package com.vci.ubcs.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vci.ubcs.system.dto.ClassifyAuthDTO; |
| | | import com.vci.ubcs.system.entity.ClassifyAuth; |
| | | import com.vci.ubcs.system.entity.Menu; |
| | | import com.vci.ubcs.system.vo.ClassifyAuthVO; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.tool.api.R; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | /** |
| | | * åç±»ææä¿åæ¥å£ |
| | | * @param classifyAuthList |
| | | * @param classifyAuthListDTO |
| | | * @return |
| | | */ |
| | | R submit(List<ClassifyAuth> classifyAuthList); |
| | | R submit(ClassifyAuthDTO classifyAuthListDTO) throws ServiceException; |
| | | |
| | | /** |
| | | * è·ååç±»ææéå |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vci.ubcs.code.feign.ICodeClassifyClient; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import com.vci.ubcs.system.dto.ClassifyAuthDTO; |
| | | import com.vci.ubcs.system.entity.ClassifyAuth; |
| | | import com.vci.ubcs.system.entity.Menu; |
| | | import com.vci.ubcs.system.mapper.ClassifyAuthMapper; |
| | |
| | | |
| | | /** |
| | | * åç±»ææä¿åæ¥å£ |
| | | * @param classifyAuthList |
| | | * @param classifyAuthListDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R submit(List<ClassifyAuth> classifyAuthList) { |
| | | if(classifyAuthList.isEmpty()){ |
| | | public R submit(ClassifyAuthDTO classifyAuthListDTO) throws ServiceException{ |
| | | // æ¯æ¸
空ææå表 |
| | | if(classifyAuthListDTO.getIsCLear()){ |
| | | if(Func.isEmpty(classifyAuthListDTO.getClassifyId())){ |
| | | return R.fail("æ¸
空ææå表æ¶ï¼æªè·åçåç±»id"); |
| | | } |
| | | this.classifyAuthMapper.delete(Wrappers.<ClassifyAuth>update() |
| | | .lambda().eq(ClassifyAuth::getClassifyId, classifyAuthListDTO.getClassifyId()) |
| | | ); |
| | | return R.success("ææå表æ¸
空æå"); |
| | | } |
| | | |
| | | if(!classifyAuthListDTO.getIsCLear() && classifyAuthListDTO.getClassifyAuthList().isEmpty()){ |
| | | R.fail("ææå表ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | // å¤éï¼æ¥çæ¯å¦åå¨åä¸ä¸ªclassidä¸é
ç½®äºç¸åçè§è² |
| | | Map<String, Long> roleidCounts = classifyAuthList.stream() |
| | | Map<String, Long> roleidCounts = classifyAuthListDTO.getClassifyAuthList().stream() |
| | | .collect(Collectors.groupingBy(ClassifyAuth::getRoleId, Collectors.counting())); |
| | | |
| | | // æ£æ¥æ¯å¦æroleidåºç°æ¬¡æ°å¤§äº1çæ
åµ |
| | |
| | | } |
| | | |
| | | // å¦æä¼ è¿æ¥çéåä¸è¯¥åç±»idä¸å é¤äºé¨åè§è²çææï¼å°±éè¦å°è¯¥åºä¸classifyIdä¸ä¸åå¨çæ°æ®å æ |
| | | List<String> roleIds = classifyAuthList.stream().map(ClassifyAuth::getRoleId).collect(Collectors.toList()); |
| | | List<String> roleIds = classifyAuthListDTO.getClassifyAuthList().stream().map(ClassifyAuth::getRoleId).collect(Collectors.toList()); |
| | | // å é¤ |
| | | LambdaUpdateWrapper<ClassifyAuth> updateWrapper = Wrappers.<ClassifyAuth>update() |
| | | .lambda().eq(ClassifyAuth::getClassifyId, classifyAuthList.get(0).getClassifyId()) |
| | | .lambda().eq(ClassifyAuth::getClassifyId, classifyAuthListDTO.getClassifyAuthList().get(0).getClassifyId()) |
| | | .notIn(ClassifyAuth::getRoleId, roleIds); |
| | | try { |
| | | this.classifyAuthMapper.delete(updateWrapper); |
| | | }catch (Exception e){ |
| | | throw new ServiceException("åç±»ææè¿ç¨ä¸åºç°é误ï¼é误åå ï¼"+e.getMessage()); |
| | | } |
| | | return R.status(saveOrUpdateBatch(classifyAuthList)); |
| | | return R.status(saveOrUpdateBatch(classifyAuthListDTO.getClassifyAuthList())); |
| | | } |
| | | |
| | | /** |