mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
23 lines
699 B
Groovy
23 lines
699 B
Groovy
package scripts.dict
|
|
|
|
|
|
import cn.lihongjie.coal.common.Ctx
|
|
import com.fasterxml.jackson.databind.JsonNode
|
|
import jakarta.persistence.EntityManager
|
|
import org.springframework.context.ApplicationContext
|
|
|
|
ApplicationContext ioc = ioc
|
|
|
|
|
|
EntityManager em = ioc.getBean(EntityManager.class)
|
|
|
|
|
|
return em.createQuery("select distinct specification from WeightDeviceDataEntity where specification like :q and organizationId = :organizationId order by specification limit 10")
|
|
.setParameter("q", "%${(params as JsonNode).get("q").asText('')}%" as String)
|
|
.setParameter("organizationId", Ctx.currentUser().organizationId)
|
|
.resultList
|
|
.collect { it as String }
|
|
.sort()
|
|
|
|
|