123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- <?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.jeeplus.modules.train.mapper.EduTrainPlanMapper">
-
- <sql id="eduTrainPlanColumns">
- a.id AS "id",
- a.title AS "title",
- a.train_date AS "trainDate",
- a.train_range AS "trainRange",
- a.content AS "content",
- a.teacher AS "teacher",
- a.place AS "place",
- a.create_by AS "createBy.id",
- a.create_date AS "createDate",
- a.update_by AS "updateBy.id",
- a.update_date AS "updateDate",
- a.del_flag AS "delFlag",
- a.status AS "status"
- </sql>
- <sql id="eduTrainPlanSignerColumns">
- a.id AS "id",
- a.title AS "title",
- a.train_date AS "trainDate",
- a.train_range AS "trainRange",
- a.content AS "content",
- a.teacher AS "teacher",
- a.place AS "place",
- a.create_by AS "createBy.id",
- a.create_date AS "createDate",
- a.update_by AS "updateBy.id",
- a.update_date AS "updateDate",
- a.del_flag AS "delFlag",
- a.status AS "status",
- enroll.status AS "signer"
- </sql>
- <sql id="eduTrainPlanJoins">
-
- </sql>
-
- <resultMap type="EduTrainPlan" id="EduTrainPlanResult" autoMapping="true">
- <result column="content" property="content" typeHandler="com.jeeplus.core.mapper.ConvertBlobTypeHandler"/>
- </resultMap>
-
- <select id="get" resultMap="EduTrainPlanResult" >
- SELECT
- <include refid="eduTrainPlanColumns"/>
- FROM edu_train_plan a
- <include refid="eduTrainPlanJoins"/>
- WHERE a.id = #{id}
- </select>
-
- <select id="findList" resultMap="EduTrainPlanResult" >
- SELECT
- <include refid="eduTrainPlanColumns"/>
- FROM edu_train_plan a
- <include refid="eduTrainPlanJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- ${dataScope}
- <if test="title != null and title != ''">
- AND a.title LIKE
- <if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{title}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{title},'%')</if>
- </if>
- <if test="teacher != null and teacher != ''">
- AND a.teacher LIKE
- <if test="dbName == 'oracle'">'%'||#{teacher}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{teacher}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{teacher},'%')</if>
- </if>
- <if test="place != null and place != ''">
- AND a.place LIKE
- <if test="dbName == 'oracle'">'%'||#{place}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{place}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{place},'%')</if>
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.update_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="findListSign" resultMap="EduTrainPlanResult" >
- SELECT
- <include refid="eduTrainPlanSignerColumns"/>
- FROM edu_train_plan a
- left join edu_train_enroll enroll
- on a.id = enroll.plan_id and enroll.create_by = #{signer}
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.update_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultMap="EduTrainPlanResult" >
- SELECT
- <include refid="eduTrainPlanColumns"/>
- FROM edu_train_plan a
- <include refid="eduTrainPlanJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- ${dataScope}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.update_date DESC
- </otherwise>
- </choose>
- </select>
-
- <insert id="insert">
- INSERT INTO edu_train_plan(
- id,
- title,
- train_date,
- train_range,
- content,
- teacher,
- place,
- create_by,
- create_date,
- update_by,
- update_date,
- del_flag,
- status
- ) VALUES (
- #{id},
- #{title},
- #{trainDate},
- #{trainRange},
- #{content},
- #{teacher},
- #{place},
- #{createBy.id},
- #{createDate},
- #{updateBy.id},
- #{updateDate},
- #{delFlag},
- #{status}
- )
- </insert>
-
- <update id="update">
- UPDATE edu_train_plan SET
- title = #{title},
- train_date = #{trainDate},
- train_range = #{trainRange},
- content = #{content},
- teacher = #{teacher},
- place = #{place},
- update_by = #{updateBy.id},
- update_date = #{updateDate},
- status = #{status}
- WHERE id = #{id}
- </update>
-
-
- <!--物理删除-->
- <update id="delete">
- DELETE FROM edu_train_plan
- WHERE id = #{id}
- </update>
-
- <!--逻辑删除-->
- <update id="deleteByLogic">
- UPDATE edu_train_plan SET
- del_flag = #{DEL_FLAG_DELETE}
- WHERE id = #{id}
- </update>
-
-
- <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
- <select id="findUniqueByProperty" resultType="EduTrainPlan" statementType="STATEMENT">
- select * FROM edu_train_plan where ${propertyName} = '${value}'
- </select>
-
- </mapper>
|