1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.submitted.record_type;
17
18 import org.apache.ibatis.annotations.Arg;
19 import org.apache.ibatis.annotations.Insert;
20 import org.apache.ibatis.annotations.Results;
21 import org.apache.ibatis.annotations.Select;
22
23 public interface RecordTypeMapper {
24
25 @Select("select id, val, url from prop where id = #{id}")
26 Property selectPropertyAutomapping(int id);
27
28 @Results(id = "propertyRM")
29 @Arg(column = "id", javaType = int.class)
30 @Arg(column = "val", javaType = String.class)
31 @Arg(column = "url", javaType = String.class)
32 @Select("select val, id, url from prop where id = #{id}")
33 Property selectProperty(int id);
34
35 @Insert("insert into prop (id, val, url) values (#{id}, #{value}, #{URL})")
36 int insertProperty(Property property);
37
38 @Arg(id = true, column = "id", javaType = Integer.class)
39 @Arg(javaType = Property.class, resultMap = "propertyRM", columnPrefix = "p_")
40
41 @Select({
42 "select i.id, p.id p_id, p.val p_val, p.url p_url",
43 "from item i left join prop p on p.id = i.prop_id",
44 "where i.id = #{id}"})
45
46 Item selectItem(Integer id);
47
48 }