zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?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="cn.autoform.web.mapper.businesscategoryedit.BusinessCategoryEditMapper" >
 
    <!-- 查询业务功能分类基本信息 -->
    <select id="getBusinessCategoryInfo" resultType="cn.autoform.bean.BusinessCategoryCusEntity">
        SELECT 
            TENANTID,
            BUSINESSCATEGORYID,
            INDUSTRYCATEGORYCODE,
            INDUSTRYSUBCATEGORYCODE,
            BUSINESSCATEGORYNAME,
            DESCRIPTION,
            ICONPATH,
            ESSENCE,
            VISIBLEPERMISSION,
            DELETEFLG,
            CREATEUSER,
            CREATEDATETIME,
            UPDATEUSER,
            UPDATEDATETIME
             
        FROM 
            BUSINESSCATEGORY
        WHERE 
            BUSINESSCATEGORYID = #{businessCategoryID}
        AND
            TENANTID = #{tenantID}  
        AND 
            DELETEFLG = "0"
    </select>
    
    <!-- 新增业务功能分类 -->
    <insert id="createBusinessCategory" parameterType="cn.autoform.bean.BusinessCategoryCusEntity">
        INSERT INTO
            BUSINESSCATEGORY 
            (
                BUSINESSCATEGORYID,
                TENANTID,
                INDUSTRYCATEGORYCODE,
                INDUSTRYSUBCATEGORYCODE,
                BUSINESSCATEGORYNAME,
                DESCRIPTION,
                ICONPATH,
                ESSENCE,
                VISIBLEPERMISSION,
                DELETEFLG,
                CREATEUSER,
                CREATEDATETIME,
                UPDATEUSER,
                UPDATEDATETIME
            )
            VALUES (
                #{businessCategoryID},
                #{tenantID},
                #{industryCategorycode},
                #{industrysubCategorycode},
                #{businessCategoryName},
                #{description},
                #{iconpath},
                #{essence},
                #{visiblepermission},
                '0',
                #{createUser},
                current_timestamp(),
                #{updateUser},
                current_timestamp()
            )
    </insert>
    
    <!-- 更新业务功能分类基本信息 -->
    <update id="saveBusinessCategory" parameterType="cn.autoform.bean.BusinessCategoryCusEntity">
        UPDATE BUSINESSCATEGORY
            SET 
                BUSINESSCATEGORYNAME = #{businessCategoryName},
                INDUSTRYCATEGORYCODE = #{industryCategorycode},
                INDUSTRYSUBCATEGORYCODE = #{industrysubCategorycode},
                DESCRIPTION = #{description},
                ICONPATH = #{iconpath},
                ESSENCE = #{essence},
                VISIBLEPERMISSION = #{visiblepermission},
                BUSINESSCATEGORYNAME = #{businessCategoryName},
                UPDATEUSER = #{updateUser}
            WHERE 
                BUSINESSCATEGORYID = #{businessCategoryID}
            AND
                TENANTID = #{tenantID}
    </update>
    
    <!-- 新增业务功能分类是新增一条默认的模板分类 -->
    <insert id="createDefaultTemplateCategory" parameterType="cn.autoform.db.entity.TemplateCategoryEntity">
        INSERT INTO
            TEMPLATECATEGORY 
            (
                TENANTID,
                BUSINESSCATEGORYID,
                TEMPLATECATEGORYID,
                TEMPLATECATEGORYNAME,
                DELETEFLG,
                CREATEUSER,
                CREATEDATETIME,
                UPDATEUSER,
                UPDATEDATETIME
            )
            VALUES (
                #{tenantID},
                #{businessCategoryID},
                #{templateCategoryID},
                #{templateCategoryName},
                '0',
                #{createUser},
                current_timestamp(),
                #{updateUser},
                current_timestamp()
            )
    </insert>
    
    <!-- check业务功能分类名称唯一 -->
    <select id="checkBusinessCategoryName" resultType="cn.autoform.bean.BusinessCategoryCusEntity">
        SELECT 
            BUSINESSCATEGORYID
        FROM 
            BUSINESSCATEGORY
        WHERE 
            TENANTID = #{tenantID}
        AND
            BUSINESSCATEGORYID != #{businessCategoryID}
        AND
            INDUSTRYCATEGORYCODE = #{industryCategorycode}
        AND
            INDUSTRYSUBCATEGORYCODE = #{industrysubCategorycode}
        AND
            BUSINESSCATEGORYNAME = #{businessCategoryName}  
        AND 
            DELETEFLG = "0"
    </select>
</mapper>