InvestigateUserMapper.xml
1.59 KB
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
<?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.project.demo.mapper.InvestigateUserMapper">
<resultMap id="investigateUserMap" type="com.project.demo.domain.InvestigateUser">
<result column="users_id" property="usersId" />
<result column="com_investigation_id" property="comInvestigationId" />
</resultMap>
<select id="search" resultMap="investigateUserMap" resultType="Map">
SELECT
*
FROM investigate_user
where 1=1
<if test="params.usersId != null">
AND users_id = #{params.usersId}
</if>
<if test="params.comInvestigationId != null">
AND com_investigation_id = #{params.comInvestigationId}
</if>
</select>
<delete id = "delete">
DELETE FROM investigate_user where users_id=#{usersId} and com_investigation_id = #{comInvestigationId}
</delete>
<insert id="insert" parameterType="com.project.demo.domain.InvestigateUser">
insert into investigate_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="usersId != null">
users_id,
</if>
<if test="comInvestigationId != null">
com_investigation_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="usersId != null">
#{usersId},
</if>
<if test="comInvestigationId != null">
#{comInvestigationId},
</if>
</trim>
</insert>
</mapper>