mashangjiandu/src/main/resources/mybatis/mapper/website/web-site-mng-mapper.xml
2022-12-29 17:08:44 +08:00

91 lines
3.2 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="cn.com.tenlion.superviseqrcode.dao.website.IWebSiteMngDao">
<resultMap id="webSiteMngDto" type="cn.com.tenlion.superviseqrcode.pojo.dtos.website.WebSiteMngDTO">
<result column="id" property="id"/>
<result column="web_site_name" property="webSiteName"/>
<result column="web_site_url" property="webSiteUrl"/>
<result column="web_site_discription" property="webSiteDiscription"/>
<result column="manage_org_id" property="manageOrgId"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
</resultMap>
<select id="list" parameterType="map" resultMap="webSiteMngDto">
SELECT
t1.*
FROM
msjd_web_site_mng t1
WHERE
t1.is_delete = '0'
<if test="keywords != null and keywords != ''">
AND (
t1.web_site_name LIKE CONCAT('%', #{keywords}, '%')
OR
t1.web_site_url LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="manageOrgId != null and manageOrgId !=''">
AND FIND_IN_SET(t1.manage_org_id, #{manageOrgId})
</if>
ORDER BY t1.id DESC
</select>
<select id="get" parameterType="map" resultMap="webSiteMngDto">
SELECT
t1.*
FROM
msjd_web_site_mng t1
WHERE
t1.is_delete = '0'
AND t1.id = #{id}
LIMIT 1
</select>
<insert id="save" parameterType="map" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
INSERT INTO msjd_web_site_mng (
web_site_name, web_site_url, web_site_discription, manage_org_id, creator, gmt_create, modifier, gmt_modified, is_delete
) VALUES (
#{webSiteName}, #{webSiteUrl}, #{webSiteDiscription}, #{manageOrgId}, #{creator}, #{gmtCreate}, #{modifier}, #{gmtModified}, '0'
)
</insert>
<update id="update" parameterType="map">
UPDATE msjd_web_site_mng SET
id = #{id}
<if test="webSiteName!= null">
,web_site_name = #{webSiteName}
</if>
<if test="webSiteUrl!= null">
,web_site_url = #{webSiteUrl}
</if>
<if test="webSiteDiscription!= null">
,web_site_discription = #{webSiteDiscription}
</if>
<if test="manageOrgId!= null">
,manage_org_id = #{manageOrgId}
</if>
,modifier = #{modifier}
,gmt_modified = #{gmtModified}
WHERE
id = #{id}
</update>
<update id="remove" parameterType="map">
UPDATE
msjd_web_site_mng
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
id IN
<foreach collection="ids" index="index" open="(" separator="," close=")">
#{ids[${index}]}
</foreach>
</update>
</mapper>