96 lines
3.5 KiB
XML
96 lines
3.5 KiB
XML
|
|
<?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.bonus.system.basic.dao.SysNoticeMapper">
|
||
|
|
<insert id="insertNotice" keyProperty="noticeId" useGeneratedKeys="true" keyColumn="id">
|
||
|
|
insert into sys_notice(
|
||
|
|
<if test="userId != null and userId != ''">user_id,</if>
|
||
|
|
<if test="title != null and title != ''">title,</if>
|
||
|
|
<if test="content != null and content != ''">content,</if>
|
||
|
|
<if test="type != null and type != ''">type,</if>
|
||
|
|
<if test="value != null and value != ''">value,</if>
|
||
|
|
create_time
|
||
|
|
) values(
|
||
|
|
<if test="userId != null and userId != ''">#{userId},</if>
|
||
|
|
<if test="title != null and title != ''">#{title},</if>
|
||
|
|
<if test="content != null and content != ''">#{content},</if>
|
||
|
|
<if test="type != null and type != ''">#{type},</if>
|
||
|
|
<if test="value != null and value != ''">#{value},</if>
|
||
|
|
sysdate()
|
||
|
|
)
|
||
|
|
</insert>
|
||
|
|
<insert id="insertUserNotice">
|
||
|
|
insert into sys_notice_user(notice_id, user_id) values
|
||
|
|
<foreach collection="list" item="item" separator=",">
|
||
|
|
(#{item.noticeId},#{item.userId})
|
||
|
|
</foreach>
|
||
|
|
</insert>
|
||
|
|
<update id="updateStatus">
|
||
|
|
update sys_notice_user set is_read='1' where notice_id = #{noticeId} and user_id = #{userId} and is_active = 1
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<select id="selectNoticeList" resultType="com.bonus.system.basic.domain.SysNotice">
|
||
|
|
SELECT
|
||
|
|
snu.notice_id as noticeId,
|
||
|
|
sn.title,
|
||
|
|
sn.content,
|
||
|
|
sdd.dict_label as type,
|
||
|
|
sn.value,
|
||
|
|
su.user_name as userName,
|
||
|
|
sn.create_time as creatTime,
|
||
|
|
snu.is_read as isRead
|
||
|
|
FROM
|
||
|
|
sys_notice_user snu
|
||
|
|
LEFT JOIN sys_notice sn on sn.id=snu.notice_id and sn.is_active=1
|
||
|
|
LEFT JOIN sys_user su on su.user_id=sn.user_id and su.is_active=1
|
||
|
|
LEFT JOIN sys_dict_data sdd on sdd.dict_code=sn.type and sdd.`status`=0
|
||
|
|
WHERE
|
||
|
|
snu.user_id=#{userId}
|
||
|
|
and snu.is_active=1
|
||
|
|
<if test="isRead != null and isRead != ''">
|
||
|
|
and snu.is_read=#{isRead}
|
||
|
|
</if>
|
||
|
|
order by sn.create_time desc
|
||
|
|
</select>
|
||
|
|
<select id="getDictData" resultType="java.lang.Long">
|
||
|
|
SELECT
|
||
|
|
dict_code as noticeId
|
||
|
|
FROM
|
||
|
|
sys_dict_data
|
||
|
|
WHERE
|
||
|
|
dict_label = '轮休申请'
|
||
|
|
AND dict_type = 'sys_notice'
|
||
|
|
and `status`=0
|
||
|
|
limit 1
|
||
|
|
</select>
|
||
|
|
<select id="getUserIdByModelName" resultType="java.lang.Long">
|
||
|
|
SELECT DISTINCT
|
||
|
|
sur.user_id
|
||
|
|
FROM
|
||
|
|
sys_menu sm
|
||
|
|
LEFT JOIN sys_role_menu srm ON srm.menu_id = sm.menu_id
|
||
|
|
AND srm.is_active = '1'
|
||
|
|
LEFT JOIN sys_user_role sur ON sur.role_id = srm.role_id
|
||
|
|
AND sur.is_active = '1'
|
||
|
|
WHERE
|
||
|
|
sm.menu_name = #{modelName}
|
||
|
|
</select>
|
||
|
|
<select id="getUserIdByOrgId" resultType="java.lang.Long">
|
||
|
|
SELECT DISTINCT
|
||
|
|
user_id
|
||
|
|
FROM
|
||
|
|
sys_organization_head
|
||
|
|
WHERE org_id = #{orgId}
|
||
|
|
</select>
|
||
|
|
<select id="getAttUserIdByOrgId" resultType="java.lang.Long">
|
||
|
|
SELECT DISTINCT
|
||
|
|
attendance_user_id
|
||
|
|
FROM
|
||
|
|
sys_organization
|
||
|
|
WHERE id IN
|
||
|
|
<foreach collection="list" item="item" separator="," open="(" close=")">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</select>
|
||
|
|
</mapper>
|