Ver código fonte

修改 海康权限组

魏熙美 6 anos atrás
pai
commit
4020dff0df

+ 32
- 0
CODE/foreign-service/src/main/java/com/community/huiju/dao/TpUnitHkSettingMapper.java Ver arquivo

@@ -0,0 +1,32 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.community.huiju.model.TpUnitHkSetting;
5
+import org.apache.ibatis.annotations.ResultMap;
6
+import org.apache.ibatis.annotations.ResultType;
7
+import org.apache.ibatis.annotations.Select;
8
+
9
+/**
10
+ * <p>
11
+ *  Mapper 接口
12
+ * </p>
13
+ *
14
+ * @author jobob
15
+ * @since 2019-06-18
16
+ */
17
+public interface TpUnitHkSettingMapper extends BaseMapper<TpUnitHkSetting> {
18
+
19
+
20
+
21
+    /**
22
+     * 根据 小区id 和 单元id
23
+     *
24
+     * @param communityId
25
+     * @param unitId
26
+     * @return
27
+     */
28
+    @ResultType(TpUnitHkSetting.class)
29
+    @Select("select * from tp_unit_hk_setting where community_id = #{communityId} and unit_id = #{unitId}")
30
+    TpUnitHkSetting selectByCommunityIdAndUnitId(Integer communityId, Integer unitId);
31
+
32
+}

+ 2
- 1
CODE/foreign-service/src/main/java/com/community/huiju/enums/ResponseErrorsMessages.java Ver arquivo

@@ -34,7 +34,8 @@ public enum ResponseErrorsMessages {
34 34
     SIGN_ERROR(1022, "签名错误!"),
35 35
     SIGN_DATETIME_ERROR(1023, "签名已过期!"),
36 36
     SIGN_ENCRYPT_MD5_ERROR(1024, "未使用md5加密方式加密!"),
37
-    NOT_EQUIPMENT(1025, "系统设备未设置!")
37
+    NOT_EQUIPMENT(1025, "系统设备未设置!"),
38
+    NOT_PERMISSIONS_SET(1025, "权限组未配置!")
38 39
     ;
39 40
 
40 41
 

+ 49
- 0
CODE/foreign-service/src/main/java/com/community/huiju/model/TpUnitHkSetting.java Ver arquivo

@@ -0,0 +1,49 @@
1
+package com.community.huiju.model;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+import java.io.Serializable;
11
+
12
+/**
13
+ * <p>
14
+ * 
15
+ * </p>
16
+ *
17
+ * @author jobob
18
+ * @since 2019-06-18
19
+ */
20
+@Data
21
+@EqualsAndHashCode(callSuper = false)
22
+@Accessors(chain = true)
23
+@TableName("tp_unit_hk_setting")
24
+public class TpUnitHkSetting implements Serializable {
25
+
26
+    private static final long serialVersionUID = 1L;
27
+
28
+    @TableId(value = "id", type = IdType.AUTO)
29
+    private Integer id;
30
+
31
+    /**
32
+     * 小区id
33
+     */
34
+    private Integer communityId;
35
+
36
+    /**
37
+     * 单元ID
38
+     */
39
+    private Integer unitId;
40
+
41
+    /**
42
+     * 海康权限ID
43
+     */
44
+    private String permissionId;
45
+
46
+    private String departmentId;
47
+
48
+
49
+}

+ 16
- 0
CODE/foreign-service/src/main/java/com/community/huiju/service/ITpUnitHkSettingService.java Ver arquivo

@@ -0,0 +1,16 @@
1
+package com.community.huiju.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.community.huiju.model.TpUnitHkSetting;
5
+
6
+/**
7
+ * <p>
8
+ *  服务类
9
+ * </p>
10
+ *
11
+ * @author jobob
12
+ * @since 2019-06-18
13
+ */
14
+public interface ITpUnitHkSettingService extends IService<TpUnitHkSetting> {
15
+
16
+}

+ 32
- 12
CODE/foreign-service/src/main/java/com/community/huiju/service/impl/HKServiceImpl.java Ver arquivo

@@ -7,6 +7,7 @@ import com.community.commom.mode.ResponseBean;
7 7
 import com.community.commom.uuid.IdGen;
8 8
 import com.community.commom.hk.HKOpenApi;
9 9
 import com.community.huiju.dao.*;
10
+import com.community.huiju.enums.ResponseErrorsMessages;
10 11
 import com.community.huiju.exception.WisdomException;
11 12
 import com.community.huiju.model.*;
12 13
 import com.community.huiju.service.IHKService;
@@ -56,6 +57,9 @@ public class HKServiceImpl implements IHKService {
56 57
 //    @Autowired
57 58
 //    private TaRemotelyDoorMapper taRemotelyDoorMapper;
58 59
 
60
+    @Autowired
61
+    private TpUnitHkSettingMapper tpUnitHkSettingMapper;
62
+
59 63
     /**
60 64
      * 获取设备UUID
61 65
      * @param equipmentList
@@ -89,6 +93,9 @@ public class HKServiceImpl implements IHKService {
89 93
             taUserHk = new TaUserHk();
90 94
         }
91 95
 
96
+        // 海康权限信息
97
+        TpUnitHkSetting unitHkSetting = getUnitHkSetting(userVerify.getCommunityId(), userVerify.getUnitId());
98
+
92 99
         // 这两个值一般都是同时存在的
93 100
         // 当这两个值不存在的时候,就添加海康人员
94 101
         if (null == taUserHk.getHkUserId() && null == taUserHk.getHkPersonNo()) {
@@ -99,7 +106,7 @@ public class HKServiceImpl implements IHKService {
99 106
              * 2.根据部门编号推送 海康
100 107
              */
101 108
             taUserMapper.updateById(user);
102
-            addUserAndOpenCard(responseBean, user, tpEquipmentTree, taUserHk);
109
+            addUserAndOpenCard(responseBean, user, tpEquipmentTree, taUserHk, unitHkSetting);
103 110
         }
104 111
 
105 112
         // 卡片操作
@@ -157,7 +164,8 @@ public class HKServiceImpl implements IHKService {
157 164
         //--------- 可视对讲 ----------
158 165
 
159 166
         Map<String,Object> addOutDoorAuthMap = Maps.newHashMap();
160
-        addOutDoorAuthMap.put("authName", "app用户权限勿动");
167
+        // app用户权限勿动
168
+        addOutDoorAuthMap.put("authName", unitHkSetting.getPermissionId());
161 169
         addOutDoorAuthMap.put("personIds", Arrays.asList(taUserHk.getHkUserId()));
162 170
         addOutDoorAuthMap.put("secret", tpEquipmentTree.getSecret());
163 171
         addOutDoorAuthMap.put("appkey", tpEquipmentTree.getAppkey());
@@ -198,15 +206,15 @@ public class HKServiceImpl implements IHKService {
198 206
      * @param response
199 207
      * @param user
200 208
      */
201
-    private void addUserAndOpenCard(ResponseBean response, TaUser user, TpEquipmentTree tpEquipmentTree, TaUserHk taUserHk) {
202
-        Map<String, Object> parDept = Maps.newHashMap();
203
-        parDept.put("pageNo", 1);
204
-        parDept.put("pageSize", 100);
205
-        parDept.put("deptName", Constant.DEPT_RESIDENTS);
206
-        parDept.put("openapi_ip_port_http", tpEquipmentTree.getHttpServer());
207
-        parDept.put("appkey", tpEquipmentTree.getAppkey());
208
-        parDept.put("secret", tpEquipmentTree.getSecret());
209
-        parDept.put("opUserUuid", tpEquipmentTree.getOpUserUuid());
209
+    private void addUserAndOpenCard(ResponseBean response, TaUser user, TpEquipmentTree tpEquipmentTree, TaUserHk taUserHk, TpUnitHkSetting unitHkSetting) {
210
+//        Map<String, Object> parDept = Maps.newHashMap();
211
+//        parDept.put("pageNo", 1);
212
+//        parDept.put("pageSize", 100);
213
+//        parDept.put("deptName", Constant.DEPT_RESIDENTS);
214
+//        parDept.put("openapi_ip_port_http", tpEquipmentTree.getHttpServer());
215
+//        parDept.put("appkey", tpEquipmentTree.getAppkey());
216
+//        parDept.put("secret", tpEquipmentTree.getSecret());
217
+//        parDept.put("opUserUuid", tpEquipmentTree.getOpUserUuid());
210 218
         // 部门UUID
211 219
         //String deptUuid = getDeptUUID(parDept);
212 220
 
@@ -215,7 +223,7 @@ public class HKServiceImpl implements IHKService {
215 223
         parUser.put("personNo", taUserHk.getHkPersonNo());
216 224
         parUser.put("personName", user.getUserName());
217 225
         // parUser.put("phoneNo", user.getLoginName());
218
-        //parUser.put("deptUuid", deptUuid);
226
+        parUser.put("deptUuid", unitHkSetting.getDepartmentId());
219 227
         parUser.put("remark", user.getLoginName());
220 228
         parUser.put("secret", tpEquipmentTree.getSecret());
221 229
         parUser.put("appkey", tpEquipmentTree.getAppkey());
@@ -365,6 +373,18 @@ public class HKServiceImpl implements IHKService {
365 373
         return deptUuid;
366 374
     }
367 375
 
376
+    /**
377
+     * 海康权限组
378
+     * @return
379
+     */
380
+    private TpUnitHkSetting getUnitHkSetting(Integer communityId, Integer unitId) {
381
+        TpUnitHkSetting tpUnitHkSetting = tpUnitHkSettingMapper.selectByCommunityIdAndUnitId(communityId, unitId);
382
+        if (null == tpUnitHkSetting) {
383
+            throw new WisdomException(ResponseErrorsMessages.NOT_PERMISSIONS_SET.getCode(), ResponseErrorsMessages.NOT_PERMISSIONS_SET.getMsg());
384
+        }
385
+        return tpUnitHkSetting;
386
+    }
387
+
368 388
     /**
369 389
      * 可视对讲下发 权限
370 390
      *

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java Ver arquivo

@@ -63,7 +63,7 @@ public class UserController extends BaseController {
63 63
     @RequestMapping(value = "/user/register",method = RequestMethod.POST)
64 64
     public ResponseBean register(@RequestBody String parameter) {
65 65
         ResponseBean responseBean = new ResponseBean();
66
-        responseBean = iTaUserService.register(parameter);
66
+        responseBean = iTaUserService.register(parameter, true);
67 67
         return responseBean;
68 68
     }
69 69
 

+ 32
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpUnitHkSettingMapper.java Ver arquivo

@@ -0,0 +1,32 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TpUnitHkSetting;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.ResultMap;
6
+import org.apache.ibatis.annotations.Select;
7
+
8
+@Mapper
9
+public interface TpUnitHkSettingMapper {
10
+    int deleteByPrimaryKey(Integer id);
11
+
12
+    int insert(TpUnitHkSetting record);
13
+
14
+    int insertSelective(TpUnitHkSetting record);
15
+
16
+    TpUnitHkSetting selectByPrimaryKey(Integer id);
17
+
18
+    int updateByPrimaryKeySelective(TpUnitHkSetting record);
19
+
20
+    int updateByPrimaryKey(TpUnitHkSetting record);
21
+
22
+    /**
23
+     * 根据 小区id 和 单元id
24
+     *
25
+     * @param communityId
26
+     * @param unitId
27
+     * @return
28
+     */
29
+    @ResultMap("BaseResultMap")
30
+    @Select("select * from tp_unit_hk_setting where community_id = #{communityId} and unit_id = #{unitId}")
31
+    TpUnitHkSetting selectByCommunityIdAndUnitId(Integer communityId, Integer unitId);
32
+}

+ 53
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpUnitHkSetting.java Ver arquivo

@@ -0,0 +1,53 @@
1
+package com.community.huiju.model;
2
+
3
+public class TpUnitHkSetting {
4
+    private Integer id;
5
+
6
+    private Integer communityId;
7
+
8
+    private Integer unitId;
9
+
10
+    private String permissionId;
11
+
12
+    private String departmentId;
13
+
14
+    public Integer getId() {
15
+        return id;
16
+    }
17
+
18
+    public void setId(Integer id) {
19
+        this.id = id;
20
+    }
21
+
22
+    public Integer getCommunityId() {
23
+        return communityId;
24
+    }
25
+
26
+    public void setCommunityId(Integer communityId) {
27
+        this.communityId = communityId;
28
+    }
29
+
30
+    public Integer getUnitId() {
31
+        return unitId;
32
+    }
33
+
34
+    public void setUnitId(Integer unitId) {
35
+        this.unitId = unitId;
36
+    }
37
+
38
+    public String getPermissionId() {
39
+        return permissionId;
40
+    }
41
+
42
+    public void setPermissionId(String permissionId) {
43
+        this.permissionId = permissionId == null ? null : permissionId.trim();
44
+    }
45
+
46
+    public String getDepartmentId() {
47
+        return departmentId;
48
+    }
49
+
50
+    public void setDepartmentId(String departmentId) {
51
+        this.departmentId = departmentId == null ? null : departmentId.trim();
52
+    }
53
+}

+ 2
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITaUserService.java Ver arquivo

@@ -57,9 +57,10 @@ public interface ITaUserService {
57 57
      * 注册用户
58 58
      *
59 59
      * @param parameter
60
+     * @param isIdCart true 开启身份证校验
60 61
      * @return
61 62
      */
62
-    ResponseBean register(String parameter);
63
+    ResponseBean register(String parameter, boolean isIdCart);
63 64
 
64 65
     /**
65 66
      * 检验登录房产

+ 31
- 12
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/HKServiceImpl.java Ver arquivo

@@ -34,6 +34,9 @@ import java.util.stream.Collectors;
34 34
 @Slf4j
35 35
 public class HKServiceImpl implements IHKService {
36 36
 
37
+    @Autowired
38
+    private TpUnitHkSettingMapper tpUnitHkSettingMapper;
39
+
37 40
     @Autowired
38 41
     private TaUserMapper taUserMapper;
39 42
 
@@ -89,6 +92,9 @@ public class HKServiceImpl implements IHKService {
89 92
             taUserHk = new TaUserHk();
90 93
         }
91 94
 
95
+        // 海康权限信息
96
+        TpUnitHkSetting unitHkSetting = getUnitHkSetting(userVerify.getCommunityId(), userVerify.getUnitId());
97
+
92 98
         TpEquipmentTree tpEquipmentTree = tpEquipmentTreeMapper.selectByCommunityId(userVerify.getCommunityId());
93 99
 
94 100
         // 这两个值一般都是同时存在的
@@ -101,7 +107,7 @@ public class HKServiceImpl implements IHKService {
101 107
              * 2.根据部门编号推送 海康
102 108
              */
103 109
             taUserMapper.updateByPrimaryKeySelective(user);
104
-            addUserAndOpenCard(responseBean, user, tpEquipmentTree, taUserHk);
110
+            addUserAndOpenCard(responseBean, user, tpEquipmentTree, taUserHk, unitHkSetting);
105 111
         }
106 112
 
107 113
         // 卡片操作
@@ -161,7 +167,8 @@ public class HKServiceImpl implements IHKService {
161 167
         //--------- 可视对讲 ----------
162 168
 
163 169
         Map<String,Object> addOutDoorAuthMap = Maps.newHashMap();
164
-        addOutDoorAuthMap.put("authName", "app用户权限勿动");
170
+        // app用户权限勿动
171
+        addOutDoorAuthMap.put("authName", unitHkSetting.getPermissionId());
165 172
         addOutDoorAuthMap.put("personIds", Arrays.asList(taUserHk.getHkUserId()));
166 173
         addOutDoorAuthMap.put("secret", tpEquipmentTree.getSecret());
167 174
         addOutDoorAuthMap.put("appkey", tpEquipmentTree.getAppkey());
@@ -202,15 +209,15 @@ public class HKServiceImpl implements IHKService {
202 209
      * @param response
203 210
      * @param user
204 211
      */
205
-    private void addUserAndOpenCard(ResponseBean response, TaUser user, TpEquipmentTree tpEquipmentTree, TaUserHk taUserHk) {
206
-        Map<String, Object> parDept = Maps.newHashMap();
207
-        parDept.put("pageNo", 1);
208
-        parDept.put("pageSize", 100);
209
-        parDept.put("deptName", Constant.DEPT_RESIDENTS);
210
-        parDept.put("openapi_ip_port_http", tpEquipmentTree.getHttpServer());
211
-        parDept.put("appkey", tpEquipmentTree.getAppkey());
212
-        parDept.put("secret", tpEquipmentTree.getSecret());
213
-        parDept.put("opUserUuid", tpEquipmentTree.getOpUserUuid());
212
+    private void addUserAndOpenCard(ResponseBean response, TaUser user, TpEquipmentTree tpEquipmentTree, TaUserHk taUserHk, TpUnitHkSetting unitHkSetting) {
213
+//        Map<String, Object> parDept = Maps.newHashMap();
214
+//        parDept.put("pageNo", 1);
215
+//        parDept.put("pageSize", 100);
216
+//        parDept.put("deptName", Constant.DEPT_RESIDENTS);
217
+//        parDept.put("openapi_ip_port_http", tpEquipmentTree.getHttpServer());
218
+//        parDept.put("appkey", tpEquipmentTree.getAppkey());
219
+//        parDept.put("secret", tpEquipmentTree.getSecret());
220
+//        parDept.put("opUserUuid", tpEquipmentTree.getOpUserUuid());
214 221
         // 部门UUID
215 222
         //String deptUuid = getDeptUUID(parDept);
216 223
 
@@ -220,7 +227,7 @@ public class HKServiceImpl implements IHKService {
220 227
         parUser.put("personName", user.getUserName());
221 228
         // parUser.put("phoneNo", user.getLoginName());
222 229
         parUser.put("remark", user.getLoginName());
223
-        //parUser.put("deptUuid", deptUuid);
230
+        parUser.put("deptUuid", unitHkSetting.getDepartmentId());
224 231
         parUser.put("secret", tpEquipmentTree.getSecret());
225 232
         parUser.put("appkey", tpEquipmentTree.getAppkey());
226 233
         parUser.put("openapi_ip_port_http", tpEquipmentTree.getHttpServer());
@@ -364,6 +371,18 @@ public class HKServiceImpl implements IHKService {
364 371
         return deptUuid;
365 372
     }
366 373
 
374
+    /**
375
+     * 海康权限组
376
+     * @return
377
+     */
378
+    private TpUnitHkSetting getUnitHkSetting(Integer communityId, Integer unitId) {
379
+        TpUnitHkSetting tpUnitHkSetting = tpUnitHkSettingMapper.selectByCommunityIdAndUnitId(communityId, unitId);
380
+        if (null == tpUnitHkSetting) {
381
+            throw new WisdomException("权限组未配置");
382
+        }
383
+        return tpUnitHkSetting;
384
+    }
385
+
367 386
     /**
368 387
      * 可视对讲下发 权限
369 388
      *

+ 8
- 5
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java Ver arquivo

@@ -195,7 +195,7 @@ public class TaUserServiceImpl implements ITaUserService {
195 195
 
196 196
     @Transactional(rollbackFor = Exception.class)
197 197
     @Override
198
-    public ResponseBean register(String parameter) {
198
+    public ResponseBean register(String parameter, boolean isIdCart) {
199 199
         ResponseBean<TaUser> response = new ResponseBean();
200 200
 
201 201
         JSONObject jsonObject = JSONObject.parseObject(parameter);
@@ -215,8 +215,11 @@ public class TaUserServiceImpl implements ITaUserService {
215 215
             iCode.checkPhoneAndCode(user.getLoginName(), code);
216 216
         }
217 217
 
218
-        // 校验身份证
219
-        this.checkIdCart(user);
218
+        if (isIdCart) {
219
+            // 校验身份证
220
+            this.checkIdCart(user);
221
+        }
222
+
220 223
 
221 224
         // 开始注册
222 225
         user.setCreateDate(new Date());
@@ -515,10 +518,10 @@ public class TaUserServiceImpl implements ITaUserService {
515 518
         TaUser user = jsonObject.toJavaObject(TaUser.class);
516 519
 
517 520
         // 校验身份证
518
-        this.checkIdCart(user);
521
+        // this.checkIdCart(user);
519 522
 
520 523
         // 调用注册接口
521
-        response = register(parameter);
524
+        response = register(parameter, false);
522 525
         // 返回值 code 为 1,表示已经注册
523 526
         if ("1".equals(response.getCode())) {
524 527
             // 用户数据查询出来

+ 93
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpUnitHkSettingMapper.xml Ver arquivo

@@ -0,0 +1,93 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.community.huiju.dao.TpUnitHkSettingMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TpUnitHkSetting" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="unit_id" property="unitId" jdbcType="INTEGER" />
8
+    <result column="permission_id" property="permissionId" jdbcType="VARCHAR" />
9
+    <result column="department_id" property="departmentId" jdbcType="VARCHAR" />
10
+  </resultMap>
11
+  <sql id="Base_Column_List" >
12
+    id, community_id, unit_id, permission_id, department_id
13
+  </sql>
14
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
15
+    select 
16
+    <include refid="Base_Column_List" />
17
+    from tp_unit_hk_setting
18
+    where id = #{id,jdbcType=INTEGER}
19
+  </select>
20
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
21
+    delete from tp_unit_hk_setting
22
+    where id = #{id,jdbcType=INTEGER}
23
+  </delete>
24
+  <insert id="insert" parameterType="com.community.huiju.model.TpUnitHkSetting" >
25
+    insert into tp_unit_hk_setting (id, community_id, unit_id, 
26
+      permission_id, department_id)
27
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{unitId,jdbcType=INTEGER}, 
28
+      #{permissionId,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR})
29
+  </insert>
30
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TpUnitHkSetting" >
31
+    insert into tp_unit_hk_setting
32
+    <trim prefix="(" suffix=")" suffixOverrides="," >
33
+      <if test="id != null" >
34
+        id,
35
+      </if>
36
+      <if test="communityId != null" >
37
+        community_id,
38
+      </if>
39
+      <if test="unitId != null" >
40
+        unit_id,
41
+      </if>
42
+      <if test="permissionId != null" >
43
+        permission_id,
44
+      </if>
45
+      <if test="departmentId != null" >
46
+        department_id,
47
+      </if>
48
+    </trim>
49
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
50
+      <if test="id != null" >
51
+        #{id,jdbcType=INTEGER},
52
+      </if>
53
+      <if test="communityId != null" >
54
+        #{communityId,jdbcType=INTEGER},
55
+      </if>
56
+      <if test="unitId != null" >
57
+        #{unitId,jdbcType=INTEGER},
58
+      </if>
59
+      <if test="permissionId != null" >
60
+        #{permissionId,jdbcType=VARCHAR},
61
+      </if>
62
+      <if test="departmentId != null" >
63
+        #{departmentId,jdbcType=VARCHAR},
64
+      </if>
65
+    </trim>
66
+  </insert>
67
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpUnitHkSetting" >
68
+    update tp_unit_hk_setting
69
+    <set >
70
+      <if test="communityId != null" >
71
+        community_id = #{communityId,jdbcType=INTEGER},
72
+      </if>
73
+      <if test="unitId != null" >
74
+        unit_id = #{unitId,jdbcType=INTEGER},
75
+      </if>
76
+      <if test="permissionId != null" >
77
+        permission_id = #{permissionId,jdbcType=VARCHAR},
78
+      </if>
79
+      <if test="departmentId != null" >
80
+        department_id = #{departmentId,jdbcType=VARCHAR},
81
+      </if>
82
+    </set>
83
+    where id = #{id,jdbcType=INTEGER}
84
+  </update>
85
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpUnitHkSetting" >
86
+    update tp_unit_hk_setting
87
+    set community_id = #{communityId,jdbcType=INTEGER},
88
+      unit_id = #{unitId,jdbcType=INTEGER},
89
+      permission_id = #{permissionId,jdbcType=VARCHAR},
90
+      department_id = #{departmentId,jdbcType=VARCHAR}
91
+    where id = #{id,jdbcType=INTEGER}
92
+  </update>
93
+</mapper>