12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?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.mapper.LiuyanMapper">
- <resultMap type="Liuyan" id="queryMap">
- <id property="id" column="id" />
- <result property="uid" column="uid" />
- <result property="lynr" column="lynr" />
- <result property="lysj" column="lysj" />
- <result property="lyhf" column="lyhf" />
- <association property="user" javaType="Userinfo">
- <id property="id" column="id" />
- <result property="name" column="name" />
- <result property="tel" column="tel" />
- </association>
- </resultMap>
- <sql id="Where_Clause">
- <where>
- <if test="id!=null and id!=0">and a.id= #{id}</if>
- <if test="uid!=null and uid!=''">and a.uid= #{uid}</if>
- </where>
- </sql>
- <select id="query" parameterType="java.util.Map"
- resultMap="queryMap">
- select a.*,b.name,b.tel from liuyan a left join
- userinfo b on a.uid=b.id
- <include refid="Where_Clause" />
- order by id desc
- </select>
- <select id="getCount" parameterType="java.util.Map"
- resultType="Int">
- select count(*) nums from liuyan a left join userinfo b on
- a.uid=b.id
- <include refid="Where_Clause" />
- </select>
- <select id="queryLiuyanById" parameterType="int"
- resultType="Liuyan">
- select * from liuyan where id=${value}
- </select>
- <insert id="insertLiuyan" useGeneratedKeys="true" keyProperty="id"
- parameterType="Liuyan">
- insert into liuyan (uid,lynr,lysj,lyhf) values
- (#{uid},#{lynr},#{lysj},#{lyhf});
- </insert>
- <update id="updateLiuyan" parameterType="Liuyan">
- update liuyan set
- uid=#{uid},lynr=#{lynr},lysj=#{lysj},lyhf=#{lyhf} where id=#{id}
- </update>
- <delete id="deleteLiuyan" parameterType="int">
- delete from liuyan where id=${value}
- </delete>
- </mapper>
|