| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?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.siwei.apply.mapper.WorkflowMapper">
- <resultMap id="WorkflowResultMap" type="com.siwei.apply.domain.Workflow">
- <id property="id" column="id"/>
- <result property="projectType" column="project_type"/>
- <result property="name" column="name"/>
- <result property="index" column="index"/>
- <result property="tableName" column="table_name"/>
- </resultMap>
- <select id="selectByProjectTypeAndTableName" resultMap="WorkflowResultMap">
- SELECT id, project_type, name, "index" AS index, table_name
- FROM t_workflow
- WHERE project_type = #{projectType}
- AND table_name = #{tableName}
- LIMIT 1
- </select>
- <select id="selectPrevByProjectTypeAndTableName" resultMap="WorkflowResultMap">
- SELECT id, project_type, name, "index" AS index, table_name
- FROM t_workflow
- WHERE project_type = #{projectType}
- AND "index" < (
- SELECT "index"
- FROM t_workflow
- WHERE project_type = #{projectType}
- AND table_name = #{tableName}
- )
- ORDER BY "index" DESC
- LIMIT 1
- </select>
- <!-- 新增:根据 project_type 获取列表,按 index 升序返回 -->
- <select id="selectByProjectTypeOrderByIndex" parameterType="int" resultType="com.siwei.apply.domain.res.ProjectCycleRes">
- SELECT
- id,
- project_type AS projectType,
- name,
- table_name AS tableName,
- "index" AS index
- FROM t_workflow
- WHERE project_type = #{projectType}
- ORDER BY "index" ASC
- </select>
- </mapper>
|