提交 a9562a28 编写于 作者: wenlei.liao's avatar wenlei.liao

机构SaaS角色修改

上级 5f62dbe3
流水线 #42819 已失败 于阶段
...@@ -25,7 +25,7 @@ public class HospitalSaasRoleController extends AccountBaseController { ...@@ -25,7 +25,7 @@ public class HospitalSaasRoleController extends AccountBaseController {
@ApiOperation("机构saas角色-新增或更新") @ApiOperation("机构saas角色-新增或更新")
@PostMapping(value = "/hospital/role/insertAndModify") @PostMapping(value = "/hospital/role/insertAndModify")
@EnabledLoginValidate @EnabledLoginValidate
public PicaResponse<Integer> insertAndModify(HospitalRoleDetailReq req) { public PicaResponse<Integer> insertAndModify(@RequestBody HospitalRoleDetailReq req) {
return PicaResponse.toResponse(hospitalSaasRoleService.insertAndModify(req, getPicaUser())); return PicaResponse.toResponse(hospitalSaasRoleService.insertAndModify(req, getPicaUser()));
} }
......
...@@ -9,6 +9,8 @@ public class PermissionRole { ...@@ -9,6 +9,8 @@ public class PermissionRole {
private String roleName; private String roleName;
private String remark;
private Integer deleteFlag; private Integer deleteFlag;
private Long createdId; private Long createdId;
...@@ -82,4 +84,12 @@ public class PermissionRole { ...@@ -82,4 +84,12 @@ public class PermissionRole {
public void setModifiedTime(Date modifiedTime) { public void setModifiedTime(Date modifiedTime) {
this.modifiedTime = modifiedTime; this.modifiedTime = modifiedTime;
} }
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
} }
\ No newline at end of file
...@@ -13,6 +13,7 @@ import com.pica.cloud.account.account.server.resp.RoleDto; ...@@ -13,6 +13,7 @@ import com.pica.cloud.account.account.server.resp.RoleDto;
import com.pica.cloud.account.account.server.service.HospitalSaasRoleService; import com.pica.cloud.account.account.server.service.HospitalSaasRoleService;
import com.pica.cloud.account.account.server.util.captcha.CommonUtils; import com.pica.cloud.account.account.server.util.captcha.CommonUtils;
import com.pica.cloud.foundation.utils.entity.PicaUser; import com.pica.cloud.foundation.utils.entity.PicaUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -33,22 +34,38 @@ public class HospitalSaasRoleServiceImpl implements HospitalSaasRoleService { ...@@ -33,22 +34,38 @@ public class HospitalSaasRoleServiceImpl implements HospitalSaasRoleService {
@Override @Override
public int insertAndModify(HospitalRoleDetailReq req, PicaUser user) { public int insertAndModify(HospitalRoleDetailReq req, PicaUser user) {
int num;
if(null != req.getId()){
PermissionRole role = permissionRoleMapper.selectByPrimaryKey(req.getId()); PermissionRole role = permissionRoleMapper.selectByPrimaryKey(req.getId());
//新增
if (Objects.isNull(role)) {
//新增
role = new PermissionRole();
BeanUtils.copyProperties(req, role);
CommonUtils.setCommonParam(role, user.getId(), Calendar.getInstance().getTime());
permissionRoleMapper.insert(role);
} else {
//更新
// todo roleCode 字段格式定义
role.setRoleName(req.getName()); role.setRoleName(req.getName());
// todo 描述信息 需新增字段 role.setRemark(req.getDescribe());
permissionRoleMapper.updateByPrimaryKeySelective(role); role.setModifiedId(Long.valueOf(user.getId()));
role.setModifiedTime(new Date());
num = permissionRoleMapper.updateByPrimaryKeySelective(role);
}else {
PermissionRole role = new PermissionRole();
role.setRoleCode("saas_doctor_admin");
role.setRoleName(req.getName());
role.setRemark(req.getDescribe());
CommonUtils.setCommonParam(role, user.getId(), Calendar.getInstance().getTime());
num = permissionRoleMapper.insert(role);
} }
return 1; // PermissionRole role = permissionRoleMapper.selectByPrimaryKey(req.getId());
// //新增
// if (Objects.isNull(role)) {
// //新增
// role = new PermissionRole();
// BeanUtils.copyProperties(req, role);
// CommonUtils.setCommonParam(role, user.getId(), Calendar.getInstance().getTime());
// permissionRoleMapper.insert(role);
// } else {
// //更新
// // todo roleCode 字段格式定义
// role.setRoleName(req.getName());
// // todo 描述信息 需新增字段
// permissionRoleMapper.updateByPrimaryKeySelective(role);
// }
return num;
} }
@Override @Override
......
...@@ -10,9 +10,10 @@ ...@@ -10,9 +10,10 @@
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/> <result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="modified_id" property="modifiedId" jdbcType="BIGINT"/> <result column="modified_id" property="modifiedId" jdbcType="BIGINT"/>
<result column="modified_time" property="modifiedTime" jdbcType="TIMESTAMP"/> <result column="modified_time" property="modifiedTime" jdbcType="TIMESTAMP"/>
<result column="remark" property="remark" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, role_code, role_name, delete_flag, created_id, created_time, modified_id, modified_time id, role_code, role_name, delete_flag, created_id, created_time, modified_id, modified_time,remark
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
select select
...@@ -28,10 +29,10 @@ ...@@ -28,10 +29,10 @@
</delete> </delete>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.PermissionRole"> <insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.PermissionRole">
insert into permission_role (id, role_code, role_name, insert into permission_role (id, role_code, role_name,remark
delete_flag, created_id, created_time, delete_flag, created_id, created_time,
modified_id, modified_time) modified_id, modified_time)
values (#{id,jdbcType=BIGINT}, #{roleCode,jdbcType=VARCHAR}, #{roleName,jdbcType=VARCHAR}, values (#{id,jdbcType=BIGINT}, #{roleCode,jdbcType=VARCHAR}, #{roleName,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{deleteFlag,jdbcType=INTEGER}, #{createdId,jdbcType=BIGINT}, #{createdTime,jdbcType=TIMESTAMP}, #{deleteFlag,jdbcType=INTEGER}, #{createdId,jdbcType=BIGINT}, #{createdTime,jdbcType=TIMESTAMP},
#{modifiedId,jdbcType=BIGINT}, #{modifiedTime,jdbcType=TIMESTAMP}) #{modifiedId,jdbcType=BIGINT}, #{modifiedTime,jdbcType=TIMESTAMP})
</insert> </insert>
...@@ -100,6 +101,9 @@ ...@@ -100,6 +101,9 @@
<if test="roleName != null"> <if test="roleName != null">
role_name = #{roleName,jdbcType=VARCHAR}, role_name = #{roleName,jdbcType=VARCHAR},
</if> </if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null"> <if test="deleteFlag != null">
delete_flag = #{deleteFlag,jdbcType=INTEGER}, delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if> </if>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册