123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <?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.EduTrainEnrollMapper">
-
- <sql id="eduTrainEnrollColumns">
- a.id AS "id",
- a.plan_id AS "plan.id",
- a.train_office AS "trainOffice",
- a.train_names AS "trainNames",
- a.create_by AS "createBy.id",
- a.create_date AS "createDate",
- a.status AS "status",
- p.title AS "plan.title",
- u.name AS "createBy.name"
- </sql>
-
- <sql id="eduTrainEnrollJoins">
- left join edu_train_plan p on p.id = a.plan_id
- left join sys_user u on u.id = a.create_by
- </sql>
-
-
- <select id="get" resultType="EduTrainEnroll" >
- SELECT
- <include refid="eduTrainEnrollColumns"/>
- FROM edu_train_enroll a
- <include refid="eduTrainEnrollJoins"/>
- WHERE a.id = #{id}
- </select>
- <select id="findByPlan" resultType="EduTrainEnroll" >
- SELECT
- <include refid="eduTrainEnrollColumns"/>
- FROM edu_train_enroll a
- <include refid="eduTrainEnrollJoins"/>
- WHERE a.plan_id = #{planId} and a.create_by = #{userId}
- </select>
-
- <select id="findList" resultType="EduTrainEnroll" >
- SELECT
- <include refid="eduTrainEnrollColumns"/>
- FROM edu_train_enroll a
- <include refid="eduTrainEnrollJoins"/>
- <where>
-
- ${dataScope}
- <if test="trainOffice != null and trainOffice != ''">
- AND a.train_office = #{trainOffice}
- </if>
- <if test="trainNames != null and trainNames != ''">
- AND a.train_names LIKE
- <if test="dbName == 'oracle'">'%'||#{trainNames}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{trainNames}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{trainNames},'%')</if>
- </if>
- <if test="status != null and status != ''">
- AND a.status = #{status}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
-
- <select id="findAllList" resultType="EduTrainEnroll" >
- SELECT
- <include refid="eduTrainEnrollColumns"/>
- FROM edu_train_enroll a
- <include refid="eduTrainEnrollJoins"/>
- <where>
-
- ${dataScope}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
-
- <insert id="insert">
- INSERT INTO edu_train_enroll(
- id,
- train_office,
- train_names,
- create_by,
- create_date,
- status,
- plan_id
- ) VALUES (
- #{id},
- #{trainOffice},
- #{trainNames},
- #{createBy.id},
- #{createDate},
- #{status},
- #{plan.id}
- )
- </insert>
-
- <update id="update">
- UPDATE edu_train_enroll SET
- train_office = #{trainOffice},
- train_names = #{trainNames},
- status = #{status},
- plan_id = #{plan.id}
- WHERE id = #{id}
- </update>
-
-
- <!--物理删除-->
- <update id="delete">
- DELETE FROM edu_train_enroll
- WHERE id = #{id}
- </update>
-
- <!--逻辑删除-->
- <update id="deleteByLogic">
- UPDATE edu_train_enroll SET
- del_flag = #{DEL_FLAG_DELETE}
- WHERE id = #{id}
- </update>
-
-
- <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
- <select id="findUniqueByProperty" resultType="EduTrainEnroll" statementType="STATEMENT">
- select * FROM edu_train_enroll where ${propertyName} = '${value}'
- </select>
-
- </mapper>
|