Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JeeSpringCloud
Commits
d39d7376
Commit
d39d7376
authored
Oct 22, 2018
by
HuangBingGui
Browse files
no commit message
parent
44ad5f47
Changes
7
Hide whitespace changes
Inline
Side-by-side
JeeSpringCloud/src/main/resources/mappings/cms/ArticleDao.xml
0 → 100644
View file @
d39d7376
<?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.jeespring.modules.cms.dao.ArticleDao"
>
<sql
id=
"cmsArticleColumns"
>
a.id AS "id",
a.category_id AS "category.id",
a.title AS "title",
a.link AS "link",
a.color AS "color",
a.image AS "image",
a.keywords AS "keywords",
a.description AS "description",
a.weight AS "weight",
a.weight_date AS "weightDate",
a.hits AS "hits",
a.posid AS "posid",
a.custom_content_view AS "customContentView",
a.view_config AS "viewConfig",
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",
c.name AS "category.name",
u.name AS "user.name"
</sql>
<sql
id=
"cmsArticleJoins"
>
JOIN cms_category c ON c.id = a.category_id
JOIN sys_office o ON o.id = c.office_id
JOIN sys_user u ON u.id = a.create_by
</sql>
<select
id=
"get"
resultType=
"Article"
>
SELECT
<include
refid=
"cmsArticleColumns"
/>
FROM cms_article a
<include
refid=
"cmsArticleJoins"
/>
WHERE a.id = #{id}
</select>
<select
id=
"findList"
resultType=
"Article"
>
SELECT
<include
refid=
"cmsArticleColumns"
/>
FROM cms_article a
<include
refid=
"cmsArticleJoins"
/>
<where>
a.del_flag = #{delFlag}
<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=
"posid != null and posid != ''"
>
AND a.posid LIKE
<if
test=
"dbName == 'oracle'"
>
'%'||#{posid}||'%'
</if>
<if
test=
"dbName == 'mssql'"
>
'%'+#{posid}+'%'
</if>
<if
test=
"dbName == 'mysql'"
>
CONCAT('%', #{posid}, '%')
</if>
</if>
<if
test=
"category.id != null and category.id != ''"
>
AND (a.category_id = #{category.id}
<if
test=
"category.parentIds != null and category.parentIds != ''"
>
or c.parent_ids like
<if
test=
"dbName == 'oracle'"
>
'%'||#{category.id}||'%'
</if>
<if
test=
"dbName == 'mssql'"
>
'%,'+#{category.id}+',%'
</if>
<if
test=
"dbName == 'mysql'"
>
CONCAT('%,', #{category.id}, ',%')
</if>
</if>
)
</if>
<if
test=
"image != null and image != ''"
>
AND a.image = #{image}
</if>
<if
test=
"createBy != null and createBy.id != null and createBy.id != ''"
>
AND a.create_by = #{createBy.id}
</if>
<!-- ${sqlMap.dsf}-->
</where>
<choose>
<when
test=
"page !=null and page.orderBy != null and page.orderBy != ''"
>
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.weight DESC, a.update_date DESC
</otherwise>
</choose>
</select>
<select
id=
"findAllList"
resultType=
"Article"
>
SELECT
<include
refid=
"cmsArticleColumns"
/>
FROM cms_article a
<include
refid=
"cmsArticleJoins"
/>
<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.weight DESC, a.update_date DESC
</otherwise>
</choose>
</select>
<insert
id=
"insert"
>
INSERT INTO cms_article(
id,
category_id,
title,
link,
color,
image,
keywords,
description,
weight,
weight_date,
hits,
posid,
custom_content_view,
view_config,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag
) VALUES (
#{id},
#{category.id},
#{title},
#{link},
#{color},
#{image},
#{keywords},
#{description},
#{weight},
#{weightDate},
#{hits},
#{posid},
#{customContentView},
#{viewConfig},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{delFlag}
)
</insert>
<update
id=
"update"
>
UPDATE cms_article SET
category_id = #{category.id},
title = #{title},
link = #{link},
color = #{color},
image = #{image},
keywords = #{keywords},
description = #{description},
weight = #{weight},
weight_date = #{weightDate},
hits = #{hits},
posid = #{posid},
custom_content_view = #{customContentView},
view_config = #{viewConfig},
create_date = #{createDate},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks},
del_flag = #{delFlag}
WHERE id = #{id}
</update>
<update
id=
"delete"
>
UPDATE cms_article SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
<select
id=
"findByIdIn"
resultType=
"Article"
>
SELECT
<include
refid=
"cmsArticleColumns"
/>
from cms_article a where
<where>
id in (${id});
</where>
</select>
<update
id=
"updateExpiredWeight"
>
update cms_article SET
weight = 0
WHERE weight
>
0 AND weight_date
<
<if
test=
"dbName == 'oracle'"
>
sysdate
</if>
<if
test=
"dbName == 'mssql'"
>
FLOOR(CONVERT(FLOAT,GETDATE()))
</if>
<if
test=
"dbName == 'mysql'"
>
CURDATE()
</if>
</update>
<update
id=
"updateHitsAddOne"
>
update cms_article set
hits = hits+1
WHERE id = #{id}
</update>
<select
id=
"findStats"
resultType=
"Category"
>
select max(c.id) AS "id",
max(c.name) AS "name",
max(cp.id) AS "parent.id",
max(cp.name) AS "parent.name",
count(*) AS "cnt",
sum(a.hits) AS "hits",
max(a.update_date) as "updateDate",
max(o.id) AS "office.id",
max(o.name) AS "office.name"
FROM cms_article a
RIGHT JOIN cms_category c ON c.id = a.category_id
JOIN cms_category cp ON c.parent_id = cp.id
JOIN sys_office o ON o.id = c.office_id
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
AND c.site_id = #{site.id}
<if
test=
"office.id != null and office.id != ''"
>
AND (c.office_id = #{office.id} OR o.parent_ids like
<if
test=
"dbName == 'oracle'"
>
'%'||#{office.id}||'%'
</if>
<if
test=
"dbName == 'mssql'"
>
'%'+#{office.id}+'%'
</if>
<if
test=
"dbName == 'mysql'"
>
CONCAT('%', #{office.id}, '%')
</if>
)
</if>
<if
test=
"id != null and id != ''"
>
AND (c.id = #{id} OR c.parent_ids LIKE
<if
test=
"dbName == 'oracle'"
>
'%'||#{id}||'%'
</if>
<if
test=
"dbName == 'mssql'"
>
'%'+#{id}+'%'
</if>
<if
test=
"dbName == 'mysql'"
>
CONCAT('%', #{id}, '%')
</if>
)
</if>
group by cp.sort, cp.id, c.sort, c.id
order by cp.sort, cp.id, c.sort, c.id
</where>
</select>
</mapper>
\ No newline at end of file
JeeSpringCloud/src/main/resources/mappings/cms/ArticleDataDao.xml
0 → 100644
View file @
d39d7376
<?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.jeespring.modules.cms.dao.ArticleDataDao"
>
<sql
id=
"cmsArticleDataColumns"
>
a.id AS "id",
a.content AS "content",
a.copyfrom AS "copyfrom",
a.relation AS "relation",
a.allow_comment AS "allow_comment"
</sql>
<sql
id=
"cmsArticleDataJoins"
>
</sql>
<select
id=
"get"
resultType=
"ArticleData"
>
SELECT
<include
refid=
"cmsArticleDataColumns"
/>
FROM cms_article_data a
<include
refid=
"cmsArticleDataJoins"
/>
WHERE a.id = #{id}
</select>
<insert
id=
"insert"
>
INSERT INTO cms_article_data(
id,
content,
copyfrom,
relation,
allow_comment
) VALUES (
#{id},
#{content},
#{copyfrom},
#{relation},
#{allowComment}
)
</insert>
<update
id=
"update"
>
UPDATE cms_article_data SET
content = #{content},
copyfrom = #{copyfrom},
relation = #{relation},
allow_comment = #{allowComment}
WHERE id = #{id}
</update>
</mapper>
\ No newline at end of file
JeeSpringCloud/src/main/resources/mappings/cms/CategoryDao.xml
0 → 100644
View file @
d39d7376
<?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.jeespring.modules.cms.dao.CategoryDao"
>
<sql
id=
"cmsCategoryDaoColumns"
>
a.id AS "id",
a.parent_id AS "parent.id",
a.parent_ids AS "parentIds",
a.site_id AS "site.id",
a.office_id AS "office.id",
a.module AS "module",
a.name AS "name",
a.image AS "image",
a.href AS "href",
a.target AS "target",
a.description AS "description",
a.keywords AS "keywords",
a.sort AS "sort",
a.in_menu AS "inMenu",
a.in_list AS "inList",
a.show_modes AS "showModes",
a.allow_comment AS "allowComment",
a.is_audit AS "isAudit",
a.custom_list_view AS "customListView",
a.custom_content_view AS "customContentView",
a.view_config AS "viewConfig",
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",
c.name AS "parent.name",
c.view_config AS "parent.viewConfig",
o.name AS "office.name",
s.theme AS "site.theme"
</sql>
<sql
id=
"cmsCategoryDaoJoins"
>
LEFT JOIN cms_category c ON c.id = a.parent_id
JOIN sys_office o ON o.id = a.office_id
JOIN sys_user u ON u.id = a.create_by
JOIN cms_site s ON a.site_id = s.id
</sql>
<select
id=
"get"
resultType=
"Category"
>
SELECT
a.id AS "id",
a.parent_id AS "parent.id",
a.parent_ids AS "parentIds",
a.site_id AS "site.id",
a.office_id AS "office.id",
a.module AS "module",
a.name AS "name",
a.image AS "image",
a.href AS "href",
a.target AS "target",
a.description AS "description",
a.keywords AS "keywords",
a.sort AS "sort",
a.in_menu AS "inMenu",
a.in_menu AS "inList",
a.show_modes AS "showModes",
a.allow_comment AS "allowComment",
a.is_audit AS "isAudit",
a.custom_list_view AS "customListView",
a.custom_content_view AS "customContentView",
a.view_config AS "viewConfig",
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",
o.name AS "office.name"
FROM cms_category a
JOIN sys_office o ON o.id = a.office_id
JOIN sys_user u ON u.id = a.create_by
WHERE a.id = #{id}
</select>
<select
id=
"find"
resultType=
"Category"
>
SELECT
<include
refid=
"cmsCategoryDaoColumns"
/>
FROM cms_category a
<include
refid=
"cmsCategoryDaoJoins"
/>
<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>
<select
id=
"findList"
resultType=
"Category"
>
SELECT
<include
refid=
"cmsCategoryDaoColumns"
/>
FROM cms_category a
<include
refid=
"cmsCategoryDaoJoins"
/>
<where>
a.del_flag = #{delFlag}
<if
test=
" site.id != null and site.id != ''"
>
AND a.site_id = #{site.id}
</if>
<if
test=
"parent.id != null and parent.id != ''"
>
AND a.parent_id = #{parent.id}
</if>
${sqlMap.dsf}
</where>
ORDER BY a.site_id,a.sort ASC
</select>
<select
id=
"findModule"
resultType=
"Category"
>
SELECT
<include
refid=
"cmsCategoryDaoColumns"
/>
FROM cms_category a
<include
refid=
"cmsCategoryDaoJoins"
/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
<if
test=
" site.id != null and site.id != ''"
>
AND a.site_id = #{site.id}
</if>
<if
test=
"parent.id != null and parent.id != ''"
>
AND a.parent_id = #{parent.id}
</if>
<if
test=
"inMenu != null and inMenu != '' "
>
AND a.in_menu = #{inMenu}
</if>
${sqlMap.dsf}
</where>
ORDER BY a.site_id,a.sort ASC
</select>
<insert
id=
"insert"
>
INSERT INTO cms_category(
id,
parent_id,
parent_ids,
site_id,
office_id,
module,
name,
image,
href,
target,
description,
keywords,
sort,
in_menu,
in_list,
show_modes,
allow_comment,
is_audit,
custom_list_view,
custom_content_view,
view_config,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag
) VALUES (
#{id},
#{parent.id},
#{parentIds},
#{site.id},
#{office.id},
#{module},
#{name},
#{image},
#{href},
#{target},
#{description},
#{keywords},
#{sort},
#{inMenu},
#{inList},
#{showModes},
#{allowComment},
#{isAudit},
#{customListView},
#{customContentView},
#{viewConfig},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{delFlag}
)
</insert>
<update
id=
"update"
>
UPDATE cms_category SET
parent_id = #{parent.id},
parent_ids = #{parentIds},
site_id = #{site.id},
office_id = #{office.id},
module = #{module},
name = #{name},
image = #{image},
href = #{href},
target = #{target},
description = #{description},
keywords = #{keywords},
sort = #{sort},
in_menu = #{inMenu},
in_list = #{inList},
show_modes = #{showModes},
allow_comment = #{allowComment},
is_audit = #{isAudit},
custom_list_view = #{customListView},
custom_content_view = #{customContentView},
view_config = #{viewConfig},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks},
del_flag = #{delFlag}
WHERE id = #{id}
</update>
<update
id=
"updateParentIds"
>
UPDATE cms_category SET
parent_id = #{parent.id},
parent_ids = #{parentIds}
WHERE id = #{id}
</update>
<update
id=
"delete"
>
UPDATE cms_category SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id} OR parent_ids LIKE
<if
test=
"dbName == 'oracle'"
>
'%,'||#{id}||',%'
</if>
<if
test=
"dbName == 'mssql'"
>
'%,'+#{id}+',%'
</if>
<if
test=
"dbName == 'mysql'"
>
CONCAT('%,', #{id}, ',%')
</if>
</update>
<select
id=
"findByParentIdAndSiteId"
resultType=
"Category"
>
SELECT
<include
refid=
"cmsCategoryDaoColumns"
/>
FROM cms_category a
<include
refid=
"cmsCategoryDaoJoins"
/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
<if
test=
" site.id != null and site.id != ''"
>
AND a.site_id = #{site.id}
</if>
<if
test=
"parent.id != null and parent.id != ''"
>
AND a.parent_id = #{parent.id}
</if>
</where>
order by a.site_id, a.sort
</select>
<select
id=
"findByParentIdsLike"
resultType=
"Category"
>
SELECT
<include
refid=
"cmsCategoryDaoColumns"
/>
FROM cms_category a
<include
refid=
"cmsCategoryDaoJoins"
/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
AND a.parent_id LIKE
<if
test=
"dbName == 'oracle'"
>
'%'||#{id}||'%'
</if>
<if
test=
"dbName == 'mssql'"
>
'%'+#{id}+'%'
</if>
<if
test=
"dbName == 'mysql'"
>
CONCAT('%', #{id}, '%')
</if>
</where>
order by a.site_id, a.sort
</select>
<select
id=
"findStats"
resultType=
"java.util.Map"
parameterType=
"java.util.Map"
>
select max(c.id) as categoryId,
max(c.name) as categoryName,
max(cp.id) as categoryParentId,
max(cp.name) as categoryParentName,
count(*) as cnt,
sum(a.hits) as hits,
max(a.updateDate) as updateDate,
max(o.id) as officeId,
max(o.name) as officeName,
from cms_article a
JOIN cms_category c ON c.id = a.category_id
JOIN cms_category cp ON c.parent_id = cp.id
JOIN sys_office o ON o.id = c.office_id
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
AND a.category_id
AND c.site_id =
AND c.id = :id or c.parent_ids LIKE
<if
test=
"dbName == 'oracle'"
>
'%'||#{parentIds}||'%'
</if>
<if
test=
"dbName == 'mssql'"
>
'%'+#{parentIds}+'%'
</if>
<if
test=
"dbName == 'mysql'"
>
CONCAT('%', #{parentIds}, '%')
</if>
group by cp.sort, cp.id, c.sort, c.id
order by cp.sort, cp.id, c.sort, c.id
</where>
</select>
</mapper>
\ No newline at end of file
JeeSpringCloud/src/main/resources/mappings/cms/CommentDao.xml
0 → 100644
View file @
d39d7376
<?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.jeespring.modules.cms.dao.CommentDao"
>
<sql
id=
"cmsCommentDaoColumns"
>
a.id AS "id",
a.category_id AS "category.id",
a.content_id AS "contentId",
a.title AS "title",
a.content AS "content",
a.name AS "name",
a.ip AS "ip",
a.create_date AS "createDate",
a.audit_user_id AS "auditUser.id",
a.audit_date AS "auditDate",
a.del_flag AS "delFlag"
</sql>
<sql
id=
"cmsCommentDaoJoins"
>
</sql>
<select
id=
"get"
resultType=
"Comment"
>
SELECT
<include
refid=
"cmsCommentDaoColumns"
/>
FROM cms_comment a
<include
refid=
"cmsCommentDaoJoins"
/>
WHERE a.id = #{id}
</select>
<select
id=
"findList"
resultType=
"Comment"
>
SELECT
<include
refid=
"cmsCommentDaoColumns"
/>
FROM cms_comment a
<include
refid=
"cmsCommentDaoJoins"
/>
<where>
a.del_flag = #{delFlag}
<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>
</where>
<choose>
<when
test=
"page !=null and page.orderBy != null and page.orderBy != ''"
>
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.create_date DESC
</otherwise>
</choose>
</select>
<select
id=
"findAllList"
resultType=
"Comment"
>
SELECT
<include
refid=
"cmsCommentDaoColumns"
/>
FROM cms_comment a
<include
refid=
"cmsCommentDaoJoins"
/>
<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.create_date DESC
</otherwise>
</choose>
</select>
<insert
id=
"insert"
>
INSERT INTO cms_comment(
id,
category_id,
content_id,
title,
content,
name,
ip,
create_date,
audit_user_id,
audit_date,
del_flag
) VALUES (
#{id},
#{category.id},
#{contentId},
#{title},
#{content},
#{name},
#{ip},
#{createDate},
#{auditUser.id},
#{auditDate},
#{delFlag}
)
</insert>
<update
id=
"update"
>
UPDATE cms_comment SET
category_id = #{category.id},
content_id = #{contentId},
title = #{title},
content = #{content},
name = #{name},
ip = #{ip},
create_date = #{createDate},
audit_user_id = #{auditUser.id},
audit_date = #{auditDate},
del_flag = #{delFlag}
WHERE id = #{id}
</update>
<update
id=
"delete"
>
UPDATE cms_comment SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
</mapper>
\ No newline at end of file
JeeSpringCloud/src/main/resources/mappings/cms/GuestbookDao.xml
0 → 100644
View file @
d39d7376
<?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.jeespring.modules.cms.dao.GuestbookDao"
>
<sql
id=
"cmsGuestbookColumns"
>
a.id AS "id",
a.type AS "type",
a.content AS "content",
a.name AS "name",
a.email AS "email",
a.phone AS "phone",
a.workunit AS "workunit",
a.ip AS "ip",
a.create_date AS "createDate",
a.re_user_id AS "reUser.id",
a.re_date AS "reDate",
a.re_content AS "reContent",
a.del_flag AS "delFlag",
u.name AS "reUser.name"
</sql>
<sql
id=
"cmsGuestbookJoins"
>
LEFT JOIN sys_user u ON u.id = a.re_user_id
</sql>
<select
id=
"get"
resultType=
"Guestbook"
>
SELECT
<include
refid=
"cmsGuestbookColumns"
/>
FROM cms_guestbook a
<include
refid=
"cmsGuestbookJoins"
/>
WHERE a.id = #{id}
</select>
<select
id=
"findList"
resultType=
"Guestbook"
>
SELECT
<include
refid=
"cmsGuestbookColumns"
/>
FROM cms_guestbook a
<include
refid=
"cmsGuestbookJoins"
/>
<where>
a.del_flag = #{delFlag}
</where>
<choose>
<when
test=
"page !=null and page.orderBy != null and page.orderBy != ''"
>
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.create_date DESC
</otherwise>
</choose>
</select>
<select
id=
"findAllList"
resultType=
"Guestbook"
>
SELECT
<include
refid=
"cmsGuestbookColumns"
/>
FROM cms_guestbook a
<include
refid=
"cmsGuestbookJoins"
/>
<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.create_date DESC
</otherwise>
</choose>
</select>
<insert
id=
"insert"
>
INSERT INTO cms_guestbook(
id,
type,
content,
name,
email,
phone,
workunit,
ip,
create_date,
re_user_id,
re_date,
re_content,
del_flag
) VALUES (
#{id},
#{type},
#{content},
#{name},
#{email},
#{phone},
#{workunit},
#{ip},
#{createDate},
#{reUser.id},
#{reDate},
#{reContent},
#{delFlag}
)
</insert>
<update
id=
"update"
>
UPDATE cms_guestbook SET
type = #{type},
content = #{content},
name = #{name},
email = #{email},
phone = #{phone},
workunit = #{workunit},
ip = #{ip},
create_date = #{createDate},
re_user_id = #{reUser.id},
re_date = #{reDate},
re_content = #{reContent},
del_flag = #{delFlag}
WHERE id = #{id}
</update>
<update
id=
"delete"
>
UPDATE cms_guestbook SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
<select
id=
"findByIdIn"
resultType=
"Guestbook"
>
SELECT
<include
refid=
"cmsGuestbookColumns"
/>
from cms_guestbook a where
<where>
id in ();
</where>
</select>
</mapper>
\ No newline at end of file
JeeSpringCloud/src/main/resources/mappings/cms/LinkDao.xml
0 → 100644
View file @
d39d7376
<?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.jeespring.modules.cms.dao.LinkDao"
>
<sql
id=
"cmsLinkColumns"
>
a.id AS "id",
a.category_id AS "category.id",
a.title AS "title",
a.color AS "color",
a.image AS "image",
a.href AS "href",
a.weight AS "weight",
a.weight_date AS "weightDate",
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",
c.name AS "category.name",
u.name AS "user.name"
</sql>
<sql
id=
"cmsLinkJoins"
>
JOIN cms_category c ON c.id = a.category_id
JOIN sys_user u ON u.id = a.create_by
</sql>
<select
id=
"get"
resultType=
"Link"
>
SELECT
<include
refid=
"cmsLinkColumns"
/>
FROM cms_link a
<include
refid=
"cmsLinkJoins"
/>
WHERE a.id = #{id}
</select>
<select
id=
"findList"
resultType=
"Link"
>
SELECT
<include
refid=
"cmsLinkColumns"
/>
FROM cms_link a
<include
refid=
"cmsLinkJoins"
/>
<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>
</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=
"Link"
>
SELECT
<include
refid=
"cmsLinkColumns"
/>
FROM cms_link a
<include
refid=
"cmsLinkJoins"
/>
<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 cms_link(
id,
category_id,
title,
color,
image,
href,
weight,
weight_date,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag
) VALUES (
#{id},
#{category.id},
#{title},
#{color},
#{image},
#{href},
#{weight},
#{weightDate},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{delFlag}
)
</insert>
<update
id=
"update"
>
UPDATE cms_link SET
category_id = #{category.id},
title = #{title},
color = #{color},
image = #{image},
href = #{href},
weight = #{weight},
weight_date = #{weightDate},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks},
del_flag = #{delFlag}
WHERE id = #{id}
</update>
<update
id=
"delete"
>
UPDATE cms_link SET
del_flag = #{delFlag}
WHERE id = #{id}
</update>
<select
id=
"findByIdIn"
resultType=
"Link"
>
SELECT
<include
refid=
"cmsLinkColumns"
/>
from cms_link a where
<where>
id in (${id});
</where>
</select>
<update
id=
"updateExpiredWeight"
>
update cms_link SET
weight=0
WHERE weight
>
0 AND weight_date
<
<if
test=
"dbName == 'oracle'"
>
sysdate
</if>
<if
test=
"dbName == 'mssql'"
>
FLOOR(CONVERT(FLOAT,GETDATE()))
</if>
<if
test=
"dbName == 'mysql'"
>
CURDATE()
</if>
</update>
</mapper>
\ No newline at end of file
JeeSpringCloud/src/main/resources/mappings/cms/SiteDao.xml
0 → 100644
View file @
d39d7376
<?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.jeespring.modules.cms.dao.SiteDao"
>
<sql
id=
"cmsSiteColumns"
>
a.id AS "id",
a.name AS "name",
a.title AS "title",
a.logo AS "logo",
a.domain AS "domain",
a.description AS "description",
a.keywords AS "keywords",
a.theme AS "theme",
a.copyright AS "copyright",
a.custom_index_view AS "customIndexView",
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"
</sql>
<sql
id=
"cmsSiteJoins"
>
</sql>
<select
id=
"get"
resultType=
"Site"
>
SELECT
<include
refid=
"cmsSiteColumns"
/>
FROM cms_site a
<include
refid=
"cmsSiteJoins"
/>
WHERE a.id = #{id}
</select>
<select
id=
"findList"
resultType=
"Site"
>
SELECT
<include
refid=
"cmsSiteColumns"
/>
FROM cms_site a
<include
refid=
"cmsSiteJoins"
/>
<where>
a.del_flag = #{delFlag}
<if
test=
"name != null and name != ''"
>
AND a.name LIKE
<if
test=
"dbName == 'oracle'"
>
'%'||#{name}||'%'
</if>
<if
test=
"dbName == 'mssql'"
>
'%'+#{name}+'%'
</if>
<if
test=
"dbName == 'mysql'"
>
CONCAT('%', #{name}, '%')
</if>
</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=
"Site"
>
SELECT
<include
refid=
"cmsSiteColumns"
/>
FROM cms_site a
<include
refid=
"cmsSiteJoins"
/>
<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 cms_site(
id,
name,
title,
logo,
domain,
description,
keywords,
theme,
copyright,
custom_index_view,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag
) VALUES (
#{id},
#{name},
#{title},
#{logo},
null,
#{description},
#{keywords},
#{theme},
#{copyright},
#{customIndexView},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{delFlag}
)
</insert>
<update
id=
"update"
>
UPDATE cms_site SET
name = #{name},
title = #{title},
logo = #{logo},
domain = #{domain},
description = #{description},
keywords = #{keywords},
theme = #{theme},
copyright = #{copyright},
custom_index_view = #{customIndexView},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks},
del_flag = #{delFlag}
WHERE id = #{id}
</update>
<update
id=
"delete"
>
UPDATE cms_site SET
del_flag = #{delFlag}
WHERE id = #{id}
</update>
</mapper>
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment