FormMapper.xml
3.71 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?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.api.formmode.mybatis.mapper.FormMapper">
<resultMap id="selectResultMap" type="com.api.formmode.mybatis.bean.SelectItemBean">
<id property="key" column="selectValue" />
<result property="title" column="selectName" />
<result property="value" column="selectValue" />
</resultMap>
<select id="getSelectItems" resultMap="selectResultMap" >
select selectName ,selectValue
from workflow_selectItem
where fieldId = #{fieldId}
order by selectValue asc
</select>
<select id="getDetailTables" resultType="com.api.formmode.mybatis.bean.DetailTableBean">
select id, billId,
tableName, title, orderId
from workflow_billdetailtable
where billId = #{billId}
order by orderId asc
</select>
<select id="getFieldSelects" resultType="com.api.formmode.mybatis.bean.FieldBean">
select a.id fieldId, a.fieldDbType, a.fieldName, a.fieldLabel,
a.detailTable
from workflow_billfield a
where a.billid = #{formId}
<if test=" viewType !=null and viewType != '' ">
and a.viewType = #{viewType}
</if>
<if test=" detailTable!=null and detailTable != '' ">
and a.detailTable = #{detailTable}
</if>
<if test="fieldHtmlType != null and fieldHtmlType != '' ">
and a.FIELDHTMLTYPE = #{fieldHtmlType}
</if>
<if test="type != null and type != '' ">
and a.type = #{type}
</if>
</select>
<delete id="deleteData">
delete from ${tableName} where ${field} = #{value}
</delete>
<insert id="addRow">
insert into ${tableName}
<foreach collection="sets" item="set" index="ni" open="(" separator="," close=")">
${set.name}
</foreach>
values
<foreach collection="sets" item="set" index="vi" open="(" separator="," close=")">
#{set.value}
</foreach>
</insert>
<insert id="addData" databaseId="sqlserver">
insert into ${tableName}
<foreach collection="columns" item="col" index="ci" open="(" separator="," close=")">
${col}
</foreach>
values
<foreach collection="datas" item="row" index="ri" open="" separator="," close="">
<foreach collection="row" item="data" index="di" open="(" separator="," close=")">
#{data}
</foreach>
</foreach>
</insert>
<insert id="addData" databaseId="mysql">
insert into ${tableName}
<foreach collection="columns" item="col" index="ci" open="(" separator="," close=")">
${col}
</foreach>
values
<foreach collection="datas" item="row" index="ri" open="" separator="," close="">
<foreach collection="row" item="data" index="di" open="(" separator="," close=")">
#{data}
</foreach>
</foreach>
</insert>
<insert id="addData" databaseId="oracle">
insert into ${tableName}
<foreach collection="columns" item="col" index="ci" open="(" separator="," close=")">
${col}
</foreach>
<foreach collection="datas" item="row" index="ri" open="select * from (" separator="union all" close=") t">
<foreach collection="row" item="data" index="di" open="select" separator="," close="from dual">
#{data}
</foreach>
</foreach>
</insert>
<select id="getHrmResourceFields" resultType="com.api.formmode.mybatis.bean.FieldBean">
select a.id fieldId, a.fieldLabel
from workflow_billfield a
where a.fieldhtmltype = '3'
and a.type in ('1','17')
and a.billid = #{formId}
</select>
<select id="getModeCount" resultType="com.api.formmode.mybatis.bean.CountBean">
select count(id) count from (
select id from modeinfo where formid = #{formid}
union all select id from mode_customsearch where formid = #{formid}
union all select id from mode_report where formid = #{formid}
union all select id from mode_custombrowser where formid = #{formid}) t
</select>
</mapper>