<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.orderplatform.mapper.PlatformScriptMapper">

    <select id="pageQuery" resultType="com.alibaba.fastjson.JSONObject">
        SELECT
        t1.id,
        t1.`name`,
        t1.size,
        t1.create_time,
        FROM_UNIXTIME(ROUND((t1.create_time/1000),0)) as createTime,
        (SELECT realname from sys_user where id=t1.creator limit 1) as creatorName,
        (SELECT project_name from ctop_project where id=t1.project_id limit 1) as projectName,
        t2.material_name as materialName
        FROM
        ctop_platform_script t1
        LEFT JOIN ctop_platform_material t2 ON t1.id = t2.script_id
        where t2.material_code is not null
        <if test="projectId != null">
            AND t1.project_id= #{projectId}
        </if>
        <if test="name != null">
            AND t1.name like '%${name}%'
        </if>
        <if test="creator != null">
            AND t1.creator = #{creator}
        </if>
    </select>
</mapper>