Attribute.xml
2.99 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
52
53
54
55
56
57
<?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.dili.titan.dao.AttributeDao">
<sql id="QUERY_WHERE_CLAUSE">
<where>
<if test="attrId != null and attrId != ''"><![CDATA[AND id = #{id}]]></if>
<if test="name != null and name != ''"><![CDATA[AND name = #{name}]]></if>
<if test="alias != null and alias != ''"><![CDATA[AND alias = #{alias}]]></if>
<if test="dealType != null"><![CDATA[deal_type = #{dealType},]]></if>
<if test="inputtype != null and inputtype != ''"><![CDATA[AND inputtype = #{inputtype}]]></if>
<if test="type != null and type != ''"><![CDATA[AND type = #{type}]]></if>
<if test="required != null and required != ''"><![CDATA[AND required = #{required}]]></if>
<if test="status != null and status != ''"><![CDATA[AND status = #{status}]]></if>
<if test="ctime != null and ctime != ''"><![CDATA[AND ctime = #{ctime}]]></if>
<if test="utime != null and utime != ''"><![CDATA[AND utime = #{utime}]]></if>
</where>
</sql>
<sql id="QUERY_ORDER_LIMIT_CONDTION">
<if test="orderField != null and orderField != '' and orderType != null and orderType != ''"><![CDATA[ORDER BY ${orderField} ${orderType}]]></if>
<if test="startIndex != null and startIndex >= 0 and pageSize != null and pageSize > 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if>
</sql>
<!-- 查询,通过主键IN(array) -->
<select id="selectEntryArray" parameterType="java.lang.reflect.Array" resultType="attribute">
<![CDATA[ SELECT id AS attrId,name,alias,deal_type AS dealType,inputtype ,type,required,status,ctime,utime FROM attribute ]]>
<![CDATA[WHERE id IN]]>
<foreach collection="array" item="id" open="(" separator="," close=")">
<![CDATA[#{id}]]>
</foreach>
</select>
<select id="selectEntry" parameterType="long" resultType="attribute">
<![CDATA[SELECT id AS attrId,name,alias,deal_type AS dealType,inputtype ,type,required,status,ctime,utime FROM attribute WHERE id = #{id}]]>
</select>
<select id="selectAllEntry" resultType="attribute">
<![CDATA[SELECT id AS attrId,name,alias,deal_type AS dealType,inputtype ,type,required,status,ctime,utime FROM attribute]]>
</select>
<select id="selectEntryList" parameterType="attribute" resultType="attribute">
<![CDATA[SELECT id AS attrId,name,alias,deal_type AS dealType,inputtype,type,required,status,ctime,utime FROM attribute]]>
<include refid="QUERY_WHERE_CLAUSE" />
<include refid="QUERY_ORDER_LIMIT_CONDTION" />
</select>
<select id="selectEntryListCount" parameterType="attribute" resultType="int">
<![CDATA[SELECT COUNT(id) AS dataCount FROM attribute]]>
<include refid="QUERY_WHERE_CLAUSE" />
</select>
<select id="selectAttributeValue" parameterType="long" resultType="attributeValue">
<![CDATA[SELECT id AS valueId,attr_id AS attrId,value,`order`,`show`,status FROM attribute_value WHERE attr_id = #{attrId} order by `order`]]>
</select>
</mapper>