Browse Source

居民端-角色添加合并代码

master
sunyuchao 5 years ago
parent
commit
86f301314b
  1. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserRoleDTO.java
  2. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java
  3. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java
  4. 22
      epmet-user/epmet-user-server/src/main/resources/mapper/RoleDao.xml
  5. 27
      epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserRoleDTO.java

@ -54,6 +54,11 @@ public class UserRoleDTO implements Serializable {
*/
private String roleId;
/**
* 所属端App
*/
private String app;
/**
* 角色Key值
*/

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java

@ -43,6 +43,4 @@ public interface UserRoleDao extends BaseDao<UserRoleEntity> {
**/
List<UserRoleResultDTO> getUserRoleInfo(UserRoleFormDTO userRoleFormDTO);
boolean saveResiRole(UserRoleDTO userRoleDTO);
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java

@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.EpmetRoleKeyConstant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
@ -169,6 +170,7 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
*/
@Transactional(rollbackFor = Exception.class)
public void saveUserResiInfo(UserResiInfoDTO userResiInfoDTO) {
//1:注册信息表新增数据
Date date = new Date();
userResiInfoDTO.setId(IdWorker.get32UUID());
userResiInfoDTO.setDelFlag(NumConstant.ZERO);
@ -178,6 +180,13 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
userResiInfoDTO.setUpdatedBy(userResiInfoDTO.getUserId());
userResiInfoDTO.setUpdatedTime(date);
userResiInfoDao.saveUserResiInfo(userResiInfoDTO);
//2:角色表新增角色数据
UserRoleDTO userRoleDTO = new UserRoleDTO();
userRoleDTO.setCustomerId(userResiInfoDTO.getCustomerId());
userRoleDTO.setUserId(userResiInfoDTO.getUserId());
userRoleDTO.setApp(userResiInfoDTO.getApp());
userRoleDTO.setRoleKey(EpmetRoleKeyConstant.REGISTERED_RESI);
userRoleService.saveUserRole(userRoleDTO);
}
/**

22
epmet-user/epmet-user-server/src/main/resources/mapper/RoleDao.xml

@ -28,26 +28,4 @@
and DEL_FLAG = 0
</select>
<sql id="sql">
er.id AS "id",
er.app AS "app",
er.role_name AS "roleName",
er.role_key AS "roleKey",
er.del_flag AS "delflag",
er.revision AS "revision",
er.created_by AS "createdby",
er.created_time AS "createdtime",
er.updated_by AS "updatedby",
er.updated_time AS "updatedtime"
</sql>
<select id="selectRoleByKey" parameterType="com.epmet.dto.RoleDTO" resultType="com.epmet.dto.RoleDTO">
SELECT
<include refid="sql"></include>
FROM epmet_role er
WHERE er.del_flag = '0'
AND er.app = #{app}
AND er.role_key = #{roleKey}
</select>
</mapper>

27
epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml

@ -16,33 +16,6 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<insert id="saveResiRole" parameterType="com.epmet.dto.UserRoleDTO">
INSERT INTO user_role (
id,
customer_id,
user_id,
role_id,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
)VALUES(
#{id},
#{customerId},
#{userId},
#{roleId},
#{delFlag},
#{revision},
#{createdBy},
#{createdTime},
#{updatedBy},
#{updatedTime}
)
</insert>
<select id="getUserRoleInfo" parameterType="com.epmet.dto.form.UserRoleFormDTO"
resultType="com.epmet.dto.result.UserRoleResultDTO">

Loading…
Cancel
Save