You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.5 KiB

<?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.ccic.safeliab.dao.ExamPaperMapper">
<!-- 通用查询映射结果 -->
<resultMap id="ExamPapersResultMap" type="com.ccic.safeliab.entity.ExamPapers">
<id column="id" property="id"/>
<result column="paper_name" property="paperName"/>
<result column="industry_id" property="industryId"/>
<result column="question_count" property="questionCount"/>
<result column="total_score" property="totalScore"/>
<result column="exam_duration" property="examDuration"/>
<result column="duration_type" property="durationType"/>
<result column="paper_content" property="paperContent"/>
<result column="paper_status" property="paperStatus"/>
</resultMap>
<select id="getList" resultMap="ExamPapersResultMap">
SELECT
id
, paper_name
, industry_id
, question_count
, total_score
, exam_duration
, duration_type
, paper_content
, paper_status
FROM ex_exam_papers
<where>
is_deleted = '0'
<if test="industryId!= null and industryId!= ''">
AND industry_id = #{industryId}
</if>
<if test="paperName!= null and paperName!= ''">
AND paper_name LIKE '%' || #{paperName} || '%'
</if>
</where>
ORDER BY id DESC
LIMIT #{offset}, #{num};
</select>
<select id="getListSize" resultType="int">
SELECT
COUNT(id)
FROM ex_exam_papers
<where>
is_deleted = '0'
<if test="industryId!= null and industryId!= ''">
AND industry_id = #{industryId}
</if>
<if test="paperName!= null and paperName!= ''">
AND paper_name LIKE '%' || #{paperName} || '%'
</if>
</where>
</select>
<select id="getDetail" resultMap="ExamPapersResultMap">
SELECT
id
, paper_name
, industry_id
, question_count
, total_score
, exam_duration
, duration_type
, paper_content
, paper_status
FROM ex_exam_papers
<where>
is_deleted = '0'
<if test="id!= null and id!= ''">
AND id = #{id}
</if>
</where>
</select>
</mapper>