|
@@ -31,11 +31,45 @@
|
|
|
|
|
|
<!-- 向数据库增加一条记录 -->
|
|
|
<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Student" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
- INSERT INTO student (user_id_,subject_id_list_,create_time_,update_time_) VALUES(#{userId},#{subjectIdList},NOW(),NOW())
|
|
|
+ INSERT INTO student (user_id_,subject_id_list_,
|
|
|
+ <if test="serviceTag != null">
|
|
|
+ service_tag_,
|
|
|
+ </if>
|
|
|
+ <if test="operatingTag != null">
|
|
|
+ operating_tag_,
|
|
|
+ </if>
|
|
|
+ create_time_,update_time_)
|
|
|
+ VALUES
|
|
|
+ (#{userId},#{subjectIdList},
|
|
|
+ <if test="serviceTag != null">
|
|
|
+ #{serviceTag},
|
|
|
+ </if>
|
|
|
+ <if test="operatingTag != null">
|
|
|
+ #{operatingTag},
|
|
|
+ </if>
|
|
|
+ NOW(),NOW())
|
|
|
</insert>
|
|
|
|
|
|
<update id="update" parameterType="com.ym.mec.biz.dal.entity.Student">
|
|
|
- UPDATE student SET subject_id_list_=#{subjectIdList},update_time_=NOW() WHERE user_id_=#{userId}
|
|
|
+ UPDATE student
|
|
|
+ <set>
|
|
|
+ <if test="subjectIdList != null">
|
|
|
+ subject_id_list_ = #{subjectIdList},
|
|
|
+ </if>
|
|
|
+ <if test="serviceTag != null">
|
|
|
+ service_tag_ = #{serviceTag},
|
|
|
+ </if>
|
|
|
+ <if test="operatingTag != null">
|
|
|
+ operating_tag_ = #{operatingTag},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ update_time_ = #{updateTime},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime == null">
|
|
|
+ update_time_ = NOW()
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ WHERE user_id_ = #{userId}
|
|
|
</update>
|
|
|
|
|
|
<!-- 分页查询 -->
|