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.tenant.mapper.tenant.system.math.SystemMathMapper">
4
5     <sql id="systemMathFiled">
6         a.id aId, a.name aName, a.count aCount , a.view aView, a.type aType
7         , a.result_fromat aResult, a.group_id aGroup
8     </sql>
9
10     <sql id="systemMathParamFiled">
11         b.id bId, b.math_id bMath, b.md_code bMdCode, b.me_code bMeCode, b.join_math_id bJoin
12         , b.def_val bDef, b.p_type bPType, b.p_index bIndex, b.md_name bMdName, b.me_name bMeName
13     </sql>
14
15     <resultMap type="com.changhong.epc.bean.count.system.SystemMathExtend" id="systemMathExtendMap">
16         <id property="id" column="aId"/>
17         <result property="name" column="aName"/>
18         <result property="count" column="aCount"/>
19         <result property="view" column="aView"/>
20         <result property="type" column="aType"/>
21         <result property="resultFromat" column="aResult"/>
22         <result property="groupId" column="aGroup"/>
23         <collection property="systemMathParam" ofType="com.changhong.epc.bean.count.system.SystemMathParam">
24             <id property="id" column="bId"/>
25             <result property="mathId" column="bMath"/>
26             <result property="mdCode" column="bMdCode"/>
27             <result property="meCode" column="bMeCode"/>
28             <result property="joinMathId" column="bJoin"/>
29             <result property="defVal" column="bDef"/>
30             <result property="pType" column="bPType"/>
31             <result property="pIndex" column="bIndex"/>
32             <result property="mdName" column="bMdName"/>
33             <result property="meName" column="bMeName"/>
34         </collection>
35     </resultMap>
36
37     <resultMap type="com.changhong.epc.bean.count.system.SystemMath" id="systemMathNameMap">
38         <id property="id" column="aId"/>
39         <result property="name" column="aName"/>
40     </resultMap>
41
42     <select id="selectSystemMathNameList" resultMap="systemMathNameMap">
43         select
44             a.id aId, a.name aName
45         from
46             epc_system_math_{rule}   a
47     </select>
48
49     <select id="selectAllSystemMathExtend" resultMap="systemMathExtendMap">
50         select
51         <include refid="systemMathFiled"/>,
52         <include refid="systemMathParamFiled"/>
53         FROM
54         epc_system_math_{rule} a
55         LEFT JOIN epc_system_math_param_{rule} b ON b.math_id = a.id
56         ORDER BY a.id DESC, b.p_index
57     </select>
58
59     <insert id="save" parameterType="com.changhong.epc.bean.count.system.SystemMathExtend"
60             useGeneratedKeys="true" keyProperty="sys.id">
61         insert into epc_system_math_{rule}  (id,name,count,view,type,result_fromat,group_id,data_start,ins_p,ins_t,upd_p,upd_t)
62         values
63         (null,#{sys.name},#{sys.count},#{sys.view},#{sys.type},#{sys.resultFromat},#{sys.groupId},#{sys.dataStart},#{sys.insP},#{sys.insT},#{sys.updP},#{sys.updT})
64     </insert>
65
66     <select id="getCostTypeByFormId" resultType="map">
67
68         select f_name,type from epc_cost_from_mapping_${tenantId}_${companyId}
69         where f_id = #{formId}
70         and ct_id =
71         (select C_type from formdata_${tenantId}_${formId} where datarownum = #{dataRowNum} limit 1)
72         limit 1
73     </select>
74
75 </mapper>