DockerProjectMapper.xml 2.88 KB
<?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="com.monitor.mysql.mapper.DockerProjectMapper" >
    <resultMap id="BaseResultMap" type="com.model.DockerProjectModel" >
        <id column="id" property="id" jdbcType="INTEGER" />
        <result column="projectname" property="projectName" jdbcType="VARCHAR" />
        <result column="projectjobtype" property="projectJobType" jdbcType="VARCHAR" />
        <result column="dockerprojectname" property="dockerProjectName" jdbcType="VARCHAR" />
        <result column="dockergrayclusterid" property="dockerGrayClusterId" jdbcType="VARCHAR" />
        <result column="dockergraynamespace" property="dockerGrayNameSpace" jdbcType="VARCHAR" />
        <result column="dockeronlineclusterid" property="dockerOnlineClusterId" jdbcType="VARCHAR" />
        <result column="dockeronlinenamespace" property="dockerOnlineNameSpace" jdbcType="VARCHAR" />

    </resultMap>

    <sql id="Base_Column_List" >
        id, projectname,projectjobtype,dockerprojectName,dockergrayclusterid,dockergraynamespace,dockeronlineclusterid,dockeronlinenamespace
    </sql>

    <select id="selectCount"  resultType="java.lang.Integer">
        select
        count(1)
        from docker_project
    </select>

    <select id="selectByPage"   resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from docker_project
        where 1=1
        <if test="params.projectJobType != null" >
           and projectjobtype = #{params.projectJobType}
        </if>
        order by id desc
        limit #{startIndex},#{pageSize}
    </select>

    <select id="selectById"   resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from docker_project
        where
        id = #{id}
    </select>

    <select id="selectByProjectJobType"   resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from docker_project
        where 1=1
        <choose>
            <when test="projectJobType != null &amp;&amp; projectJobType !='' " >
                and  projectjobtype = #{projectJobType}
            </when>
            <otherwise>
                and 1=2
            </otherwise>
        </choose>
    </select>

    <select id="selectByIdList"   resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from docker_project
        where 1=1
        <choose>
            <when test="idList != null &amp;&amp; idList.size > 0" >
                and
                <foreach open="(" close=")" item="item" index="index" collection="idList"  separator="or">
                    id = #{item}
                </foreach>
            </when>
            <otherwise>
                and 1=2
            </otherwise>
        </choose>
    </select>

</mapper>