bt-yjj-system-examination-s.../src/main/resources/mybatis/mapper/classplan/class-plan-mapper.xml
2021-05-12 14:09:17 +08:00

430 lines
15 KiB
XML

<?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="cn.com.tenlion.dao.classplan.IClassPlanDao">
<resultMap id="classPlanDTO" type="cn.com.tenlion.pojo.dtos.classplan.ClassPlanDTO">
<id column="class_plan_id" property="classPlanId"/>
<result column="org_id" property="orgId"/>
<result column="plan_number" property="planNumber"/>
<result column="plan_name" property="planName"/>
<result column="plan_type" property="planType"/>
<result column="project_catalog_id" property="projectCatalogId"/>
<result column="worker_catalog" property="workerCatalog"/>
<result column="plan_person_num" property="planPersonNum"/>
<result column="plan_start_time" property="planStartTime"/>
<result column="plan_end_time" property="planEndTime"/>
<result column="sign_up_start_time" property="signUpStartTime"/>
<result column="sign_up_end_time" property="signUpEndTime"/>
<result column="plan_address" property="planAddress"/>
<result column="charge_person" property="chargePerson"/>
<result column="charge_person_tel" property="chargePersonTel"/>
<result column="report_type" property="reportType"/>
<result column="report_reason" property="reportReason"/>
</resultMap>
<resultMap id="classPlanBO" type="cn.com.tenlion.pojo.bos.classplan.ClassPlanBO">
<result column="class_plan_id" property="classPlanId"/>
<result column="plan_number" property="planNumber"/>
<result column="plan_name" property="planName"/>
<result column="plan_type" property="planType"/>
<result column="project_catalog_id" property="projectCatalogId"/>
<result column="worker_catalog" property="workerCatalog"/>
<result column="plan_person_num" property="planPersonNum"/>
<result column="plan_start_time" property="planStartTime"/>
<result column="plan_end_time" property="planEndTime"/>
<result column="sign_up_start_time" property="signUpStartTime"/>
<result column="sign_up_end_time" property="signUpEndTime"/>
<result column="plan_address" property="planAddress"/>
<result column="charge_person" property="chargePerson"/>
<result column="charge_person_tel" property="chargePersonTel"/>
</resultMap>
<resultMap id="classPlanPO" type="cn.com.tenlion.pojo.pos.classplan.ClassPlanPO">
<result column="class_plan_id" property="classPlanId"/>
<result column="plan_number" property="planNumber"/>
<result column="plan_name" property="planName"/>
<result column="plan_type" property="planType"/>
<result column="project_catalog_id" property="projectCatalogId"/>
<result column="worker_catalog" property="workerCatalog"/>
<result column="plan_person_num" property="planPersonNum"/>
<result column="plan_start_time" property="planStartTime"/>
<result column="plan_end_time" property="planEndTime"/>
<result column="sign_up_start_time" property="signUpStartTime"/>
<result column="sign_up_end_time" property="signUpEndTime"/>
<result column="plan_address" property="planAddress"/>
<result column="charge_person" property="chargePerson"/>
<result column="charge_person_tel" property="chargePersonTel"/>
</resultMap>
<!-- 新增 -->
<insert id="save" parameterType="map">
INSERT INTO e_class_plan(
class_plan_id,
org_id,
plan_number,
plan_name,
plan_type,
project_catalog_id,
worker_catalog,
plan_person_num,
plan_start_time,
plan_end_time,
sign_up_start_time,
sign_up_end_time,
plan_address,
charge_person,
charge_person_tel,
report_type,
report_reason
) VALUES(
#{classPlanId},
#{orgId},
#{planNumber},
#{planName},
#{planType},
#{projectCatalogId},
#{workerCatalog},
#{planPersonNum},
#{planStartTime},
#{planEndTime},
#{signUpStartTime},
#{signUpEndTime},
#{planAddress},
#{chargePerson},
#{chargePersonTel},
#{reportType},
#{reportReason}
)
</insert>
<!-- 删除(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
e_class_plan
WHERE
class_plan_id IN
<foreach collection="classPlanIds" index="index" open="(" separator="," close=")">
#{classPlanIds[${index}]}
</foreach>
</update>
<!-- 删除(逻辑) -->
<update id="remove" parameterType="map">
UPDATE e_class_plan SET
is_delete = '1'
WHERE
class_plan_id IN
<foreach collection="classPlanIds" index="index" open="(" separator="," close=")">
#{classPlanIds[${index}]}
</foreach>
</update>
<!-- 修改 -->
<update id="update" parameterType="map">
UPDATE
e_class_plan
SET
<if test="planNumber != null and planNumber != ''">
plan_number = #{planNumber},
</if>
<if test="orgId != null and orgId != ''">
org_id = #{orgId},
</if>
<if test="planName != null and planName != ''">
plan_name = #{planName},
</if>
<if test="planType != null and planType != ''">
plan_type = #{planType},
</if>
<if test="projectCatalogId != null and projectCatalogId != ''">
project_catalog_id = #{projectCatalogId},
</if>
<if test="workerCatalog != null and workerCatalog != ''">
worker_catalog = #{workerCatalog},
</if>
<if test="planPersonNum != null and planPersonNum != 0">
plan_person_num = #{planPersonNum},
</if>
<if test="planStartTime != null and planStartTime != ''">
plan_start_time = #{planStartTime},
</if>
<if test="planEndTime != null and planEndTime != ''">
plan_end_time = #{planEndTime},
</if>
<if test="signUpStartTime != null and signUpStartTime != ''">
sign_up_start_time = #{signUpStartTime},
</if>
<if test="signUpEndTime != null and signUpEndTime != ''">
sign_up_end_time = #{signUpEndTime},
</if>
<if test="planAddress != null and planAddress != ''">
plan_address = #{planAddress},
</if>
<if test="chargePerson != null and chargePerson != ''">
charge_person = #{chargePerson},
</if>
<if test="chargePersonTel != null and chargePersonTel != ''">
charge_person_tel = #{chargePersonTel},
</if>
<if test="reportType != null and reportType != ''">
report_type = #{reportType},
</if>
<if test="reportReason != null and reportReason != ''">
report_reason = #{reportReason},
</if>
class_plan_id = class_plan_id
WHERE
class_plan_id = #{classPlanId}
</update>
<!-- 详情 -->
<select id="get" parameterType="map" resultMap="classPlanDTO">
SELECT
t1.plan_number,
t1.org_id,
t1.plan_name,
t1.plan_type,
t1.project_catalog_id,
t1.worker_catalog,
t1.plan_person_num,
t1.plan_start_time,
t1.plan_end_time,
t1.sign_up_start_time,
t1.sign_up_end_time,
t1.plan_address,
t1.charge_person,
t1.charge_person_tel,
t1.class_plan_id,
t1.report_type,
t1.report_reason
FROM
e_class_plan t1
WHERE
1 = 1
<if test="classPlanId != null and classPlanId != ''">
AND
t1.class_plan_id = #{classPlanId}
</if>
</select>
<!-- 详情 -->
<select id="getBO" parameterType="map" resultMap="classPlanBO">
SELECT
t1.class_plan_id,
t1.plan_number,
t1.plan_name,
t1.plan_type,
t1.project_catalog_id,
t1.worker_catalog,
t1.plan_person_num,
t1.plan_start_time,
t1.plan_end_time,
t1.sign_up_start_time,
t1.sign_up_end_time,
t1.plan_address,
t1.charge_person,
t1.charge_person_tel
FROM
e_class_plan t1
WHERE
1 = 1
<if test="classPlanId != null and classPlanId != ''">
AND
t1.class_plan_id = #{classPlanId}
</if>
</select>
<!-- 详情 -->
<select id="getPO" parameterType="map" resultMap="classPlanPO">
SELECT
t1.class_plan_id,
t1.plan_number,
t1.plan_name,
t1.plan_type,
t1.project_catalog_id,
t1.worker_catalog,
t1.plan_person_num,
t1.plan_start_time,
t1.plan_end_time,
t1.sign_up_start_time,
t1.sign_up_end_time,
t1.plan_address,
t1.charge_person,
t1.charge_person_tel
FROM
e_class_plan t1
WHERE
1 = 1
<if test="classPlanId != null and classPlanId != ''">
AND
t1.class_plan_id = #{classPlanId}
</if>
</select>
<!-- 列表 -->
<select id="list" parameterType="map" resultMap="classPlanDTO">
SELECT
t1.class_plan_id,
t1.plan_number,
t1.org_id,
t1.plan_name,
t1.plan_type,
t1.project_catalog_id,
t1.worker_catalog,
t1.plan_person_num,
t1.plan_start_time,
t1.plan_end_time,
t1.sign_up_start_time,
t1.sign_up_end_time,
t1.plan_address,
t1.charge_person,
t1.charge_person_tel,
t1.report_type,
t1.report_reason
FROM
e_class_plan t1
WHERE
1 = 1
<if test="workerCatalog != null and workerCatalog != ''">
AND t1.worker_catalog = #{workerCatalog}
</if>
<if test="orgId != null">
AND t1.org_id = #{orgId}
</if>
<if test="reportType != null and reportType != ''">
AND t1.report_type = #{reportType}
</if>
<if test="signNowDate != null and signNowDate != ''">
AND t1.sign_up_start_time <![CDATA[ <= ]]> #{signNowDate}
AND t1.sign_up_end_time <![CDATA[ >= ]]> #{signNowDate}
</if>
<if test="examNowDate != null and examNowDate != ''">
AND t1.plan_end_time <![CDATA[ <= ]]> #{examNowDate}
</if>
<if test="planType != null and planType != ''">
AND t1.plan_type = #{planType}
</if>
<if test="keywords != null and keywords != ''">
AND (
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="classPlanIds != null and classPlanIds.size > 0">
AND
t1.class_plan_id IN
<foreach collection="classPlanIds" index="index" open="(" separator="," close=")">
#{classPlanIds[${index}]}
</foreach>
</if>
</select>
<!-- 列表 -->
<select id="listBO" parameterType="map" resultMap="classPlanBO">
SELECT
t1.class_plan_id,
t1.plan_number,
t1.plan_name,
t1.plan_type,
t1.project_catalog_id,
t1.worker_catalog,
t1.plan_person_num,
t1.plan_start_time,
t1.plan_end_time,
t1.sign_up_start_time,
t1.sign_up_end_time,
t1.plan_address,
t1.charge_person,
t1.charge_person_tel
FROM
e_class_plan t1
WHERE
1 = 1
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="classPlanIds != null and classPlanIds.size > 0">
AND
t1.class_plan_id IN
<foreach collection="classPlanIds" index="index" open="(" separator="," close=")">
#{classPlanIds[${index}]}
</foreach>
</if>
</select>
<!-- 列表 -->
<select id="listPO" parameterType="map" resultMap="classPlanPO">
SELECT
t1.class_plan_id,
t1.plan_number,
t1.plan_name,
t1.plan_type,
t1.project_catalog_id,
t1.worker_catalog,
t1.plan_person_num,
t1.plan_start_time,
t1.plan_end_time,
t1.sign_up_start_time,
t1.sign_up_end_time,
t1.plan_address,
t1.charge_person,
t1.charge_person_tel
FROM
e_class_plan t1
WHERE
1 = 1
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="classPlanIds != null and classPlanIds.size > 0">
AND
t1.class_plan_id IN
<foreach collection="classPlanIds" index="index" open="(" separator="," close=")">
#{classPlanIds[${index}]}
</foreach>
</if>
</select>
<!-- 统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
e_class_plan t1
WHERE
1 = 1
</select>
<insert id="saveClassPlanLesson" parameterType="map">
INSERT INTO e_class_plan_lesson
(class_plan_id,lesson_id,teacher_id,is_delete)
VALUES
(#{classPlanId},#{lessonId},#{teacherId},0)
</insert>
<select id="listClassPlanLessons" parameterType="string" resultType="map">
SELECT
t1.class_plan_id classPlanId,
t1.lesson_id lessonId,
t1.teacher_id teacherId
FROM
e_class_plan_lesson t1
WHERE
t1.is_delete = '0'
AND t1.class_plan_id = #{classPlanId}
</select>
<update id="deleteClassPlanLessons" parameterType="map">
UPDATE e_class_plan_lesson SET
is_delete = '1'
WHERE
class_plan_id = #{classPlanId}
</update>
</mapper>