package scripts.dict

import cn.lihongjie.coal.base.dto.CommonQuery
import cn.lihongjie.coal.coalInfo.controller.CoalInfoController
import cn.lihongjie.coal.coalInfo.entity.CoalInfoEntity
import com.fasterxml.jackson.databind.ObjectMapper
import org.springframework.context.ApplicationContext

ApplicationContext ioc = ioc

def controller = ioc.getBean(CoalInfoController.class)
def objectMapper = ioc.getBean(ObjectMapper.class) as ObjectMapper



return controller.list(params!=null ? objectMapper.convertValue(params, CommonQuery.class ) : new CommonQuery()).content.collect {
    def entity = new CoalInfoEntity()
    entity.id = it.id
    entity.code = it.code
    entity.name = "$it.supplierName-$it.name($it.coalTypeName)"
    return entity
}

