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.dayou.dao.CycleMapper">
- <select id="getPage" parameterType="com.dayou.vo.CycleVO" resultType="com.dayou.vo.CycleVO">
- SELECT
- c.id,
- d.id as documentId,
- d.item_name,
- q.label as type,
- c.cycle_num,
- c.created
- FROM
- cycle c
- LEFT JOIN document d ON d.id = c.document_id left join question q on d.type_id= q.id
- <where>
- c.deleted = 0 and d.deleted = 0
- <if test="cycle!=null and cycle.itemName!=null and cycle.itemName!='' ">
- and d.item_name like concat('%',#{cycle.itemName},'%')
- </if>
- <if test="cycle!=null and cycle.cycleNum!=null">
- and c.cycle_num = #{cycle.cycleNum}
- </if>
- <if test="cycle!=null and cycle.typeId!=null">
- and d.type_id = #{cycle.typeId}
- </if>
- </where>
- order by c.created DESC
- </select>
- <select id="nextCycle" parameterType="java.lang.Long" resultType="com.dayou.entity.Cycle">
- SELECT
- document_id,
- ( cycle_num + 1 ) cycleNum,
- professor_num,
- standard_value,
- probability
- FROM
- cycle
- WHERE
- document_id = #{documentId}
- ORDER BY
- cycle_num DESC
- LIMIT 1
- </select>
- </mapper>
|