bkjxxxw/build/classes/mappings/ccqnsoft/links/LinksDao.xml

144 lines
3.1 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.jeeplus.ccqnsoft.links.dao.LinksDao">
<sql id="linksColumns">
a.id AS "id",
a.title AS "title",
a.links AS "links",
a.enclosure AS "enclosure",
a.classify AS "classify",
a.manner AS "manner",
a.sort AS "sort",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.del_flag AS "delFlag",
c.name AS "createName"
</sql>
<sql id="linksJoins">
LEFT JOIN sys_user c ON c.ID = a.create_by
</sql>
<select id="get" resultType="Links" >
SELECT
<include refid="linksColumns"/>
FROM tqd_links a
<include refid="linksJoins"/>
WHERE a.id = #{id}
</select>
<select id="findList" resultType="Links" >
SELECT
<include refid="linksColumns"/>
FROM tqd_links a
<include refid="linksJoins"/>
<where>
<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="classify != null and classify != ''">
AND a.classify = #{classify}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.sort ASC,a.create_date DESC
</otherwise>
</choose>
</select>
<select id="findAllList" resultType="Links" >
SELECT
<include refid="linksColumns"/>
FROM tqd_links a
<include refid="linksJoins"/>
<where>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.sort ASC,a.create_date DESC,
</otherwise>
</choose>
</select>
<insert id="insert">
INSERT INTO tqd_links(
id,
title,
links,
enclosure,
classify,
manner,
sort,
create_by,
create_date,
update_by,
update_date,
del_flag
) VALUES (
#{id},
#{title},
#{links},
#{enclosure},
#{classify},
#{manner},
#{sort},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{DEL_FLAG_NORMAL}
)
</insert>
<update id="update">
UPDATE tqd_links SET
title = #{title},
links = #{links},
enclosure = #{enclosure},
classify = #{classify},
manner = #{manner},
sort = #{sort},
update_by = #{updateBy.id},
update_date = #{updateDate}
WHERE id = #{id}
</update>
<!--物理删除-->
<update id="delete">
DELETE FROM tqd_links
WHERE id = #{id}
</update>
<!--逻辑删除-->
<update id="deleteByLogic">
UPDATE tqd_links SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
<select id="findUniqueByProperty" resultType="Links" statementType="STATEMENT">
select * FROM tqd_links where ${propertyName} = '${value}'
</select>
</mapper>