|
@@ -14,6 +14,7 @@
|
|
|
<result column="img_" property="img"/>
|
|
|
<result column="create_time_" property="createTime"/>
|
|
|
<result column="update_time_" property="updateTime"/>
|
|
|
+ <result column="tenant_id_" property="tenantId"/>
|
|
|
<result column="del_flag_" property="delFlag" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
|
|
|
</resultMap>
|
|
|
|
|
@@ -30,14 +31,17 @@
|
|
|
<!-- 向数据库增加一条记录 -->
|
|
|
<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Subject" useGeneratedKeys="true" keyColumn="id"
|
|
|
keyProperty="id">
|
|
|
- INSERT INTO subject (id_,name_,code_,parent_subject_id_,img_,create_time_,update_time_)
|
|
|
- VALUES(#{id},#{name},#{code},#{parentSubjectId},#{img},now(),now())
|
|
|
+ INSERT INTO subject (id_,name_,code_,parent_subject_id_,img_,create_time_,update_time_,tenant_id_)
|
|
|
+ VALUES(#{id},#{name},#{code},#{parentSubjectId},#{img},now(),now(),#{tenantId})
|
|
|
</insert>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
|
<update id="update" parameterType="com.ym.mec.biz.dal.entity.Subject">
|
|
|
UPDATE subject
|
|
|
<set>
|
|
|
+ <if test="tenantId != null">
|
|
|
+ tenant_id_ = #{tenantId},
|
|
|
+ </if>
|
|
|
<if test="delFlag != null">
|
|
|
del_flag_ = #{delFlag,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
|
</if>
|
|
@@ -90,10 +94,6 @@
|
|
|
WHERE ctsm.charge_type_id_ = #{chargeTypeId} AND s.del_flag_ = 0
|
|
|
</select>
|
|
|
|
|
|
- <!-- 根据科目code查科目 -->
|
|
|
- <select id="findByCode" resultMap="Subject">
|
|
|
- SELECT * FROM subject WHERE code_ = #{code} AND del_flag_ = 0
|
|
|
- </select>
|
|
|
<select id="findByParentId" resultMap="Subject">
|
|
|
SELECT * FROM subject <include refid="querySubPageSql"/>
|
|
|
</select>
|
|
@@ -130,7 +130,7 @@
|
|
|
WHERE t.id_=#{teacherId} AND s.del_flag_ = 0
|
|
|
</select>
|
|
|
<select id="findSubjectConditions" resultType="com.ym.mec.biz.dal.dto.ConditionDto">
|
|
|
- select id_ id,name_ `name` from subject where parent_subject_id_!=0 AND del_flag_ = 0
|
|
|
+ select id_ id,name_ `name` from subject where parent_subject_id_ != 0 AND del_flag_ = 0 AND tenant_id_ = 1
|
|
|
</select>
|
|
|
<select id="queryNameByIds" resultType="java.util.Map">
|
|
|
select id_ `key`,name_ `value` FROM `subject` s WHERE FIND_IN_SET(s.id_,#{subjectIds}) AND s.del_flag_ = 0
|
|
@@ -139,13 +139,20 @@
|
|
|
select id_ `key`,name_ `value` FROM `subject` s WHERE FIND_IN_SET(s.id_,#{subjectIds}) AND s.del_flag_ = 0
|
|
|
</select>
|
|
|
<select id="findSubSubjects" resultMap="Subject">
|
|
|
- SELECT * FROM `subject` WHERE parent_subject_id_ != 0 AND del_flag_ = 0
|
|
|
+ SELECT * FROM `subject`
|
|
|
+ WHERE parent_subject_id_ != 0 AND del_flag_ = 0
|
|
|
+ <if test="tenantId != null">
|
|
|
+ AND tenant_id_ = #{tenantId}
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
<sql id="querySubPageSql">
|
|
|
<where>
|
|
|
<if test="parentId != null">
|
|
|
- parent_subject_id_ = #{parentId}
|
|
|
+ AND parent_subject_id_ = #{parentId}
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null">
|
|
|
+ AND tenant_id_ = #{tenantId}
|
|
|
</if>
|
|
|
<if test="delFlag != null">
|
|
|
AND del_flag_ = #{delFlag,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|