1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?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.qxgmat.data.relation.ExercisePaperRelationMapper">
- <resultMap id="IdMap" type="com.qxgmat.data.dao.entity.ExercisePaper">
- <!--
- WARNING - @mbg.generated
- -->
- <id column="id" jdbcType="INTEGER" property="id" />
- </resultMap>
- <resultMap id="placeMap" type="com.qxgmat.data.dao.entity.ExercisePaper">
- <!--
- WARNING - @mbg.generated
- -->
- <id column="logic_extend" jdbcType="VARCHAR" property="logicExtend" />
- </resultMap>
- <sql id="Id_Column_List">
- <!--
- WARNING - @mbg.generated
- -->
- ep.`id`
- </sql>
- <!--获取考点分组所有考点信息-->
- <select id="groupPlace" resultMap="placeMap">
- select
- ep.`logic_extend`
- from `exercise_paper` ep
- where ep.`logic` = "place" and ep.`status` = 1
- <if test="structId != null">
- and (ep.`struct_three` = #{structId,jdbcType=VARCHAR} or ep.`struct_four` = #{structId,jdbcType=VARCHAR})
- </if>
- group by ep.`logic_extend`
- </select>
- <!--
- 用户练习-练习册列表: 用户端
- -->
- <select id="listWithUser" resultMap="IdMap">
- select
- <include refid="Id_Column_List" />
- from `exercise_paper` ep
- <if test="userId != null">
- left join `user_paper` up on ep.`id` = up.`origin_id`
- and up.`paper_origin` = 'exercise'
- and up.`user_id` = #{userId,jdbcType=VARCHAR}
- <if test="times != null">
- <if test="times == 0">
- and up.`times` = 0
- </if>
- <if test="times > 0">
- and up.`times` >= #{times,jdbcType=VARCHAR}
- </if>
- </if>
- </if>
- where ep.`status` = 1
- <if test="structId != null">
- and (ep.`struct_three` = #{structId,jdbcType=VARCHAR} or ep.`struct_four` = #{structId,jdbcType=VARCHAR})
- </if>
- <if test="userId != null">
- <if test="times == 0">
- and (up.`id` > 0 or up.`id` is null)
- </if>
- <if test="times > 0">
- and up.`id` > 0
- </if>
- </if>
- <if test="logic != null">
- and ep.`logic` = #{logic,jdbcType=VARCHAR}
- <if test="logicExtend != null">
- and ep.`logic_extend` = #{logicExtend,jdbcType=VARCHAR}
- </if>
- </if>
- </select>
- </mapper>
|