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.

103 lines
4.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.ccsens.tcm.persist.dao.QuestionDao">
<resultMap id="BaseResultMap" type="com.ccsens.tcm.bean.po.Question">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="question" jdbcType="VARCHAR" property="question" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="units" jdbcType="VARCHAR" property="units" />
<result column="type" jdbcType="TINYINT" property="type" />
<result column="relevance_option_id" jdbcType="BIGINT" property="relevanceOptionId" />
<result column="search_criteria" jdbcType="TINYINT" property="searchCriteria" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="operator" jdbcType="BIGINT" property="operator" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
</resultMap>
<insert id="insertBatch">
replace into t_question (id, question, code,
sort, units, type,
relevance_option_id, search_criteria, remark)
values
<foreach collection="list" item="question" separator=",">
(#{question.id,jdbcType=BIGINT}, #{question.question,jdbcType=VARCHAR}, #{question.code,jdbcType=VARCHAR},
#{question.sort,jdbcType=INTEGER}, #{question.units,jdbcType=VARCHAR}, #{question.type,jdbcType=TINYINT},
#{question.relevanceOptionId,jdbcType=BIGINT}, #{question.searchCriteria,jdbcType=TINYINT}, #{question.remark,jdbcType=VARCHAR})
</foreach>
</insert>
<resultMap id="queryQuestionByCode" type="com.ccsens.tcm.bean.vo.QuestionVo$CodeQuestionVo">
<id column="qid" jdbcType="BIGINT" property="id" />
<result column="qquestion" jdbcType="VARCHAR" property="question" />
<result column="qcode" jdbcType="VARCHAR" property="code" />
<result column="qsort" jdbcType="INTEGER" property="sort" />
<result column="qunits" jdbcType="VARCHAR" property="units" />
<result column="qtype" jdbcType="TINYINT" property="type" />
<result column="qrelevance_option_id" jdbcType="BIGINT" property="relevanceOptionId" />
<result column="qsearch_criteria" jdbcType="TINYINT" property="searchCriteria" />
<result column="qremark" jdbcType="VARCHAR" property="remark" />
<collection property="optionVos" ofType="com.ccsens.tcm.bean.vo.QuestionVo$QuestionOptionVo">
<id column="oid" jdbcType="BIGINT" property="id" />
<result column="oquestion_id" jdbcType="BIGINT" property="questionId" />
<result column="osort" jdbcType="INTEGER" property="sort" />
<result column="oshow_value" jdbcType="VARCHAR" property="showValue" />
<result column="osubmit_value" jdbcType="VARCHAR" property="submitValue" />
<result column="oafter_operation" jdbcType="TINYINT" property="afterOperation" />
</collection>
</resultMap>
<select id="queryQuestionByCode" resultMap="queryQuestionByCode">
SELECT
q.id as qid,
q.question as qquestion,
q.`code` as qcode,
q.sort as qsort,
q.units as qunits,
q.type as qtype,
q.relevance_option_id as qrelevance_option_id,
q.search_criteria as qsearch_criteria,
q.remark as qremark,
o.id as oid,
o.question_id as oquestion_id,
o.sort as osort,
o.show_value as oshow_value,
o.submit_value as osubmit_value,
o.after_operation as oafter_operation
FROM
t_question q
LEFT JOIN t_question_option o on q.id = o.question_id and o.rec_status = 0
WHERE
q.relevance_option_id = 0
and q.rec_status = 0
and q.`code` = #{code}
</select>
5 years ago
<select id="queryQuestionByOption" resultMap="queryQuestionByCode">
SELECT
q.id as qid,
q.question as qquestion,
q.`code` as qcode,
q.sort as qsort,
q.units as qunits,
q.type as qtype,
q.relevance_option_id as qrelevance_option_id,
q.search_criteria as qsearch_criteria,
q.remark as qremark,
o.id as oid,
o.question_id as oquestion_id,
o.sort as osort,
o.show_value as oshow_value,
o.submit_value as osubmit_value,
o.after_operation as oafter_operation
FROM
t_question q
LEFT JOIN t_question_option o on q.id = o.question_id and o.rec_status = 0
WHERE
q.rec_status = 0
and q.relevance_option_id = #{optionId}
</select>
</mapper>