xing
2023-02-23 c75e6f4696634d626c5569794c6349593853223a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?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.yssh.dao.YsshSuYuanMapper">
    <resultMap id="YsshSuYuanResult" type="com.yssh.entity.YsshSuYuan">
        <id column="id" property="id" javaType="java.lang.String" />
        <id column="name" property="name" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="father_name" property="fatherName" javaType="java.lang.String" jdbcType="VARCHAR" />
        <id column="lon" property="lon" javaType="java.lang.Float" jdbcType="DOUBLE"/>
        <id column="lat" property="lat" javaType="java.lang.Float" jdbcType="DOUBLE"/>
        <id column="value" property="value" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="info" property="info" javaType="java.lang.String" jdbcType="VARCHAR"/>
    </resultMap>
    <select id="query" resultType="com.yssh.entity.YsshSuYuan">
        select * from yssh_suyuan where 1=1
        <if test="fatherName != null and fatherName != ''">
            and father_name = #{fatherName}
        </if>
    </select>
    <select id="queryByIds" resultType="com.yssh.entity.YsshSuYuan">
        select * from yssh_suyuan where id in
        <foreach item="item" index="index" collection="list"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>
    <select id="getAll" resultType="com.yssh.entity.YsshSuYuan">
        select * from yssh_suyuan where 1=1
    </select>
    <insert id="insert" parameterType="com.yssh.entity.YsshSuYuan">
        insert into yssh_suyuan (
            name, father_name, lon, lat, value, info
        )
        values (
            #{name},#{fatherName},#{lon},#{lat},#{value},#{info}
        )
    </insert>
    <delete id="delete">
        delete from yssh_suyuan where id = #{id}
    </delete>
 
    <update id="update">
        update yssh_suyuan
        <set >
            <if test="name != null and name != ''">
                name = #{name},
            </if>
            <if test="fatherName != null and fatherName != ''">
                father_name = #{fatherName},
            </if>
            <if test="lon != null">
                lon = #{lon},
            </if>
            <if test="lat != null">
                lat = #{lat},
            </if>
            <if test="value != null and value != ''">
                value = #{value},
            </if>
            <if test="info != null and info != ''">
                info = #{info},
            </if>
        </set>
        where id = #{id}
    </update>
</mapper>