验证生成工具

beetlsql3-dev
Mlxa0324 3 years ago
parent 6678ab7511
commit 7fa118e856

@ -2,106 +2,106 @@ queryByCondition
===
* 根据不为空的参数进行分页查询
select
\ @pageTag(){
t.*
\ @}
from ${entity.tableName} t
where 1=1
\ @//数据权限该sql语句功能点,如果不考虑数据权限,可以删除此行
and #function("${entity.code}.query")#
@for(attr in attrs){
@if(null != attr.status){
\ @if(isEmpty(${attr.name}) && isEmpty(${attr.name}Plural)){
and t.${attr.colName} != 2
\ @}else{
\ @if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\ @}else if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\ @}
\ @}
@}else{
\ @if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\ @}
@if(attr.isChoice || attr.isOtherId){
\ @if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\ @}
@}
@}
@}
select
\@pageTag(){
t.*
\@}
from ${entity.tableName} t
where 1=1
\@//数据权限该sql语句功能点,如果不考虑数据权限,可以删除此行
and #function("${entity.code}.query")#
@for(attr in attrs){
@if(null != attr.status){
\@if(isEmpty(${attr.name}) && isEmpty(${attr.name}Plural)){
and t.${attr.colName} != 2
\@}else{
\@if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\@}else if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\@}
\@}
@}else{
\@if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\@}
@if(attr.isChoice || attr.isOtherId){
\@if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\@}
@}
@}
@}
queryByConditionQuery
===
* 根据不为空的参数进行分页查询(无权限)
select
\ @pageTag(){
t.*
\ @}
from ${entity.tableName} t
where 1=1
@for(attr in attrs){
@if(null != attr.status){
\ @if(isEmpty(${attr.name}) && isEmpty(${attr.name}Plural)){
and t.${attr.colName} != 2
\ @}else{
\ @if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\ @}else if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\ @}
\ @}
@}else{
\ @if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\ @}
@if(attr.isChoice || attr.isOtherId){
\ @if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\ @}
@}
@}
@}
@if(null != entity.status){
select
\@pageTag(){
t.*
\@}
from ${entity.tableName} t
where 1=1
@for(attr in attrs){
@if(null != attr.status){
\@if(isEmpty(${attr.name}) && isEmpty(${attr.name}Plural)){
and t.${attr.colName} != 2
\@}else{
\@if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\@}else if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\@}
\@}
@}else{
\@if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\@}
@if(attr.isChoice || attr.isOtherId){
\@if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\@}
@}
@}
@}
@if(null != entity.status){
delete${entity.name}ByIds
===
* 批量删除(假删除)
update ${entity.tableName} set ${entity.status} = 2 where find_in_set(${entity.idAttribute.colName},#ids#)
update ${entity.tableName} set ${entity.status} = 2 where find_in_set(${entity.idAttribute.colName},#ids#)
deleteByIds
===
* 批量删除(真删除)
delete from ${entity.tableName} where find_in_set(${entity.idAttribute.colName},#ids#)
@}else{
delete from ${entity.tableName} where find_in_set(${entity.idAttribute.colName},#ids#)
@}else{
delete${entity.name}ByIds
===
* 批量删除
delete from ${entity.tableName} where find_in_set(${entity.idAttribute.colName},#ids#)
@}
delete from ${entity.tableName} where find_in_set(${entity.idAttribute.colName},#ids#)
@}
getByIds
===
select * from ${entity.tableName} where find_in_set(${entity.idAttribute.colName},#ids#)
select * from ${entity.tableName} where find_in_set(${entity.idAttribute.colName},#ids#)
updateGivenByIds
@ -109,165 +109,165 @@ updateGivenByIds
* 批量更新指定字段,无论此字段是否有值
update ${entity.tableName}
set
@for(attr in attrs){
@if(!attr.isId){
\ @if(contain("${attr.name}",_given)){
\ @if(isEmpty(${attr.name})){
${attr.colName} = null ,
\ @}else{
${attr.colName} = #${attr.name}# ,
\ @}
\ @}
@}
@}
@for(attr in attrs){
@if(attr.isId){
${attr.colName} = ${attr.colName}
@}
@}
where find_in_set(${entity.idAttribute.colName},#${entity.idAttribute.name}Plural#)
update ${entity.tableName}
set
@for(attr in attrs){
@if(!attr.isId){
\@if(contain("${attr.name}",_given)){
\@if(isEmpty(${attr.name})){
${attr.colName} = null ,
\@}else{
${attr.colName} = #${attr.name}# ,
\@}
\@}
@}
@}
@for(attr in attrs){
@if(attr.isId){
${attr.colName} = ${attr.colName}
@}
@}
where find_in_set(${entity.idAttribute.colName},#${entity.idAttribute.name}Plural#)
get${entity.name}Values
===
* 根据不为空的参数进行查询
select t.*
from ${entity.tableName} t
where 1=1
@for(attr in attrs){
@if(null != attr.status){
\ @if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\ @}else{
and t.${attr.colName} != 2
\ @}
@}else{
\ @if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\ @}
@}
@}
select t.*
from ${entity.tableName} t
where 1=1
@for(attr in attrs){
@if(null != attr.status){
\@if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\@}else{
and t.${attr.colName} != 2
\@}
@}else{
\@if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\@}
@}
@}
getValuesByQuery
===
* 根据不为空的参数进行查询
select t.*
from ${entity.tableName} t
where 1=1 and #function("${entity.code}.query")#
@for(attr in attrs){
@if(null != attr.status){
\ @if(isEmpty(${attr.name}) && isEmpty(${attr.name}Plural)){
and t.${attr.colName} != 2
\ @}else{
\ @if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\ @}else if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\ @}
\ @}
@}else{
\ @if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\ @}
@if(attr.isChoice || attr.isOtherId){
\ @if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\ @}
@}
@}
@}
@if(entity.includeExcel){
select t.*
from ${entity.tableName} t
where 1=1 and #function("${entity.code}.query")#
@for(attr in attrs){
@if(null != attr.status){
\@if(isEmpty(${attr.name}) && isEmpty(${attr.name}Plural)){
and t.${attr.colName} != 2
\@}else{
\@if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\@}else if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\@}
\@}
@}else{
\@if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\@}
@if(attr.isChoice || attr.isOtherId){
\@if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\@}
@}
@}
@}
@if(entity.includeExcel){
getExcelValues
===
* 根据不为空的参数进行查询导入需要的参数
SELECT * FROM (
(
select
@for(attr in attrs){
@if(!attr.isId && !attr.isAddTime && !attr.isOrgId && !attr.isUserId) {
@if(attrLP.last){
MAX(LENGTH(t.${attr.colName})) ${attr.colName}
@}else{
MAX(LENGTH(t.${attr.colName})) ${attr.colName},
@}
@}
@}
from ${entity.tableName} t
where 1=1 and #function("${entity.code}.query")#
@for(attr in attrs){
@if(null != attr.status){
\ @if(isEmpty(${attr.name}) && isEmpty(${attr.name}Plural)){
and t.${attr.colName} != 2
\ @}else{
\ @if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\ @}else if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\ @}
\ @}
@}else{
\ @if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\ @}
@if(attr.isChoice || attr.isOtherId){
\ @if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\ @}
@}
@}
@}
)
UNION ALL
(
select
@for(attr in attrs){
@if(!attr.isId && !attr.isAddTime && !attr.isOrgId && !attr.isUserId) {
@if(attrLP.last){
t.${attr.colName}
@}else{
t.${attr.colName} ,
@}
@}
@}
from ${entity.tableName} t
where 1=1 and #function("${entity.code}.query")#
@for(attr in attrs){
@if(null != attr.status){
\ @if(isEmpty(${attr.name}) && isEmpty(${attr.name}Plural)){
and t.${attr.colName} != 2
\ @}else{
\ @if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\ @}else if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\ @}
\ @}
@}else{
\ @if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\ @}
@if(attr.isChoice || attr.isOtherId){
\ @if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\ @}
@}
@}
@}
)
)t
@}
SELECT * FROM (
(
select
@for(attr in attrs){
@if(!attr.isId && !attr.isAddTime && !attr.isOrgId && !attr.isUserId) {
@if(attrLP.last){
MAX(LENGTH(t.${attr.colName})) ${attr.colName}
@}else{
MAX(LENGTH(t.${attr.colName})) ${attr.colName},
@}
@}
@}
from ${entity.tableName} t
where 1=1 and #function("${entity.code}.query")#
@for(attr in attrs){
@if(null != attr.status){
\@if(isEmpty(${attr.name}) && isEmpty(${attr.name}Plural)){
and t.${attr.colName} != 2
\@}else{
\@if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\@}else if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\@}
\@}
@}else{
\@if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\@}
@if(attr.isChoice || attr.isOtherId){
\@if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\@}
@}
@}
@}
)
UNION ALL
(
select
@for(attr in attrs){
@if(!attr.isId && !attr.isAddTime && !attr.isOrgId && !attr.isUserId) {
@if(attrLP.last){
t.${attr.colName}
@}else{
t.${attr.colName} ,
@}
@}
@}
from ${entity.tableName} t
where 1=1 and #function("${entity.code}.query")#
@for(attr in attrs){
@if(null != attr.status){
\@if(isEmpty(${attr.name}) && isEmpty(${attr.name}Plural)){
and t.${attr.colName} != 2
\@}else{
\@if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\@}else if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\@}
\@}
@}else{
\@if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\@}
@if(attr.isChoice || attr.isOtherId){
\@if(!isEmpty(${attr.name}Plural)){
and find_in_set(t.${attr.colName},#${attr.name}Plural#)
\@}
@}
@}
@}
)
)t
@}

@ -0,0 +1,390 @@
queryByCondition
===
* 根据不为空的参数进行分页查询
select
@pageTag(){
t.*
@}
from teacher_open_course_score_dashboard t
where 1=1
@//数据权限该sql语句功能点,如果不考虑数据权限,可以删除此行
and #function("teacherOpenCourseScoreDashboard.query")#
@if(!isEmpty(teacherOpenCourseScoreDashboardId)){
and t.teacher_open_course_score_dashboard_id =#teacherOpenCourseScoreDashboardId#
@}
@if(!isEmpty(teacherOpenCourseScoreDashboardIdPlural)){
and find_in_set(t.teacher_open_course_score_dashboard_id,#teacherOpenCourseScoreDashboardIdPlural#)
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(studentIdPlural)){
and find_in_set(t.student_id,#studentIdPlural#)
@}
@if(!isEmpty(signinScore)){
and t.signin_score =#signinScore#
@}
@if(!isEmpty(courseScore)){
and t.course_score =#courseScore#
@}
@if(!isEmpty(realOperationScore)){
and t.real_operation_score =#realOperationScore#
@}
@if(!isEmpty(questionHomeworkScore)){
and t.question_homework_score =#questionHomeworkScore#
@}
@if(!isEmpty(examScore)){
and t.exam_score =#examScore#
@}
@if(!isEmpty(chatScore)){
and t.chat_score =#chatScore#
@}
@if(!isEmpty(totalScore)){
and t.total_score =#totalScore#
@}
@if(!isEmpty(manualScore)){
and t.manual_score =#manualScore#
@}
@if(!isEmpty(lastScore)){
and t.last_score =#lastScore#
@}
@if(!isEmpty(lastStatus)){
and t.last_status =#lastStatus#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(orgIdPlural)){
and find_in_set(t.org_id,#orgIdPlural#)
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
@if(!isEmpty(userIdPlural)){
and find_in_set(t.user_id,#userIdPlural#)
@}
@if(!isEmpty(createTime)){
and t.create_time =#createTime#
@}
queryByConditionQuery
===
* 根据不为空的参数进行分页查询(无权限)
select
@pageTag(){
t.*
@}
from teacher_open_course_score_dashboard t
where 1=1
@if(!isEmpty(teacherOpenCourseScoreDashboardId)){
and t.teacher_open_course_score_dashboard_id =#teacherOpenCourseScoreDashboardId#
@}
@if(!isEmpty(teacherOpenCourseScoreDashboardIdPlural)){
and find_in_set(t.teacher_open_course_score_dashboard_id,#teacherOpenCourseScoreDashboardIdPlural#)
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(studentIdPlural)){
and find_in_set(t.student_id,#studentIdPlural#)
@}
@if(!isEmpty(signinScore)){
and t.signin_score =#signinScore#
@}
@if(!isEmpty(courseScore)){
and t.course_score =#courseScore#
@}
@if(!isEmpty(realOperationScore)){
and t.real_operation_score =#realOperationScore#
@}
@if(!isEmpty(questionHomeworkScore)){
and t.question_homework_score =#questionHomeworkScore#
@}
@if(!isEmpty(examScore)){
and t.exam_score =#examScore#
@}
@if(!isEmpty(chatScore)){
and t.chat_score =#chatScore#
@}
@if(!isEmpty(totalScore)){
and t.total_score =#totalScore#
@}
@if(!isEmpty(manualScore)){
and t.manual_score =#manualScore#
@}
@if(!isEmpty(lastScore)){
and t.last_score =#lastScore#
@}
@if(!isEmpty(lastStatus)){
and t.last_status =#lastStatus#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(orgIdPlural)){
and find_in_set(t.org_id,#orgIdPlural#)
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
@if(!isEmpty(userIdPlural)){
and find_in_set(t.user_id,#userIdPlural#)
@}
@if(!isEmpty(createTime)){
and t.create_time =#createTime#
@}
deleteTeacherOpenCourseScoreDashboardByIds
===
* 批量删除
delete from teacher_open_course_score_dashboard where find_in_set(teacher_open_course_score_dashboard_id,#ids#)
getByIds
===
select * from teacher_open_course_score_dashboard where find_in_set(teacher_open_course_score_dashboard_id,#ids#)
updateGivenByIds
===
* 批量更新指定字段,无论此字段是否有值
update teacher_open_course_score_dashboard
set
@if(contain("studentId",_given)){
@if(isEmpty(studentId)){
student_id = null ,
@}else{
student_id = #studentId# ,
@}
@}
@if(contain("signinScore",_given)){
@if(isEmpty(signinScore)){
signin_score = null ,
@}else{
signin_score = #signinScore# ,
@}
@}
@if(contain("courseScore",_given)){
@if(isEmpty(courseScore)){
course_score = null ,
@}else{
course_score = #courseScore# ,
@}
@}
@if(contain("realOperationScore",_given)){
@if(isEmpty(realOperationScore)){
real_operation_score = null ,
@}else{
real_operation_score = #realOperationScore# ,
@}
@}
@if(contain("questionHomeworkScore",_given)){
@if(isEmpty(questionHomeworkScore)){
question_homework_score = null ,
@}else{
question_homework_score = #questionHomeworkScore# ,
@}
@}
@if(contain("examScore",_given)){
@if(isEmpty(examScore)){
exam_score = null ,
@}else{
exam_score = #examScore# ,
@}
@}
@if(contain("chatScore",_given)){
@if(isEmpty(chatScore)){
chat_score = null ,
@}else{
chat_score = #chatScore# ,
@}
@}
@if(contain("totalScore",_given)){
@if(isEmpty(totalScore)){
total_score = null ,
@}else{
total_score = #totalScore# ,
@}
@}
@if(contain("manualScore",_given)){
@if(isEmpty(manualScore)){
manual_score = null ,
@}else{
manual_score = #manualScore# ,
@}
@}
@if(contain("lastScore",_given)){
@if(isEmpty(lastScore)){
last_score = null ,
@}else{
last_score = #lastScore# ,
@}
@}
@if(contain("lastStatus",_given)){
@if(isEmpty(lastStatus)){
last_status = null ,
@}else{
last_status = #lastStatus# ,
@}
@}
@if(contain("orgId",_given)){
@if(isEmpty(orgId)){
org_id = null ,
@}else{
org_id = #orgId# ,
@}
@}
@if(contain("userId",_given)){
@if(isEmpty(userId)){
user_id = null ,
@}else{
user_id = #userId# ,
@}
@}
@if(contain("createTime",_given)){
@if(isEmpty(createTime)){
create_time = null ,
@}else{
create_time = #createTime# ,
@}
@}
teacher_open_course_score_dashboard_id = teacher_open_course_score_dashboard_id
where find_in_set(teacher_open_course_score_dashboard_id,#teacherOpenCourseScoreDashboardIdPlural#)
getTeacherOpenCourseScoreDashboardValues
===
* 根据不为空的参数进行查询
select t.*
from teacher_open_course_score_dashboard t
where 1=1
@if(!isEmpty(teacherOpenCourseScoreDashboardId)){
and t.teacher_open_course_score_dashboard_id =#teacherOpenCourseScoreDashboardId#
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(signinScore)){
and t.signin_score =#signinScore#
@}
@if(!isEmpty(courseScore)){
and t.course_score =#courseScore#
@}
@if(!isEmpty(realOperationScore)){
and t.real_operation_score =#realOperationScore#
@}
@if(!isEmpty(questionHomeworkScore)){
and t.question_homework_score =#questionHomeworkScore#
@}
@if(!isEmpty(examScore)){
and t.exam_score =#examScore#
@}
@if(!isEmpty(chatScore)){
and t.chat_score =#chatScore#
@}
@if(!isEmpty(totalScore)){
and t.total_score =#totalScore#
@}
@if(!isEmpty(manualScore)){
and t.manual_score =#manualScore#
@}
@if(!isEmpty(lastScore)){
and t.last_score =#lastScore#
@}
@if(!isEmpty(lastStatus)){
and t.last_status =#lastStatus#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
@if(!isEmpty(createTime)){
and t.create_time =#createTime#
@}
getValuesByQuery
===
* 根据不为空的参数进行查询
select t.*
from teacher_open_course_score_dashboard t
where 1=1 and #function("teacherOpenCourseScoreDashboard.query")#
@if(!isEmpty(teacherOpenCourseScoreDashboardId)){
and t.teacher_open_course_score_dashboard_id =#teacherOpenCourseScoreDashboardId#
@}
@if(!isEmpty(teacherOpenCourseScoreDashboardIdPlural)){
and find_in_set(t.teacher_open_course_score_dashboard_id,#teacherOpenCourseScoreDashboardIdPlural#)
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(studentIdPlural)){
and find_in_set(t.student_id,#studentIdPlural#)
@}
@if(!isEmpty(signinScore)){
and t.signin_score =#signinScore#
@}
@if(!isEmpty(courseScore)){
and t.course_score =#courseScore#
@}
@if(!isEmpty(realOperationScore)){
and t.real_operation_score =#realOperationScore#
@}
@if(!isEmpty(questionHomeworkScore)){
and t.question_homework_score =#questionHomeworkScore#
@}
@if(!isEmpty(examScore)){
and t.exam_score =#examScore#
@}
@if(!isEmpty(chatScore)){
and t.chat_score =#chatScore#
@}
@if(!isEmpty(totalScore)){
and t.total_score =#totalScore#
@}
@if(!isEmpty(manualScore)){
and t.manual_score =#manualScore#
@}
@if(!isEmpty(lastScore)){
and t.last_score =#lastScore#
@}
@if(!isEmpty(lastStatus)){
and t.last_status =#lastStatus#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(orgIdPlural)){
and find_in_set(t.org_id,#orgIdPlural#)
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
@if(!isEmpty(userIdPlural)){
and find_in_set(t.user_id,#userIdPlural#)
@}
@if(!isEmpty(createTime)){
and t.create_time =#createTime#
@}
Loading…
Cancel
Save