149 lines
3.5 KiB
XML
149 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.hx.slj.modules.sys.dao.NoticeDao">
|
|
|
|
<sql id="noticeColumns">
|
|
a.id AS id,
|
|
a.title AS title,
|
|
a.issuer AS issuer,
|
|
a.issue_date AS issueDate,
|
|
a.content AS content,
|
|
a.create_by AS "createBy.id",
|
|
a.create_date AS createDate,
|
|
a.update_by AS "updateBy.id",
|
|
a.update_date AS updateDate,
|
|
a.remarks AS remarks,
|
|
a.del_flag AS delFlag,
|
|
a.files AS files
|
|
</sql>
|
|
|
|
<sql id="noticeJoins">
|
|
</sql>
|
|
<resultMap type="java.util.Map" id="conResultMap" >
|
|
<result property="content" column="content" jdbcType="BLOB" typeHandler="org.apache.ibatis.type.BlobTypeHandler"/>
|
|
</resultMap>
|
|
|
|
<select id="findContent" parameterType="string" resultMap="conResultMap" >
|
|
SELECT a.content FROM sys_notice a WHERE a.id = #{id}
|
|
</select>
|
|
|
|
<select id="get" resultType="Notice" >
|
|
SELECT
|
|
<include refid="noticeColumns"/>
|
|
FROM sys_notice a
|
|
<include refid="noticeJoins"/>
|
|
WHERE a.id = #{id}
|
|
</select>
|
|
|
|
<select id="findList" resultType="Notice" >
|
|
SELECT
|
|
<include refid="noticeColumns"/>
|
|
FROM sys_notice a
|
|
<include refid="noticeJoins"/>
|
|
<where>
|
|
a.del_flag = #{DEL_FLAG_NORMAL}
|
|
<if test="title != null and title != ''">
|
|
AND a.title LIKE
|
|
<if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
|
|
<if test="dbName == 'mssql'">'%'+#{title}+'%'</if>
|
|
<if test="dbName == 'mysql'">concat('%',#{title},'%')</if>
|
|
</if>
|
|
<if test="issuer != null and issuer != ''">
|
|
AND a.issuer = #{issuer}
|
|
</if>
|
|
<if test="issueDate != null and issueDate != ''">
|
|
AND a.issue_date = #{issueDate}
|
|
</if>
|
|
</where>
|
|
<choose>
|
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
ORDER BY ${page.orderBy}
|
|
</when>
|
|
<otherwise>
|
|
ORDER BY a.update_date DESC
|
|
</otherwise>
|
|
</choose>
|
|
</select>
|
|
|
|
<select id="findAllList" resultType="Notice" >
|
|
SELECT
|
|
<include refid="noticeColumns"/>
|
|
FROM sys_notice a
|
|
<include refid="noticeJoins"/>
|
|
<where>
|
|
a.del_flag = #{DEL_FLAG_NORMAL}
|
|
</where>
|
|
<choose>
|
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
ORDER BY ${page.orderBy}
|
|
</when>
|
|
<otherwise>
|
|
ORDER BY a.update_date DESC
|
|
</otherwise>
|
|
</choose>
|
|
</select>
|
|
|
|
<insert id="insert">
|
|
INSERT INTO sys_notice(
|
|
id,
|
|
title,
|
|
issuer,
|
|
issue_date,
|
|
content,
|
|
create_by,
|
|
create_date,
|
|
update_by,
|
|
update_date,
|
|
remarks,
|
|
del_flag,
|
|
files
|
|
) VALUES (
|
|
#{id},
|
|
#{title},
|
|
#{issuer},
|
|
#{issueDate},
|
|
#{content,typeHandler=org.apache.ibatis.type.BlobTypeHandler},
|
|
#{createBy.id},
|
|
#{createDate},
|
|
#{updateBy.id},
|
|
#{updateDate},
|
|
#{remarks},
|
|
#{delFlag},
|
|
#{files}
|
|
)
|
|
</insert>
|
|
|
|
<update id="update">
|
|
UPDATE sys_notice SET
|
|
title = #{title},
|
|
issuer = #{issuer},
|
|
issue_date = #{issueDate},
|
|
content = #{content},
|
|
update_by = #{updateBy.id},
|
|
update_date = #{updateDate},
|
|
remarks = #{remarks},
|
|
files = #{files}
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
|
|
<!--物理删除-->
|
|
<update id="delete">
|
|
DELETE FROM sys_notice
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
<!--逻辑删除-->
|
|
<update id="deleteByLogic">
|
|
UPDATE sys_notice SET
|
|
del_flag = #{DEL_FLAG_DELETE}
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
|
|
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
|
|
<select id="findUniqueByProperty" resultType="Notice" statementType="STATEMENT">
|
|
select * FROM sys_notice where ${propertyName} = '${value}'
|
|
</select>
|
|
|
|
</mapper> |