ZhiYeJianKang/职业健康平台后端/bin/mappings/modules/assessmentCriterion/methods/questionMapper.xml

137 lines
4.5 KiB
XML
Raw Normal View History

2025-02-20 15:25:59 +08:00
<?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.hx.slj.modules.assessmentCriterion.dao.methods.QuestionMapper">
<resultMap id="QuestionPojo" type="com.hx.slj.modules.assessmentCriterion.entity.methods.Question">
<id property="id" column="id"/>
<result property="targetId" column="khtx_target_id"/>
<result property="surveyDirectoryId" column="survey_directory_id"/>
<result property="surveyName" column="survey_name"/>
<result property="oldPeople" column="old_people"/>
<result property="children" column="children"/>
<result property="hypertensivePatient" column="hypertensive_patient"/>
<result property="diabeticPatient" column="diabetic_patient"/>
<result property="pregnantWoman" column="pregnant_woman"/>
<result property="oldPeopleNumber" column="old_people_number"/>
<result property="childrenNumber" column="children_number"/>
<result property="hyperPatientNumber" column="hyper_patient_number"/>
<result property="diabeticPatientNumber" column="diabetic_patient_number"/>
<result property="pregnantNumber" column="pregnant_number"/>
</resultMap>
<sql id="QuestionColumns">
a.id,
a.khtx_target_id AS "targetId",
a.survey_directory_id AS "surveyDirectoryId",
a.survey_name AS "surveyName",
a.old_people AS "oldPeople",
a.children AS "children",
a.hypertensive_patient AS "hypertensivePatient",
a.diabetic_patient AS "diabeticPatient",
a.pregnant_woman AS "pregnantWoman",
a.old_people_number AS "oldPeopleNumber",
a.children_number AS "childrenNumber",
a.hypertensive_patient AS "hyperPatientNumber",
a.diabetic_patient_number AS "diabeticPatientNumber",
a.pregnant_number AS "pregnantNumber",
a.create_by AS "createBy.id",
a.create_date,
a.update_by AS "updateBy.id",
a.update_date,
a.remarks,
a.del_flag
</sql>
<select id="get" resultType="com.hx.slj.modules.assessmentCriterion.entity.methods.Question">
SELECT
<include refid="QuestionColumns"/>
FROM khtx_question a
WHERE a.id = #{id}
</select>
<select id="findUniqueByProperty" resultType="com.hx.slj.modules.assessmentCriterion.entity.methods.Question" statementType="STATEMENT">
select
<include refid="QuestionColumns"/>
from khtx_var where ${propertyName} = ${value}
</select>
<select id="findList" resultType="com.hx.slj.modules.assessmentCriterion.entity.methods.Question">
SELECT
<include refid="QuestionColumns"/>
FROM khtx_question a
WHERE a.del_flag = #{DEL_FLAG_NORMAL}
<if test="targetId!=null and targetId !=''">
AND a.khtx_target_id =#{targetId}
</if>
ORDER BY a.update_date desc
</select>
<insert id="insert">
INSERT INTO khtx_question(
id,
khtx_target_id,
survey_directory_id,
survey_name,
old_people,
children,
hypertensive_patient,
diabetic_patient,
pregnant_woman,
old_people_number,
children_number,
hyper_patient_number,
diabetic_patient_number,
pregnant_number,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag
) VALUES (
#{id},
#{targetId},
#{surveyDirectoryId},
#{surveyName},
#{oldPeople},
#{children},
#{hypertensivePatient},
#{diabeticPatient},
#{pregnantWoman},
#{oldPeopleNumber},
#{childrenNumber},
#{hyperPatientNumber},
#{diabeticPatientNumber},
#{pregnantNumber},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{delFlag}
)
</insert>
<update id="update">
UPDATE khtx_question SET
survey_directory_id = #{surveyDirectoryId},
survey_name = #{surveyName},
old_people = #{oldPeople},
children = #{children},
hypertensive_patient = #{hypertensivePatient},
diabetic_patient = #{diabeticPatient},
pregnant_woman = #{pregnantWoman},
old_people_number = #{oldPeopleNumber},
children_number = #{childrenNumber},
hypertensive_patient = #{hyperPatientNumber},
diabetic_patient_number = #{diabeticPatientNumber},
pregnant_number = #{pregnantNumber},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks}
WHERE id = #{id}
</update>
<delete id="delete">
DELETE FROM khtx_question WHERE id = #{id}
</delete>
</mapper>