123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?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.ydl.exam.modules.repo.mapper.RepoMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.ydl.exam.modules.repo.entity.Repo">
- <id column="id" property="id" />
- <result column="code" property="code" />
- <result column="title" property="title" />
- <result column="radio_count" property="radioCount" />
- <result column="multi_count" property="multiCount" />
- <result column="judge_count" property="judgeCount" />
- <result column="remark" property="remark" />
- <result column="create_time" property="createTime" />
- <result column="update_time" property="updateTime" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- `id`,`code`,`title`,`radio_count`,`multi_count`,`judge_count`,`remark`,`create_time`,`update_time`
- </sql>
- <resultMap id="ListResultMap"
- type="com.ydl.exam.modules.repo.dto.response.RepoRespDTO"
- extends="BaseResultMap">
- </resultMap>
- <select id="paging" resultMap="ListResultMap">
- SELECT * FROM el_repo repo
- <where>
- <if test="query!=null">
- <if test="query.title!=null and query.title!=''">
- AND title LIKE '%${query.title}%'
- </if>
- </if>
- </where>
- </select>
- <update id="refreshStat">
- UPDATE el_repo a
- SET
- radio_count=(SELECT COUNT(0) FROM el_qu_repo WHERE repo_id=a.id AND qu_type=1),
- multi_count=(SELECT COUNT(0) FROM el_qu_repo WHERE repo_id=a.id AND qu_type=2),
- judge_count=(SELECT COUNT(0) FROM el_qu_repo WHERE repo_id=a.id AND qu_type=3)
- WHERE a.id=#{repoId}
- </update>
- </mapper>
|