zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
commit | author | age
a18bfa 1 <?xml version="1.0" encoding="UTF-8" ?>
Z 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3 <mapper namespace="com.changhong.epc.form.mapper.tenant.log.OperationLogMapper">
4     <resultMap type="com.changhong.epc.rely.api.bean.report.OperationLog" id="resultLog">
5         <id property="id" column="id"/>
6         <result property="tenantId" column="tenant_id"/>
7         <result property="tenantName" column="tenant_name"/>
8         <result property="companyId" column="company_id"/>
9         <result property="companyName" column="company_name"/>
10         <result property="modulesName" column="modules_name"/>
11         <result property="costType" column="cost_type"/>
12         <result property="formId" column="form_id"/>
13         <result property="formNum" column="form_num"/>
14         <result property="formName" column="form_name"/>
15         <result property="operation" column="operation"/>
16         <result property="time" column="operation_time"/>
17         <result property="openId" column="open_name"/>
18     </resultMap>
19
20     <insert id="addOperationLog" parameterType="com.changhong.epc.rely.api.bean.report.OperationLog">
21     INSERT INTO epc_operation_log
22            (
23             tenant_id,
24             tenant_name,
25             company_id,
26             company_name,
27             modules_name,
28             cost_type,
29             form_id,
30             form_num,
31             form_name,
32             operation,
33             operation_time,
34             open_name
35             )
36         VALUES
37            (#{tenantId},
38             #{tenantName},
39             #{companyId},
40             #{companyName},
41             #{modulesName},
42             #{costType},
43             #{formId},
44             #{formNum},
45             #{formName},
46             #{operation},
47             CURRENT_TIMESTAMP(),
48             #{openId})
49
50     </insert>
51
52     <select id="selectNum" resultMap="resultLog">
53         select
54         count(0)
55         from epc_operation_log
56         <where>
57             <if test="operationLog.tenantName != null and operationLog.tenantName != ''">
58                 AND tenant_name like CONCAT('%',#{operationLog.tenantName},'%')
59             </if>
60             <if test="operationLog.companyName != null and operationLog.companyName != ''">
61                 AND company_name like CONCAT('%',#{operationLog.companyName},'%')
62             </if>
63             <if test="operationLog.formId != null and operationLog.formId != ''">
64                 AND form_id = #{operationLog.formId}
65             </if>
66             <if test="operationLog.formName != null and operationLog.formName != ''">
67                 AND form_name = #{operationLog.formName}
68             </if>
69             <if test="operationLog.beginTime != null ">
70                 AND DATE_FORMAT(operation_time,'%Y-%m-%d %h:%i:%s') &gt;=
71                 DATE_FORMAT(#{operationLog.beginTime},'%Y-%m-%d %h:%i:%s')
72             </if>
73             <if test="operationLog.endTime != null ">
74                 AND DATE_FORMAT(operation_time,'%Y-%m-%d %h:%i:%s') &lt;= DATE_FORMAT(#{operationLog.endTime},'%Y-%m-%d
75                 %h:%i:%s')
76             </if>
77         </where>
78     </select>
79     <select id="select" resultMap="resultLog">
80         select
81         tenant_id,tenant_name,company_id,company_name,modules_name,cost_type,form_id,form_num,operation,operation_time,open_name
82         from epc_operation_log
83         <where>
84             <if test="operationLog.tenantName != null and operationLog.tenantName != ''">
85                 AND tenant_name like CONCAT('%',#{operationLog.tenantName},'%')
86             </if>
87             <if test="operationLog.companyName != null and operationLog.companyName != ''">
88                 AND company_name like CONCAT('%',#{operationLog.companyName},'%')
89             </if>
90             <if test="operationLog.formId != null and operationLog.formId != ''">
91                 AND form_id = #{operationLog.formId}
92             </if>
93             <if test="operationLog.formName != null and operationLog.formName != ''">
94                 AND form_name = #{operationLog.formName}
95             </if>
96             <if test="operationLog.beginTime != null ">
97                 AND DATE_FORMAT(operation_time,'%Y-%m-%d %h:%i:%s') &gt;=
98                 DATE_FORMAT(#{operationLog.beginTime},'%Y-%m-%d %h:%i:%s')
99             </if>
100             <if test="operationLog.endTime != null ">
101                 AND DATE_FORMAT(operation_time,'%Y-%m-%d %h:%i:%s') &lt;= DATE_FORMAT(#{operationLog.endTime},'%Y-%m-%d
102                 %h:%i:%s')
103             </if>
104         </where>
105         limit ${pageStart},${pageSize}
106     </select>
107
108     <select id="getSQFormNum" resultType="string">
109         select number_apply
110         from ${tableName}
111         where datarownum = #{num}
112     </select>
113
114     <select id="getBQFormNum" resultType="string">
115          select number_expend
116         from ${tableName}
117         where datarownum = #{num}
118     </select>
119
120     <select id="costName" resultType="string">
121         select node_name from epc_cost_type_${tenantId}_${companyId}
122           where id =
123           (select C_type from formdata_${tenantId}_${formId} where datarownum = #{dataRowNum})
124           limit 1
125     </select>
126
127 </mapper>