You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
6.4 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.op.system.mapper.SysNoticeGroupMapper">
<resultMap type="SysNoticeGroup" id="SysNoticeGroupResult">
<result property="id" column="id"/>
<result property="noticeId" column="notice_id"/>
<result property="groupCode" column="group_code"/>
<result property="groupName" column="group_name"/>
<result property="delFlag" column="del_flag"/>
<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>
<sql id="selectSysNoticeGroupVo">
select id, notice_id, group_code, group_name, del_flag, create_by, create_time, update_by, update_time, remark from sys_notice_group
</sql>
<select id="selectSysNoticeGroupList" parameterType="SysNoticeGroup" resultMap="SysNoticeGroupResult">
<include refid="selectSysNoticeGroupVo"/>
<where>
<if test="noticeId != null ">
and notice_id = #{noticeId}
</if>
<if test="groupCode != null and groupCode != ''">
and group_code = #{groupCode}
</if>
<if test="groupName != null and groupName != ''">
and group_name like concat('%', #{groupName}, '%')
</if>
</where>
</select>
<select id="selectByNoticeId" parameterType="String"
resultMap="SysNoticeGroupResult">
<include refid="selectSysNoticeGroupVo"/>
where del_flag = '0' and notice_id = #{id}
</select>
<insert id="insertSysNoticeGroup" parameterType="SysNoticeGroup">
insert into sys_notice_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,
</if>
<if test="noticeId != null">notice_id,
</if>
<if test="groupCode != null">group_code,
</if>
<if test="groupName != null">group_name,
</if>
<if test="delFlag != null">del_flag,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="remark != null">remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},
</if>
<if test="noticeId != null">#{noticeId},
</if>
<if test="groupCode != null">#{groupCode},
</if>
<if test="groupName != null">#{groupName},
</if>
<if test="delFlag != null">#{delFlag},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="remark != null">#{remark},
</if>
</trim>
</insert>
<update id="updateSysNoticeGroup" parameterType="SysNoticeGroup">
update sys_notice_group
<trim prefix="SET" suffixOverrides=",">
<if test="noticeId != null">notice_id =
#{noticeId},
</if>
<if test="groupCode != null">group_code =
#{groupCode},
</if>
<if test="groupName != null">group_name =
#{groupName},
</if>
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="remark != null">remark =
#{remark},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysNoticeGroupById" parameterType="Long">
update sys_notice_group set del_flag = '1' where id = #{id}
</delete>
<delete id="deleteSysNoticeGroupByIds" parameterType="String">
update sys_notice_group set del_flag = "1" where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="validData" parameterType="SysNoticeGroup" resultMap="SysNoticeGroupResult">
<include refid="selectSysNoticeGroupVo"/>
WHERE del_flag = 0 and notice_id = #{noticeId} and group_code = #{groupCode}
</select>
<select id="getSerialNumber" resultType="java.lang.Integer">
select count(0)+1
from sys_notice_group
where
CONVERT(varchar(10),create_time, 120) = CONVERT(varchar(10),GETDATE(), 120)
</select>
<delete id="deleteByNotice" parameterType="String">
update sys_notice_group set del_flag = '1' where notice_id = #{noticeId} and group_code in
<foreach item="groupCode" collection="groupCodes" open="(" separator="," close=")">
#{groupCode}
</foreach>
</delete>
</mapper>