123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- <?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.ym.mec.cms.dal.dao.SysNewsInformationDao">
-
- <resultMap type="com.ym.mec.cms.dal.entity.SysNewsInformation" id="SysNewsInformation">
- <result column="id_" property="id" />
- <result column="title_" property="title" />
- <result column="content_" property="content" />
- <result column="cover_image_" property="coverImage" />
- <result column="video_cover_image_" property="videoCoverImage" />
- <result column="link_url_" property="linkUrl"/>
- <result column="type_" property="type"/>
- <result column="online_time_" property="onlineTime"/>
- <result column="offline_time_" property="offlineTime"/>
- <result column="sub_type_" property="subType"/>
- <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
- <result column="create_time_" property="createTime" />
- <result column="update_time_" property="updateTime" />
- <result column="del_flag_" property="delFlag" />
- <result column="href_target_" property="hrefTarget" />
- <result column="order_" property="order" />
- <result column="memo_" property="memo" />
- <result column="tenant_id_" property="tenantId" />
- <result column="attribute1_" property="attribute1" />
- <result column="attribute2_" property="attribute2" />
- <result column="subject_id_list_" property="subjectIdList" />
- <result column="organ_id_list_" property="organIdList" />
- <result column="subject_name_" property="subjectName" />
- <result column="organ_name_list_" property="organNameList" />
- </resultMap>
-
- <resultMap type="com.ym.mec.cms.dto.SysNewsInformationDto" id="SysNewsInformationDto" extends="SysNewsInformation">
- <result column="typeName" property="typeName" />
- <result column="subTypeName" property="subTypeName" />
- </resultMap>
-
- <sql id="queryCondition">
- <where>
- sni.del_flag_=0 and sni.tenant_id_ = #{tenantId}
- <if test="type != null">
- and sni.type_ = #{type}
- </if>
- <if test="subType != null">
- and sni.sub_type_ = #{subType}
- </if>
- <if test="status != null">
- and sni.status_ = #{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- <if test="title != null">
- and sni.title_ like '%' #{title} '%'
- </if>
- <if test="search != null">
- and sni.title_ like '%' #{search} '%'
- </if>
- <if test="subjectId != null">
- and find_in_set(#{subjectId},sni.subject_id_list_)
- </if>
- <if test="organId != null">
- and (find_in_set(#{organId},sni.organ_id_list_) or sni.organ_id_list_ is null)
- </if>
- <if test="organIdList != null">
- and INTE_ARRAY(#{organIdList},sni.organ_id_list_)
- </if>
- <if test="excludeIds!=null and excludeIds.size()>0">
- AND sni.id_ NOT IN
- <foreach collection="excludeIds" item="excludeId" open="(" close=")" separator=",">
- #{excludeId}
- </foreach>
- </if>
- <if test="clientName != 'manage'">
- <choose>
- <when test="memo != null and memo != ''">
- and sni.memo_ = #{memo}
- </when>
- <otherwise>
- and (sni.memo_ is null or sni.memo_ = '')
- </otherwise>
- </choose>
- </if>
- </where>
- </sql>
-
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="SysNewsInformation" >
- SELECT * FROM sys_news_information WHERE id_ = #{id} AND del_flag_=0
- </select>
-
- <!-- 全查询 -->
- <select id="findAll" resultMap="SysNewsInformation">
- SELECT * FROM sys_news_information WHERE del_flag_=0 ORDER BY id_
- </select>
-
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.ym.mec.cms.dal.entity.SysNewsInformation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- INSERT INTO sys_news_information (id_,title_,content_,cover_image_,video_cover_image_,type_,online_time_,offline_time_,sub_type_,status_,create_time_,update_time_,link_url_,href_target_,order_,del_flag_,memo_,tenant_id_,attribute1_,attribute2_,subject_id_list_,organ_id_list_)
- VALUES(#{id},#{title},#{content},#{coverImage},#{videoCoverImage},#{type},#{onlineTime},#{offlineTime},#{subType},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0,#{memo},#{tenantId},#{attribute1},#{attribute2},#{subjectIdList},#{organIdList})
- </insert>
-
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.ym.mec.cms.dal.entity.SysNewsInformation">
- UPDATE sys_news_information
- <set>
- <if test="status != null">
- status_ = #{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="title != null">
- title_ = #{title},
- </if>
- <if test="tenantId != null">
- tenant_id_ = #{tenantId},
- </if>
- <if test="updateTime != null">
- update_time_ = NOW(),
- </if>
- <if test="content != null">
- content_ = #{content},
- </if>
- <if test="coverImage != null">
- cover_image_ = #{coverImage},
- </if>
- <if test="videoCoverImage != null">
- video_cover_image_ = #{videoCoverImage},
- </if>
- <if test="type != null">
- type_ = #{type},
- </if>
- online_time_ = #{onlineTime},
- offline_time_ = #{offlineTime},
- <if test="subType != null">
- sub_type_ = #{subType},
- </if>
- <if test="linkUrl != null">
- link_url_ = #{linkUrl},
- </if>
- <if test="hrefTarget != null">
- href_target_ = #{hrefTarget},
- </if>
- <if test="order != null">
- order_ = #{order},
- </if>
- <if test="memo != null">
- memo_ = #{memo},
- </if>
- <if test="delFlag != null">
- del_flag_ = #{delFlag},
- </if>
- <if test="attribute1 != null">
- attribute1_ = #{attribute1},
- </if>
- <if test="attribute2 != null">
- attribute2_ = #{attribute2},
- </if>
- <if test="subjectIdList != null">
- subject_id_list_ = #{subjectIdList},
- </if>
- <if test="organIdList != null">
- organ_id_list_ = #{organIdList},
- </if>
- </set>
- WHERE id_ = #{id}
- </update>
-
- <!-- 根据主键删除一条记录 -->
- <delete id="delete" >
- DELETE FROM sys_news_information WHERE id_ = #{id}
- </delete>
-
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="SysNewsInformation" parameterType="map">
- SELECT sni.*,GROUP_CONCAT(distinct s.name_) subject_name_,GROUP_CONCAT(distinct o.name_) organ_name_list_
- FROM sys_news_information sni left join subject s on find_in_set(s.id_,sni.subject_id_list_)
- left join organization o on find_in_set(o.id_,sni.organ_id_list_)
- <include refid="queryCondition" />
- group by sni.id_
- order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
- <include refid="global.limit"/>
- </select>
-
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(sni.id_) FROM sys_news_information sni
- <include refid="queryCondition" />
- </select>
- <select id="queryBottomInfo" resultMap="SysNewsInformation" parameterType="java.lang.Integer">
- SELECT * FROM sys_news_information
- where del_flag_=0 and status_ = 1
- and sub_type_ = #{subType}
- </select>
- <update id="deleteWithLogical">
- UPDATE sys_news_information SET del_flag_ = 1,update_time_ = NOW() WHERE id_ = #{id}
- </update>
-
- <!-- 分页查询 -->
- <select id="queryHomePage" resultMap="SysNewsInformation"
- parameterType="map">
- SELECT sni.*,GROUP_CONCAT(s.name_) subject_name_ FROM sys_news_information sni left join subject s on find_in_set(s.id_,sni.subject_id_list_) where sni.del_flag_=0 and sni.tenant_id_ = #{tenantId}
- <if test="type != null">
- and sni.type_ = #{type}
- </if>
- <if test="subType != null">
- and sni.sub_type_ = #{subType}
- </if>
- <if test="status != null">
- and sni.status_ = #{status,
- typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- <if test="title != null">
- and sni.title_ like '%' #{title} '%'
- </if>
- <if test="search != null">
- and sni.title_ like '%' #{search} '%'
- </if>
- <if test="excludeIds!=null and excludeIds.size()>0">
- AND sni.id_ NOT IN
- <foreach collection="excludeIds" item="excludeId" open="(" close=")" separator=",">
- #{excludeId}
- </foreach>
- </if>
- <if test="subjectId != null">
- and find_in_set(#{subjectId},sni.subject_id_list_)
- </if>
- <if test="organId != null">
- and (find_in_set(#{organId},sni.organ_id_list_) or sni.organ_id_list_ is null or sni.organ_id_list_ = '')
- </if>
- <if test="clientName != 'manage'">
- <choose>
- <when test="memo != null and memo != ''">
- and sni.memo_ = #{memo}
- </when>
- <otherwise>
- and (sni.memo_ is null or sni.memo_ = '')
- </otherwise>
- </choose>
- </if>
- group by sni.id_
- order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
- <include refid="global.limit" />
- </select>
- <!-- 查询当前表的总记录数 -->
- <select id="queryHomeCount" resultType="int">
- SELECT COUNT(sni.id_) FROM sys_news_information sni where sni.del_flag_=0 and sni.tenant_id_ = #{tenantId}
- <if test="type != null">
- and sni.type_ = #{type}
- </if>
- <if test="subType != null">
- and sni.sub_type_ = #{subType}
- </if>
- <if test="status != null">
- and sni.status_ = #{status,
- typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- <if test="title != null">
- and sni.title_ like '%' #{title} '%'
- </if>
- <if test="search != null">
- and sni.title_ like '%' #{search} '%'
- </if>
- <if test="excludeIds!=null and excludeIds.size()>0">
- AND sni.id_ NOT IN
- <foreach collection="excludeIds" item="excludeId" open="(" close=")" separator=",">
- #{excludeId}
- </foreach>
- </if>
- <if test="subjectId != null">
- and find_in_set(#{subjectId},sni.subject_id_list_)
- </if>
- <if test="organId != null">
- and (find_in_set(#{organId},sni.organ_id_list_) or sni.organ_id_list_ is null or sni.organ_id_list_ = '')
- </if>
- <if test="clientName != 'manage'">
- <choose>
- <when test="memo != null and memo != ''">
- and sni.memo_ = #{memo}
- </when>
- <otherwise>
- and (sni.memo_ is null or sni.memo_ = '')
- </otherwise>
- </choose>
- </if>
- </select>
-
- <select id="queryNeedUpdateStatusList" resultMap="SysNewsInformation" >
- SELECT * FROM sys_news_information WHERE del_flag_ = 0 and (
- (online_time_ is not null and now() between online_time_ and offline_time_ and status_ = 0)
- or (offline_time_ is not null and offline_time_ <= now() and status_ = 1)
- or (online_time_ is not null and online_time_ >= now() and status_ = 1)
- )
- </select>
-
- <select id="queryById" resultMap="SysNewsInformationDto" >
- SELECT sni.*,sntp.name_ typeName,snts.name_ subTypeName FROM sys_news_information sni
- left join sys_news_type sntp on sni.type_ = sntp.id_
- left join sys_news_type snts on sni.sub_type_ = snts.id_
- where sni.id_ = #{id}
- </select>
- <select id="queryBySubType" resultMap="SysNewsInformation">
- SELECT * FROM sys_news_information
- WHERE del_flag_=0
- AND status_=1
- <if test="subType != null">
- AND sub_type_ = #{subType}
- </if>
- <if test="memo == null or memo == ''">
- AND (memo_ IS NULL OR memo_ = '')
- </if>
- <if test="memo != null and memo !=''">
- AND memo_ = #{memo}
- </if>
- <if test="organIds != null and organIds !=''">
- AND INTE_ARRAY(#{organIds},organ_id_list_) OR organ_id_list_ IS NULL OR organ_id_list_ = ''
- </if>
- ORDER BY order_ DESC
- </select>
- <select id="countStudentAttendanceError" resultType="java.lang.Boolean">
- SELECT COUNT(DISTINCT cs.id_) FROM course_schedule cs
- LEFT JOIN course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
- LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cs.id_ AND cssp.user_id_ = sa.user_id_
- LEFT JOIN teacher_attendance ta on ta.course_schedule_id_ = cs.id_
- LEFT JOIN course_schedule_teacher_salary csts ON csts.course_schedule_id_ = cs.id_
- where cs.del_flag_ = '0' AND cs.pre_course_flag_ != 1 AND csts.user_id_ = #{userId} AND cs.status_ = 'OVER' AND cs.class_date_ BETWEEN #{startTime} AND DATE(NOW())
- AND (sa.id_ IS NULL OR (sa.status_ = 'TRUANT' AND sa.visit_flag_ = 0))
- AND EXISTS (SELECT id_ FROM course_schedule_teacher_salary WHERE cs.id_=course_schedule_id_ AND settlement_time_ IS NULL)
- AND cs.merge_flag_ IN (0,1) AND cssp.id_ IS NOT NULL
- AND (ta.sign_out_status_ IS NOT NULL OR ta.sign_in_status_ IS NOT NULL)
- </select>
- <select id="queryHomework" resultType="java.lang.Integer">
- SELECT count( csts.course_schedule_id_)
- FROM course_schedule_teacher_salary csts
- LEFT JOIN course_schedule cs ON cs.id_ = csts.course_schedule_id_
- LEFT JOIN student_extracurricular_exercises_situation_ se ON se.teacher_id_ = csts.user_id_
- left join lesson_examination le on le.course_schedule_id_ = csts.course_schedule_id_
- left join teacher_attendance ta on ta.course_schedule_id_ = csts.course_schedule_id_
- WHERE csts.user_id_ = #{teacherId}
- AND cs.class_date_ = date_format(now(),'%Y-%m-%d')
- AND FIND_IN_SET(cs.id_, se.course_ids_) and le.id_ is null
- AND se.serve_type_ = 'HOMEWORK'
- and ta.sign_out_status_ is null and ta.sign_in_status_ is not null
- </select>
- <select id="queryPractice" resultType="int">
- SELECT
- count(distinct sees.music_group_id_)
- from
- student_extracurricular_exercises_situation_ sees
- LEFT JOIN
- music_group mg
- on mg.id_ = sees.music_group_id_
- WHERE
- sees.teacher_id_ = #{userId}
- and sees.serve_type_ = 'EXERCISE'
- and sees.actual_exercises_num_ = 0
- and sees.monday_ = #{date}
- </select>
- <select id="queryTeacherOrgan" resultType="java.lang.String">
- select organ_id_ from teacher where id_ = #{userId}
- </select>
- </mapper>
|