You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
4.4 KiB
Markdown

3 years ago
queryByCondition
===
* 根据不为空的参数进行分页查询
select
@pageTag(){
3 years ago
t.*,
a.course_info_name
@}
3 years ago
from resources_info t
left join course_info a on a.course_info_id = t.course_info_id
where 1=1
@//数据权限该sql语句功能点,如果不考虑数据权限,可以删除此行
3 years ago
and #function("resourcesInfo.query")#
@if(!isEmpty(resourcesInfoIds)){
3 years ago
and find_in_set(t.resources_info_id,#resourcesInfoIds#)
@}
@if(!isEmpty(resourcesInfoId)){
3 years ago
and t.resources_info_id =#resourcesInfoId#
@}
@if(!isEmpty(courseInfoIds)){
3 years ago
and find_in_set(t.course_info_id,#courseInfoIds#)
@}
@if(!isEmpty(courseInfoId)){
3 years ago
and t.course_info_id =#courseInfoId#
@}
@if(!isEmpty(resourcesInfoName)){
3 years ago
and t.resources_info_name like #'%'+resourcesInfoName+'%'#
@}
@if(!isEmpty(resourcesInfoType)){
3 years ago
and t.resources_info_type =#resourcesInfoType#
@}
@if(!isEmpty(resourcesInfoContent)){
3 years ago
and t.resources_info_content =#resourcesInfoContent#
@}
@if(!isEmpty(orgId)){
3 years ago
and t.org_id =#orgId#
@}
@if(!isEmpty(orgIdPlural)){
and (find_in_set(ifnull(t.org_id, 1), #orgIdPlural#))
@}
@if(!isEmpty(courseInfoFullId)){
and a.course_info_full_id like #courseInfoFullId+"%"#
@}
2 years ago
@if(!isEmpty(addType)){
and t.add_type =#addType#
@}
@if(isEmpty(seeSelf) && !isEmpty(userId)){
3 years ago
and t.user_id =#userId#
@}
2 years ago
@if(!isEmpty(seeSelf) && seeSelf && !isEmpty(userId)){
and (t.add_type = 'ADMIN_ADD' or t.user_id = #userId#)
@}
2 years ago
@if(!isEmpty(courseInfoId_1)){
and a.course_info_full_id like #courseInfoId_1 + '%'#
@} else if(!isEmpty(courseInfoId_2)){
and a.course_info_full_id like #courseInfoId_1 + '_' + courseInfoId_2 + '%'#
@} else if(!isEmpty(courseInfoId_3)){
and a.course_info_full_id like #courseInfoId_1 + '_' + courseInfoId_2 + '_' + courseInfoId_3 + '%'#
@}
2 years ago
ORDER BY t.resources_info_id DESC
3 years ago
deleteResourcesInfoByIds
===
* 批量删除
delete from resources_info where find_in_set(resources_info_id,#ids#)
getValuesByQuery
===
* 根据不为空的参数进行查询
select t.*
from resources_info t
left join course_info a on a.course_info_id = t.course_info_id
3 years ago
where 1=1
@if(!isEmpty(resourcesInfoIds)){
3 years ago
and find_in_set(t.resources_info_id,#resourcesInfoIds#)
@}
@if(!isEmpty(resourcesInfoId)){
3 years ago
and t.resources_info_id =#resourcesInfoId#
@}
@if(!isEmpty(courseInfoIds)){
3 years ago
and find_in_set(t.course_info_id,#courseInfoIds#)
@}
@if(!isEmpty(courseInfoId)){
3 years ago
and t.course_info_id =#courseInfoId#
@}
@if(!isEmpty(resourcesInfoName)){
3 years ago
and t.resources_info_name =#resourcesInfoName#
@}
@if(!isEmpty(resourcesInfoType)){
3 years ago
and t.resources_info_type =#resourcesInfoType#
@}
@if(!isEmpty(resourcesInfoContent)){
3 years ago
and t.resources_info_content =#resourcesInfoContent#
@}
@if(!isEmpty(orgId)){
3 years ago
and t.org_id =#orgId#
@}
2 years ago
@if(!isEmpty(addType)){
and t.add_type =#addType#
@}
@if(!isEmpty(courseInfoFullId)){
and a.course_info_full_id like #courseInfoFullId+"%"#
@}
2 years ago
@if(isEmpty(seeSelf) && !isEmpty(userId)){
3 years ago
and t.user_id =#userId#
@}
2 years ago
@if(!isEmpty(seeSelf) && seeSelf && !isEmpty(userId)){
and (t.add_type = 'ADMIN_ADD' or t.user_id = #userId#)
@}
3 years ago
getResourcesInfoValues
===
* 根据不为空的参数进行查询
select t.*
from resources_info t
where 1=1
@if(!isEmpty(resourcesInfoId)){
3 years ago
and t.resources_info_id =#resourcesInfoId#
@}
@if(!isEmpty(courseInfoId)){
3 years ago
and t.course_info_id =#courseInfoId#
@}
@if(!isEmpty(resourcesInfoName)){
3 years ago
and t.resources_info_name =#resourcesInfoName#
@}
@if(!isEmpty(resourcesInfoType)){
3 years ago
and t.resources_info_type =#resourcesInfoType#
@}
@if(!isEmpty(resourcesInfoContent)){
3 years ago
and t.resources_info_content =#resourcesInfoContent#
@}
@if(!isEmpty(orgId)){
3 years ago
and t.org_id =#orgId#
@}
2 years ago
@if(!isEmpty(addType)){
and t.add_type =#addType#
@}
@if(!isEmpty(userId)){
3 years ago
and t.user_id =#userId#
2 years ago
@}