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.

5.7 KiB

queryByCondition

  • 根据不为空的参数进行分页查询

    select @pageTag(){ t.* @} from materials t where 1=1
    @//数据权限该sql语句功能点,如果不考虑数据权限,可以删除此行
    and #function("materials.query")# @if(!isEmpty(id)){ and t.id =#id# @} @if(!isEmpty(createdAt)){ and t.created_at =#createdAt# @} @if(!isEmpty(updatedAt)){ and t.updated_at =#updatedAt# @} @if(!isEmpty(data)){ and t.data =#data# @} @if(!isEmpty(name)){ and t.name =#name# @} @if(!isEmpty(corporation)){ and t.corporation =#corporation# @} @if(!isEmpty(industry)){ and t.industry =#industry# @} @if(!isEmpty(account)){ and t.account =#account# @} @if(!isEmpty(telephone)){ and t.telephone =#telephone# @} @if(!isEmpty(address)){ and t.address =#address# @} @if(!isEmpty(balance)){ and t.balance =#balance# @} @if(!isEmpty(currentAssetsRatio)){ and t.current_assets_ratio =#currentAssetsRatio# @} @if(!isEmpty(fixedAssetsRatio)){ and t.fixed_assets_ratio =#fixedAssetsRatio# @} @if(!isEmpty(liabilitiesRatio)){ and t.liabilities_ratio =#liabilitiesRatio# @} @if(!isEmpty(type)){ and t.type =#type# @} @if(!isEmpty(creditLevel)){ and t.credit_level =#creditLevel# @} @if(!isEmpty(userId)){ and t.user_id =#userId# @}

getByConditionLimitPage

  • 根据不为空的参数进行分页查询

    select @pageTag(){ t.* @} from materials t where 1=1
    @if(!isEmpty(id)){ and t.id =#id# @} @if(!isEmpty(createdAt)){ and t.created_at =#createdAt# @} @if(!isEmpty(updatedAt)){ and t.updated_at =#updatedAt# @} @if(!isEmpty(data)){ and t.data =#data# @} @if(!isEmpty(name)){ and t.name =#name# @} @if(!isEmpty(corporation)){ and t.corporation =#corporation# @} @if(!isEmpty(industry)){ and t.industry =#industry# @} @if(!isEmpty(account)){ and t.account =#account# @} @if(!isEmpty(telephone)){ and t.telephone =#telephone# @} @if(!isEmpty(address)){ and t.address =#address# @} @if(!isEmpty(balance)){ and t.balance =#balance# @} @if(!isEmpty(currentAssetsRatio)){ and t.current_assets_ratio =#currentAssetsRatio# @} @if(!isEmpty(fixedAssetsRatio)){ and t.fixed_assets_ratio =#fixedAssetsRatio# @} @if(!isEmpty(liabilitiesRatio)){ and t.liabilities_ratio =#liabilitiesRatio# @} @if(!isEmpty(type)){ and t.type =#type# @} @if(!isEmpty(creditLevel)){ and t.credit_level =#creditLevel# @} @if(!isEmpty(userId)){ and (t.user_id = 0 OR t.user_id =#userId#)

    -- 这里是根据项目改的如果传过来userid就获取所有userid为0的和关联当前用户的 @}

deleteMaterialsByIds

  • 批量删除

    delete from materials where find_in_set(id,#ids#)

getMaterialsValues

  • 根据不为空的参数进行查询

    select t.* from materials t where 1=1
    @if(!isEmpty(id)){ and t.id =#id# @} @if(!isEmpty(createdAt)){ and t.created_at =#createdAt# @} @if(!isEmpty(updatedAt)){ and t.updated_at =#updatedAt# @} @if(!isEmpty(data)){ and t.data =#data# @} @if(!isEmpty(name)){ and t.name =#name# @} @if(!isEmpty(corporation)){ and t.corporation =#corporation# @} @if(!isEmpty(industry)){ and t.industry =#industry# @} @if(!isEmpty(account)){ and t.account =#account# @} @if(!isEmpty(telephone)){ and t.telephone =#telephone# @} @if(!isEmpty(address)){ and t.address =#address# @} @if(!isEmpty(balance)){ and t.balance =#balance# @} @if(!isEmpty(currentAssetsRatio)){ and t.current_assets_ratio =#currentAssetsRatio# @} @if(!isEmpty(fixedAssetsRatio)){ and t.fixed_assets_ratio =#fixedAssetsRatio# @} @if(!isEmpty(liabilitiesRatio)){ and t.liabilities_ratio =#liabilitiesRatio# @} @if(!isEmpty(type)){ and t.type =#type# @} @if(!isEmpty(creditLevel)){ and t.credit_level =#creditLevel# @} @if(!isEmpty(userId)){ and t.user_id =#userId# @}

getValuesByQuery

  • 根据不为空的参数进行查询

    select t.* from materials t where 1=1
    @if(!isEmpty(id)){ and t.id =#id# @} @if(!isEmpty(createdAt)){ and t.created_at =#createdAt# @} @if(!isEmpty(updatedAt)){ and t.updated_at =#updatedAt# @} @if(!isEmpty(data)){ and t.data =#data# @} @if(!isEmpty(name)){ and t.name =#name# @} @if(!isEmpty(corporation)){ and t.corporation =#corporation# @} @if(!isEmpty(industry)){ and t.industry =#industry# @} @if(!isEmpty(account)){ and t.account =#account# @} @if(!isEmpty(telephone)){ and t.telephone =#telephone# @} @if(!isEmpty(address)){ and t.address =#address# @} @if(!isEmpty(balance)){ and t.balance =#balance# @} @if(!isEmpty(currentAssetsRatio)){ and t.current_assets_ratio =#currentAssetsRatio# @} @if(!isEmpty(fixedAssetsRatio)){ and t.fixed_assets_ratio =#fixedAssetsRatio# @} @if(!isEmpty(liabilitiesRatio)){ and t.liabilities_ratio =#liabilitiesRatio# @} @if(!isEmpty(type)){ and t.type =#type# @} @if(!isEmpty(creditLevel)){ and t.credit_level =#creditLevel# @} @if(!isEmpty(userId)){ and t.user_id =#userId# @}

delByIdAndUserId

*根据主键id以及用户id联合删除数据

delete from materials where id=#id# and user_id=#userId#