hn_leader_performance_system/target/classes/mappers/announcement/AnnouncementMapper.xml

164 lines
7.2 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.leader.performance.manager.manager.dao.AnnouncementDao">
<insert id="addAnnouncementInfo" keyProperty="id" useGeneratedKeys="true">
insert into bm_notice(notice_name,notice_type,notice_range,notice_details,release_user_id,release_user_name,notice_file_uuid,is_active)
values(#{title},#{type},#{personType},#{content},#{releasePersonId},#{releasePerson},#{uuid},'1')
</insert>
<insert id="insertUserNoticeRelation">
insert into sys_notic_person (notic_id,person_id,is_read)values(#{id},#{userId},'0')
</insert>
<insert id="insertCateManage">
insert into sys_data_dict(dict_key,parent_id,is_enable,is_active)
values (#{typeName},#{parentId},'1','1')
</insert>
<insert id="insertFileDownLoadRecord">
insert into download_record(file_name, file_path, user_id, user_name)
values(#{fileName},#{filePath},#{userId},#{userName})
</insert>
<update id="updateCateManage">
update sys_data_dict set dict_key = #{typeName} where id = #{id}
</update>
<delete id="delAnnouncementTypeById">
update sys_data_dict set is_active = '0' where id = #{id}
</delete>
<delete id="delAnnouncementById">
update bm_notice set is_active = '0' where notice_id = #{id}
</delete>
<select id="getAnnouncementList"
resultType="com.bonus.leader.performance.manager.manager.entity.AnnouncementBean">
select
bn.notice_id as id,
bn.notice_name as title,
if(bn.notice_range = '1','全体人员','部分人员') as acceptGroup,
bn.notice_details as content,
bn.release_user_id as releasePersonId,
bn.release_user_name as releasePerson,
bn.notice_file_uuid as fileId,
bn.create_time as releaseTime,
sdd.dict_key as type
from bm_notice bn
left join sys_data_dict sdd on bn.notice_type = sdd.id
where bn.is_active = '1'
<if test="keyWord != null and keyWord != ''">
AND(
bn.notice_name LIKE concat ('%',#{keyWord},'%')
)
</if>
<if test="type != null and type != ''">
AND bn.notice_type = #{type}
</if>
<if test="releaseTime != null and releaseTime != ''">
AND DATE(bn.create_time) = #{releaseTime}
</if>
</select>
<select id="getAllPerson" resultType="java.lang.String">
select
ID as id
from sys_user
where is_active = '1'
</select>
<select id="checkTitle" resultType="java.lang.Integer">
select
count(1)
from bm_notice
where notice_name = #{title}
limit 1
</select>
<select id="getAnnouncementType"
resultType="com.bonus.leader.performance.manager.manager.entity.AnnouncementBean">
select
id as id,
dict_key as typeName,
if(ifnull(dick_val,'') = '', '2','1') as type,
parent_id as parentId
from sys_data_dict
where parent_id = '1' and is_active = '1' and is_enable = '1'
</select>
<select id="getAnnouncementView"
resultType="com.bonus.leader.performance.manager.manager.entity.AnnouncementBean">
select
bn.notice_name as title,
sdd.dict_key as type,
if(bn.notice_range = '1','全体人员','部分人员') as acceptGroup,
bn.notice_details as content,
bn.release_user_name as releasePerson,
bn.create_time as releaseTime,
bn.notice_file_uuid as uuid
from bm_notice bn
left join sys_data_dict sdd on sdd.id = bn.notice_type
where bn.notice_id = #{id}
</select>
<select id="getFileList" resultType="com.bonus.leader.performance.manager.manager.entity.FileBean">
select
file_id as id,
file_name as fileName,
CONCAT(file_size,'MB') as fileSize,
upload_user_name as userName,
file_path as filePath,
notes as remark,
create_time as uploadTime
from bm_file_information
where associa_id = #{id} and file_type = 'announcement' and is_active = '1'
</select>
<select id="getUserList"
resultType="com.bonus.leader.performance.manager.manager.entity.AnnouncementBean">
select
ID as userId,
username as userName
from
sys_user where is_active = '1'
<if test="id !=null and id != ''">
and org_id = #{id}
</if>
</select>
<select id="getCompanyProTree"
resultType="com.bonus.leader.performance.manager.manager.entity.TreeBean">
SELECT id,
org_name as title,
parent_id as parentId,
level
FROM sys_organization
WHERE LEVEL = '0'
and is_active = '1' and is_enable = '1'
union all
SELECT s.id as id, s.org_name as title, s.parent_id as parentId, s.level
FROM sys_organization s
left join sys_organization so on so.id = s.parent_id
WHERE s.is_active = '1' and s.LEVEL = '1' and so.is_active = '1' and so.is_enable = '1'
union all
SELECT s.id as id, s.org_name as title, s.parent_id as parentId, s.level
FROM sys_organization s
left join sys_organization so on so.id = s.parent_id
left join sys_organization sos on sos.id = so.parent_id
WHERE s.is_active = '1' and s.LEVEL = '2' and so.is_active = '1' and so.is_enable = '1' and sos.is_active = '1' and sos.is_enable = '1'
</select>
<select id="getPersonTree" resultType="com.bonus.leader.performance.manager.manager.entity.TreeBean">
SELECT id,
org_name as title,
parent_id as parentId,
level
FROM sys_organization
WHERE LEVEL = '0'
and is_active = '1' and is_enable = '1'
union all
SELECT s.id as id, s.org_name as title, s.parent_id as parentId, s.level
FROM sys_organization s
left join sys_organization so on so.id = s.parent_id
WHERE s.is_active = '1' and s.LEVEL = '1' and so.is_active = '1' and so.is_enable = '1'
union all
SELECT s.id as id, s.org_name as title, s.parent_id as parentId, s.level
FROM sys_organization s
left join sys_organization so on so.id = s.parent_id
left join sys_organization sos on sos.id = so.parent_id
WHERE s.is_active = '1' and s.LEVEL = '2' and so.is_active = '1' and so.is_enable = '1' and sos.is_active = '1' and sos.is_enable = '1'
union all
SELECT CONCAT('P',su.id) as id, su.username as title,su.org_id as parentId, '4' as level
FROM sys_notic_person snp
left join sys_user su on su.id = snp.person_id and su.is_active = '1'
left join sys_organization so on so.id = su.org_id and so.is_active = '1' and so.is_enable = '1'
where snp.notic_id = #{id}
</select>
</mapper>