@ -5,26 +5,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace= "com.hw.system.mapper.SysNoticeMapper" >
<resultMap type= "SysNotice" id= "SysNoticeResult" >
<result property= "noticeId" column= "notice_id" />
<result property= "noticeId" column= "notice_id" />
<result property= "noticeTitle" column= "notice_title" />
<result property= "noticeType" column= "notice_type" />
<result property= "noticeContent" column= "notice_content" />
<result property= "status" column= "status" />
<result property= "createBy" column= "create_by" />
<result property= "createTime" column= "create_time" />
<result property= "updateBy" column= "update_by" />
<result property= "updateTime" column= "update_time" />
<result property= "remark" column= "remark" />
<result property= "noticeType" column= "notice_type" />
<result property= "noticeContent" column= "notice_content" />
<result property= "status" column= "status" />
<result property= "stationId" column= "station_id" />
<result property= "userGroupId" column= "user_group_id" />
<result property= "attachPath" column= "attach_path" />
<result property= "createBy" column= "create_by" />
<result property= "createTime" column= "create_time" />
<result property= "updateBy" column= "update_by" />
<result property= "updateTime" column= "update_time" />
<result property= "remark" column= "remark" />
</resultMap>
<resultMap id= "SysNoticeSysUserNoticeResult" type= "SysNotice" extends= "SysNoticeResult" >
<collection property= "sysUserNoticeList" notNullColumn= "sub_notice_id" javaType= "java.util.List" resultMap= "SysUserNoticeResult" />
<collection property= "userNoticeList" ofType= "java.lang.Long" >
<id column= "sub_user_id" property= "userNoticeList" />
</collection>
</resultMap>
<resultMap type= "SysUserNotice" id= "SysUserNoticeResult" >
<result property= "noticeId" column= "sub_notice_id" />
<result property= "userId" column= "sub_user_id" />
<result property= "checkStatus" column= "sub_check_status" />
<result property= "checkTime" column= "sub_check_time" />
<result property= "downloadStatus" column= "sub_download_status" />
<result property= "downloadTime" column= "sub_download_time" />
</resultMap>
<sql id= "selectNoticeVo" >
select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark
select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, station_id, user_group_id, attach_path, create_by, create_time, update_by, update_time, remark
from sys_notice
</sql>
<select id= "selectNoticeById" parameterType= "Long" resultMap= "SysNoticeResult" >
<include refid= "selectNoticeVo" />
where notice_id = #{noticeId}
<select id= "selectNoticeById" parameterType= "Long" resultMap= "SysNoticeSysUserNoticeResult" >
select a.notice_id, a.notice_title, a.notice_type, a.notice_content, a.status, a.station_id, a.user_group_id, a.attach_path, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
b.notice_id as sub_notice_id, b.user_id as sub_user_id, b.check_status as sub_check_status, b.check_time as sub_check_time, b.download_status as sub_download_status, b.download_time as sub_download_time
from sys_notice a
left join sys_user_notice b on b.notice_id = a.notice_id
where a.notice_id = #{noticeId}
</select>
<select id= "selectNoticeList" parameterType= "SysNotice" resultMap= "SysNoticeResult" >
@ -42,12 +64,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<insert id= "insertNotice" parameterType= "SysNotice" >
<insert id= "insertNotice" parameterType= "SysNotice" useGeneratedKeys= "true" keyProperty= "noticeId" >
insert into sys_notice (
<if test= "noticeTitle != null and noticeTitle != '' " > notice_title, </if>
<if test= "noticeType != null and noticeType != '' " > notice_type, </if>
<if test= "noticeContent != null and noticeContent != '' " > notice_content, </if>
<if test= "status != null and status != '' " > status, </if>
<if test= "stationId != null" > station_id,</if>
<if test= "userGroupId != null" > user_group_id,</if>
<if test= "attachPath != null" > attach_path,</if>
<if test= "remark != null and remark != ''" > remark,</if>
<if test= "createBy != null and createBy != ''" > create_by,</if>
create_time
@ -56,6 +81,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test= "noticeType != null and noticeType != ''" > #{noticeType}, </if>
<if test= "noticeContent != null and noticeContent != ''" > #{noticeContent}, </if>
<if test= "status != null and status != ''" > #{status}, </if>
<if test= "stationId != null" > #{stationId},</if>
<if test= "userGroupId != null" > #{userGroupId},</if>
<if test= "attachPath != null and attachPath != ''" > #{attachPath},</if>
<if test= "remark != null and remark != ''" > #{remark},</if>
<if test= "createBy != null and createBy != ''" > #{createBy},</if>
sysdate()
@ -69,6 +97,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test= "noticeType != null and noticeType != ''" > notice_type = #{noticeType}, </if>
<if test= "noticeContent != null" > notice_content = #{noticeContent}, </if>
<if test= "status != null and status != ''" > status = #{status}, </if>
<if test= "stationId != null" > station_id = #{stationId},</if>
<if test= "userGroupId != null" > user_group_id = #{userGroupId},</if>
<if test= "attachPath != null" > attach_path = #{attachPath},</if>
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
update_time = sysdate()
</set>
@ -85,5 +116,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{noticeId}
</foreach>
</delete>
<delete id= "deleteSysUserNoticeByNoticeIds" parameterType= "String" >
delete from sys_user_notice where notice_id in
<foreach item= "noticeId" collection= "array" open= "(" separator= "," close= ")" >
#{noticeId}
</foreach>
</delete>
<delete id= "deleteSysUserNoticeByNoticeId" parameterType= "Long" >
delete from sys_user_notice where notice_id = #{noticeId}
</delete>
<insert id= "batchSysUserNotice" >
insert into sys_user_notice( notice_id, user_id) values
<foreach item= "item" index= "index" collection= "list" separator= "," >
( #{item.noticeId}, #{item.userId})
</foreach>
</insert>
</mapper>