码迷,mamicode.com
首页 > 编程语言 > 详细

msyql springMVC 操作

时间:2016-12-13 07:54:37      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:rom   add   mod   property   ase   dtd   select   odi   res   

<?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.elevator.dao.ProjectMapper" >

<resultMap id="BaseResultMap" type="com.elevator.model.Project" >
<id column="projectid" property="projectId" jdbcType="VARCHAR" />
<result column="projectname" property="projectName" jdbcType="VARCHAR" />
<result column="updatetime" property="updateTime" jdbcType="VARCHAR" />
</resultMap>


<select id="getProjectList" resultMap="BaseResultMap" parameterType="com.elevator.model.Project">
select projectid, projectname,updatetime from ec_project

where 1 = 1

<if test="projectId !=null and projectId !=‘‘ ">
and projectid like CONCAT(‘%‘,#{projectId},‘%‘)
</if>
<if test="projectName !=null and projectName !=‘‘ ">
and projectname like CONCAT(‘%‘,#{projectName},‘%‘)
</if>
</select>

<insert id="addProject" parameterType="com.elevator.model.Project">
insert into ec_project
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="projectId != null" >
projectid,
</if>
<if test="projectName != null" >
projectname,
</if>
<if test="updateTime != null" >
updatetime,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="projectId != null" >
#{projectId, jdbcType=VARCHAR},
</if>
<if test="projectName != null" >
#{projectName, jdbcType=VARCHAR},
</if>
<if test="updateTime != null" >
#{updateTime, jdbcType=DATE},
</if>
</trim>
</insert>
</mapper>

msyql springMVC 操作

标签:rom   add   mod   property   ase   dtd   select   odi   res   

原文地址:http://www.cnblogs.com/he0xff/p/6005422.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!