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.

90 lines
3.2 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.QuestionMapper">
<!-- 通用查询映射结果 -->
<resultMap id="IndustryResultMap" type="com.ccic.safeliab.entity.Industry">
<id column="industry_id" property="industryId"/>
<result column="industry_name" property="industryName"/>
</resultMap>
<resultMap id="QuestionCategoriesResultMap" type="com.ccic.safeliab.entity.QuestionCategories">
<id column="id" property="id"/>
<result column="question_types" property="questionTypes"/>
<result column="industry_id" property="industryId"/>
<result column="service_type_id" property="serviceTypeId"/>
<result column="question_content" property="questionContent"/>
<result column="answer" property="answer"/>
<result column="options" property="options"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>
<select id="getList" resultMap="QuestionCategoriesResultMap">
SELECT
id,
question_types,
industry_id,
service_type_id,
question_content,
answer,
options,
status,
is_deleted
FROM ex_question_categories
<where>
is_deleted = '0'
<if test="industryId!= null and industryId!= ''">
AND industry_id = #{industryId}
</if>
<if test="serviceTypeId!= null and serviceTypeId!= ''">
AND service_type_id = #{serviceTypeId}
</if>
<if test="questionContent!= null and questionContent!= ''">
AND question_content LIKE '%' || #{questionContent} || '%'
</if>
</where>
ORDER BY id DESC
LIMIT #{offset}, #{num};
</select>
<select id="getListSize" resultType="int">
SELECT
COUNT(id)
FROM ex_question_categories
<where>
is_deleted = '0'
<if test="industryId!= null and industryId!= ''">
AND industry_id = #{industryId}
</if>
<if test="serviceTypeId!= null and serviceTypeId!= ''">
AND service_type_id = #{serviceTypeId}
</if>
<if test="questionContent!= null and questionContent!= ''">
AND question_content LIKE '%' || #{questionContent} || '%'
</if>
</where>
</select>
<select id="getIndustry" resultMap="IndustryResultMap">
select
industry_id,
industry_name
from tbl_industry
where status = 1
</select>
<select id="getDetail" resultMap="QuestionCategoriesResultMap">
SELECT
id,
question_types,
industry_id,
service_type_id,
question_content,
answer,
options,
status,
is_deleted
FROM ex_question_categories
<where>
is_deleted = '0'
<if test="id!= null and id!= ''">
AND id = #{id}
</if>
</where>
</select>
</mapper>