提交 3dbdef0c 编写于 作者: xinxu.wang's avatar xinxu.wang

Merge branch 'dev-importInsuranceOrderForKa230407' into 'release'

Dev import insurance order for ka230407

See merge request !142
流水线 #55071 已失败 于阶段
......@@ -23,4 +23,6 @@ public interface SaaSMenuMapper {
int updateByPrimaryKey(SaaSMenu record);
int deleteByRoleId(Map<String, Object> map);
SaaSMenu selectByRoleIdParentId (SaaSMenu record);
}
\ No newline at end of file
......@@ -75,14 +75,37 @@ public class HospitalSaasRoleServiceImpl implements HospitalSaasRoleService {
role.setModifiedTime(new Date());
num = permissionRoleMapper.insertSelective(role);
List<SaaSMenu> saaSMenus = saaSMenuMapper.selectByRoleId(String.valueOf(4));
saaSMenus.forEach(t -> {
t.setPermissionRoleId(String.valueOf(role.getId()));
t.setModifyId(user.getId());
t.setModifyTime(new Date());
t.setCreatTime(new Date());
t.setCreatId(user.getId());
});
saaSMenuMapper.batchInsert(saaSMenus);
for (SaaSMenu saaSMenu : saaSMenus) {
if (saaSMenu.getParentId() == 0) {
saaSMenu.setPermissionRoleId(String.valueOf(role.getId()));
saaSMenu.setModifyId(user.getId());
saaSMenu.setModifyTime(new Date());
saaSMenu.setCreatTime(new Date());
saaSMenu.setCreatId(user.getId());
saaSMenuMapper.insert(saaSMenu);
} else {
// 查询父ID
SaaSMenu sMenu = new SaaSMenu();
sMenu.setPermissionRoleId(String.valueOf(role.getId()));
sMenu.setParentId(saaSMenu.getParentId());
SaaSMenu saaSMenu1 = saaSMenuMapper.selectByRoleIdParentId(sMenu);
saaSMenu.setParentId(saaSMenu1.getId());
saaSMenu.setPermissionRoleId(String.valueOf(role.getId()));
saaSMenu.setModifyId(user.getId());
saaSMenu.setModifyTime(new Date());
saaSMenu.setCreatTime(new Date());
saaSMenu.setCreatId(user.getId());
saaSMenuMapper.insert(saaSMenu);
}
}
// saaSMenus.forEach(t -> {
// t.setPermissionRoleId(String.valueOf(role.getId()));
// t.setModifyId(user.getId());
// t.setModifyTime(new Date());
// t.setCreatTime(new Date());
// t.setCreatId(user.getId());
// });
// saaSMenuMapper.batchInsert(saaSMenus);
}
return num;
}
......
......@@ -35,6 +35,7 @@
<include refid="Base_Column_List"/>
from p_saas_menu
where permission_role_id = #{id,jdbcType=VARCHAR} and delete_flag = 1
order by parent_id
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
......@@ -51,15 +52,15 @@
and delete_flag = 1
</update>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.SaaSMenu">
insert into p_saas_menu (id, hospital_id, permission_role_id,
insert into p_saas_menu (hospital_id, permission_role_id,
name, url, parent_id,
system_type, seq, delete_flag,
created_id, created_time, modified_id,
modified_time, icon, menu_type,
second_menu_id)
values (#{id,jdbcType=INTEGER}, #{hospitalId,jdbcType=BIGINT}, #{permissionRoleId,jdbcType=VARCHAR},
values ( #{hospitalId,jdbcType=BIGINT}, #{permissionRoleId,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER},
#{systemType,jdbcType=INTEGER}, #{seq,jdbcType=INTEGER}, #{deleteFlag,jdbcType=INTEGER},
#{systemType,jdbcType=INTEGER}, #{seq,jdbcType=INTEGER}, 1,
#{creatId,jdbcType=INTEGER}, #{creatTime,jdbcType=TIMESTAMP}, #{modifyId,jdbcType=INTEGER},
#{modifyTime,jdbcType=TIMESTAMP}, #{icon,jdbcType=VARCHAR}, #{menuType,jdbcType=INTEGER},
#{secondMenuId,jdbcType=INTEGER})
......@@ -256,4 +257,13 @@
second_menu_id = #{secondMenuId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByRoleIdParentId" resultMap="BaseResultMap" parameterType="com.pica.cloud.account.account.server.entity.SaaSMenu">
select
<include refid="Base_Column_List"/>
from p_saas_menu psm1
where psm1.permission_role_id = #{permissionRoleId,jdbcType=VARCHAR} and psm1.delete_flag = 1
and exists (select id from p_saas_menu psm2 where psm2.id = #{parentId} and psm2.delete_flag = 1 and psm1.name = psm2.name)
</select>
</mapper>
\ No newline at end of file
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.server.App;
import com.pica.cloud.account.account.server.req.HospitalRoleDetailReq;
import com.pica.cloud.foundation.utils.entity.PicaUser;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = App.class)
public class HospitalSaasRoleServiceTest {
@Autowired
private HospitalSaasRoleService hospitalSaasRoleService;
@Test
public void insertAndModify() {
HospitalRoleDetailReq req = new HospitalRoleDetailReq();
req.setName("测试");
PicaUser user = new PicaUser();
user.setId(1);
hospitalSaasRoleService.insertAndModify(req, user);
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册