配置文件一mapper.xml
Posted loveer
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了配置文件一mapper.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="dao.AreaDao">
<select id="queryArea" resultType="entity.Area">
SELECT area_id,
area_name,
area_desc,
priority,
create_time,
last_edit_time
FROM tb_area
ORDER BY priority DESC
</select>
<insert id="insertArea" useGeneratedKeys="true" keyProperty="areaId" keyColumn="area_id">
INSERT INTO tb_area(area_name, area_desc, priority,
create_time, last_edit_time)
VALUES (#areaName, #areaDesc, #priority,
#createTime, #lastEditTime)
</insert>
<update id="updateArea" parameterType="entity.Area">
update tb_area
<set>
<if test="areaName != null">area_name=#areaName,</if>
<if test="areaDesc != null">area_desc=#areaDesc,</if>
<if test="priority != null">priority=#priority,</if>
<if test="lastEditTime != null">last_edit_time=#lastEditTime</if>
</set>
where area_id=#areaId
</update>
<delete id="deleteArea">
DELETE
FROM tb_area
WHERE area_id =
#areaId
</delete>
<delete id="batchDeleteArea" parameterType="long">
DELETE FROM
tb_area
WHERE area_id IN
<foreach collection="list" item="areaId" open="(" separator=","
close=")">
#areaId
</foreach>
</delete>
</mapper>
以上是关于配置文件一mapper.xml的主要内容,如果未能解决你的问题,请参考以下文章