SQL 修改
This commit is contained in:
parent
5fd14cf810
commit
6b45e59373
|
|
@ -15,35 +15,35 @@ public interface CompanyDao {
|
||||||
|
|
||||||
List<CompanyBean> list(@Param("params")Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
|
List<CompanyBean> list(@Param("params")Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
|
||||||
|
|
||||||
@Select("SELECT id,NAME AS companyName FROM pm_company where name = #{companyName} and is_active = '1'")
|
@Select("SELECT \"id\",\"name\" AS companyName FROM \"ynrealname\".\"pm_company\" where \"name\" = #{companyName} and \"is_active\" = '1'")
|
||||||
CompanyBean getCompanyByName(String companyName);
|
CompanyBean getCompanyByName(String companyName);
|
||||||
|
|
||||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
@SelectKey(statement = "SELECT IDENTITY()", keyProperty = "id", before = false, resultType = Long.class)
|
||||||
@Insert("INSERT INTO `pm_company`(`NAME`, `type_id`, `address`, `register_date`, `legal_person`, `legal_phone`, `legal_idnumber`, `IS_ACTIVE`) VALUES (#{companyName}, #{unitType}, #{address}, #{registerDate}, #{represent}, #{representPhone}, #{representIdNumber}, '1')")
|
@Insert("INSERT INTO \"ynrealname\".\"pm_company\"(\"name\", \"type_id\", \"address\", \"register_date\", \"legal_person\", \"legal_phone\", \"legal_idnumber\", \"is_active\") VALUES (#{companyName}, #{unitType}, #{address}, #{registerDate}, #{represent}, #{representPhone}, #{representIdNumber}, '1')")
|
||||||
int saveCompany(CompanyBean o);
|
int saveCompany(CompanyBean o);
|
||||||
|
|
||||||
@Select("select id,NAME AS companyName,type_id as unitType,legal_person as represent,`legal_phone` as representPhone, `legal_idnumber` as representIdNumber, register_date as registerDate, address from `pm_company` where id = #{id}")
|
@Select("select \"id\",\"name\" AS companyName,\"type_id\" as unitType,\"legal_person\" as represent,\"legal_phone\" as representPhone, \"legal_idnumber\" as representIdNumber, \"register_date\" as registerDate, \"address\" from \"ynrealname\".\"pm_company\" where \"id\" = #{id}")
|
||||||
CompanyBean getCompanyById(Long id);
|
CompanyBean getCompanyById(Long id);
|
||||||
|
|
||||||
int updateCompany(CompanyBean o);
|
int updateCompany(CompanyBean o);
|
||||||
|
|
||||||
@Select("select ID as companyId,NAME as companyName from pm_company where IS_ACTIVE = '1'")
|
@Select("select \"id\" as companyId,\"name\" as companyName from \"ynrealname\".\"pm_company\" where \"is_active\" = '1'")
|
||||||
List<ProjectBean> getCompanyKeyValue();
|
List<ProjectBean> getCompanyKeyValue();
|
||||||
|
|
||||||
|
|
||||||
@Select("select ID from pm_company where NAME = #{name}")
|
@Select("select \"id\" from \"ynrealname\".\"pm_company\" where \"name\" = #{name}")
|
||||||
Integer getCompanyIdByName(String name);
|
Integer getCompanyIdByName(String name);
|
||||||
|
|
||||||
@Select("select ID from pm_organization where IS_ACTIVE = '1' and `NAME` = #{name} ")
|
@Select("select \"id\" from \"ynrealname\".\"pm_organization\" where \"is_active\" = '1' and \"name\" = #{name}")
|
||||||
Integer getOrgIdByName(String name);
|
Integer getOrgIdByName(String name);
|
||||||
|
|
||||||
@Select("SELECT id FROM t_dict WHERE `value` = #{value} AND is_active = '1'")
|
@Select("SELECT \"id\" FROM \"ynrealname\".\"t_dict\" WHERE \"value\" = #{value} AND \"is_active\" = '1'")
|
||||||
Integer getLevelIdByValue(String value);
|
Integer getLevelIdByValue(String value);
|
||||||
|
|
||||||
@Select("SELECT id FROM bm_owner WHERE owner_name = #{name} AND is_active = '1'")
|
@Select("SELECT \"id\" FROM \"ynrealname\".\"bm_owner\" WHERE \"owner_name\" = #{name} AND \"is_active\" = '1'")
|
||||||
Integer getOwnerIdByName(String name);
|
Integer getOwnerIdByName(String name);
|
||||||
|
|
||||||
@Update("update pm_company set is_active = '0' where id = #{id}")
|
@Update("update \"ynrealname\".\"pm_company\" set \"is_active\" = '0' where \"id\" = #{id}")
|
||||||
int deleteCompany(Long id);
|
int deleteCompany(Long id);
|
||||||
|
|
||||||
int saveCompanyWithOrg(CompanyBean o);
|
int saveCompanyWithOrg(CompanyBean o);
|
||||||
|
|
@ -52,6 +52,6 @@ public interface CompanyDao {
|
||||||
|
|
||||||
void deleteCompanyWithOrg(Long id);
|
void deleteCompanyWithOrg(Long id);
|
||||||
|
|
||||||
@Select("select id,value as name from t_dict where type = 'infrastructure_project_type' and is_active = '1'")
|
@Select("select \"id\",\"value\" as name from \"ynrealname\".\"t_dict\" where \"type\" = 'infrastructure_project_type' and \"is_active\" = '1'")
|
||||||
List<ZNode> getProType();
|
List<ZNode> getProType();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,31 +8,31 @@ import java.util.Set;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface PermissionDao {
|
public interface PermissionDao {
|
||||||
|
|
||||||
@Select("select * from \"ynrealname\".\"sys_permission\" t where IS_ACTIVE = 1 order by t.SORT")
|
@Select("select * from \"ynrealname\".\"sys_permission\" t where \"is_active\" = 1 order by t.\"sort\"")
|
||||||
List<Permission> listAll();
|
List<Permission> listAll();
|
||||||
|
|
||||||
@Select("select * from \"ynrealname\".\"sys_permission\" t where t.TYPE = 1 and \"permission_type\" = '后台' and IS_ACTIVE = 1 order by t.SORT")
|
@Select("select * from \"ynrealname\".\"sys_permission\" t where t.\"type\" = 1 and \"permission_type\" = '后台' and \"is_active\" = 1 order by t.\"sort\"")
|
||||||
List<Permission> listParents();
|
List<Permission> listParents();
|
||||||
|
|
||||||
@Select("select distinct p.* from \"ynrealname\".\"sys_permission\" p inner join \"ynrealname\".\"sys_role_permission\" rp on p.ID = rp.\"permissionId\" inner join \"ynrealname\".\"sys_role_user\" ru on ru.\"roleId\" = rp.\"roleId\" where p.IS_ACTIVE = 1 and rp.\"is_active\" = 1 and ru.\"is_active\" = 1 and ru.\"userId\" = #{userId} order by p.SORT")
|
@Select("select distinct p.* from \"ynrealname\".\"sys_permission\" p inner join \"ynrealname\".\"sys_role_permission\" rp on p.\"id\" = rp.\"permissionId\" inner join \"ynrealname\".\"sys_role_user\" ru on ru.\"roleId\" = rp.\"roleId\" where p.\"is_active\" = 1 and rp.\"is_active\" = 1 and ru.\"is_active\" = 1 and ru.\"userId\" = #{userId} order by p.\"sort\"")
|
||||||
List<Permission> listByUserId(Long userId);
|
List<Permission> listByUserId(Long userId);
|
||||||
|
|
||||||
@Select("select p.* from \"ynrealname\".\"sys_permission\" p inner join \"ynrealname\".\"sys_role_permission\" rp on p.ID = rp.\"permissionId\" where p.IS_ACTIVE = 1 and rp.\"is_active\" = 1 and rp.\"roleId\" = #{roleId} order by p.SORT")
|
@Select("select p.* from \"ynrealname\".\"sys_permission\" p inner join \"ynrealname\".\"sys_role_permission\" rp on p.\"id\" = rp.\"permissionId\" where p.\"is_active\" = 1 and rp.\"is_active\" = 1 and rp.\"roleId\" = #{roleId} order by p.\"sort\"")
|
||||||
List<Permission> listByRoleId(Long roleId);
|
List<Permission> listByRoleId(Long roleId);
|
||||||
|
|
||||||
@Select("select * from \"ynrealname\".\"sys_permission\" t where t.IS_ACTIVE = 1 and t.ID = #{id}")
|
@Select("select * from \"ynrealname\".\"sys_permission\" t where t.\"is_active\" = 1 and t.\"id\" = #{id}")
|
||||||
Permission getById(Long id);
|
Permission getById(Long id);
|
||||||
|
|
||||||
@Insert("insert into \"ynrealname\".\"sys_permission\"(\"parentId\", NAME, \"css\", \"href\", TYPE, \"permission\", SORT, \"permission_type\") values(#{parentId}, #{name}, #{css}, #{href}, #{type}, #{permission}, #{sort}, #{permissionType})")
|
@Insert("insert into \"ynrealname\".\"sys_permission\"(\"parentId\", \"name\", \"css\", \"href\", \"type\", \"permission\", \"sort\", \"permission_type\") values(#{parentId}, #{name}, #{css}, #{href}, #{type}, #{permission}, #{sort}, #{permissionType})")
|
||||||
int save(Permission permission);
|
int save(Permission permission);
|
||||||
|
|
||||||
@Update("update \"ynrealname\".\"sys_permission\" t set \"parentId\" = #{parentId}, NAME = #{name}, \"css\" = #{css}, \"href\" = #{href}, TYPE = #{type}, \"permission\" = #{permission}, SORT = #{sort}, \"permission_type\" = #{permissionType} where t.ID = #{id}")
|
@Update("update \"ynrealname\".\"sys_permission\" t set \"parentId\" = #{parentId}, \"name\" = #{name}, \"css\" = #{css}, \"href\" = #{href}, \"type\" = #{type}, \"permission\" = #{permission}, \"sort\" = #{sort}, \"permission_type\" = #{permissionType} where t.\"id\" = #{id}")
|
||||||
int update(Permission permission);
|
int update(Permission permission);
|
||||||
|
|
||||||
@Delete("update \"ynrealname\".\"sys_permission\" set \"is_active\" = '0' where \"id\" in ( ${id} )")
|
@Delete("update \"ynrealname\".\"sys_permission\" set \"is_active\" = '0' where \"id\" in ( ${id} )")
|
||||||
int delete(String id);
|
int delete(String id);
|
||||||
|
|
||||||
@Delete("update \"ynrealname\".\"sys_permission\" set IS_ACTIVE = '0' where \"parentId\" = #{id}")
|
@Delete("update \"ynrealname\".\"sys_permission\" set \"is_active\" = '0' where \"parentId\" = #{id}")
|
||||||
int deleteByParentId(Long id);
|
int deleteByParentId(Long id);
|
||||||
|
|
||||||
@Delete("delete from \"ynrealname\".\"sys_role_permission\" where \"permissionId\" = #{permissionId}")
|
@Delete("delete from \"ynrealname\".\"sys_role_permission\" where \"permissionId\" = #{permissionId}")
|
||||||
|
|
@ -41,26 +41,26 @@ public interface PermissionDao {
|
||||||
@Select("select ru.\"userId\" from \"ynrealname\".\"sys_role_permission\" rp inner join \"ynrealname\".\"sys_role_user\" ru on ru.\"roleId\" = rp.\"roleId\" where rp.\"permissionId\" = #{permissionId}")
|
@Select("select ru.\"userId\" from \"ynrealname\".\"sys_role_permission\" rp inner join \"ynrealname\".\"sys_role_user\" ru on ru.\"roleId\" = rp.\"roleId\" where rp.\"permissionId\" = #{permissionId}")
|
||||||
Set<Long> listUserIds(Long permissionId);
|
Set<Long> listUserIds(Long permissionId);
|
||||||
|
|
||||||
@Select("select * from \"ynrealname\".\"sys_permission\" t where t.IS_ACTIVE = '1' AND t.\"permission_type\"='APP' order by t.SORT")
|
@Select("select * from \"ynrealname\".\"sys_permission\" t where t.\"is_active\" = '1' AND t.\"permission_type\"='APP' order by t.\"sort\"")
|
||||||
List<Permission> listAppAll();
|
List<Permission> listAppAll();
|
||||||
|
|
||||||
@Select("select * from \"ynrealname\".\"sys_permission\" t where t.IS_ACTIVE = '1' AND t.\"permission_type\"='后台' order by t.SORT")
|
@Select("select * from \"ynrealname\".\"sys_permission\" t where t.\"is_active\" = '1' AND t.\"permission_type\"='后台' order by t.\"sort\"")
|
||||||
List<Permission> listBackAll();
|
List<Permission> listBackAll();
|
||||||
|
|
||||||
@Select("select a.* from ( select p.* from \"ynrealname\".\"sys_permission\" p " +
|
@Select("select a.* from ( select p.* from \"ynrealname\".\"sys_permission\" p " +
|
||||||
"inner join \"ynrealname\".\"sys_role_permission\" rp on p.ID = rp.\"permissionId\" " +
|
"inner join \"ynrealname\".\"sys_role_permission\" rp on p.\"id\" = rp.\"permissionId\" " +
|
||||||
"where rp.\"roleId\" = #{backRoleId} and p.IS_ACTIVE = '1' " +
|
"where rp.\"roleId\" = #{backRoleId} and p.\"is_active\" = '1' " +
|
||||||
"and rp.\"is_active\" = 1 AND p.\"permission_type\"='后台' " +
|
"and rp.\"is_active\" = 1 AND p.\"permission_type\"='后台' " +
|
||||||
"order by p.SORT ) a inner join \"ynrealname\".\"sys_permission\" p on p.ID = a.\"parentId\" " +
|
"order by p.\"sort\" ) a inner join \"ynrealname\".\"sys_permission\" p on p.\"id\" = a.\"parentId\" " +
|
||||||
"and p.IS_ACTIVE = '1' union " +
|
"and p.\"is_active\" = '1' union " +
|
||||||
"select * from ( select p.* from \"ynrealname\".\"sys_permission\" p " +
|
"select * from ( select p.* from \"ynrealname\".\"sys_permission\" p " +
|
||||||
"INNER JOIN \"ynrealname\".\"sys_role_permission\" rp ON p.ID = rp.\"permissionId\" " +
|
"INNER JOIN \"ynrealname\".\"sys_role_permission\" rp ON p.\"id\" = rp.\"permissionId\" " +
|
||||||
"WHERE rp.\"roleId\" = #{backRoleId} AND p.IS_ACTIVE = '1' " +
|
"WHERE rp.\"roleId\" = #{backRoleId} AND p.\"is_active\" = '1' " +
|
||||||
"AND rp.\"is_active\" = '1' AND p.\"permission_type\" = '后台' " +
|
"AND rp.\"is_active\" = '1' AND p.\"permission_type\" = '后台' " +
|
||||||
"and p.\"parentId\" = 0 )b")
|
"and p.\"parentId\" = 0 )b")
|
||||||
List<Permission> listByBack(Long backRoleId);
|
List<Permission> listByBack(Long backRoleId);
|
||||||
|
|
||||||
@Select("select p.* from \"ynrealname\".\"sys_permission\" p inner join \"ynrealname\".\"sys_role_permission\" rp on p.ID = rp.\"permissionId\" where rp.\"roleId\" = #{appRoleId} and p.IS_ACTIVE = '1' and rp.\"is_active\" = 1 AND p.\"permission_type\"='APP' order by p.SORT")
|
@Select("select p.* from \"ynrealname\".\"sys_permission\" p inner join \"ynrealname\".\"sys_role_permission\" rp on p.\"id\" = rp.\"permissionId\" where rp.\"roleId\" = #{appRoleId} and p.\"is_active\" = '1' and rp.\"is_active\" = 1 AND p.\"permission_type\"='APP' order by p.\"sort\"")
|
||||||
List<Permission> listByBackApp(Long appRoleId);
|
List<Permission> listByBackApp(Long appRoleId);
|
||||||
|
|
||||||
@Select("select getPermissionChildList(#{id})")
|
@Select("select getPermissionChildList(#{id})")
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ public interface ProjectDao {
|
||||||
|
|
||||||
String getEinTime(ProjectBean bean);
|
String getEinTime(ProjectBean bean);
|
||||||
|
|
||||||
@Select("select t.value as val,type,id as k from t_dict t where t.type = #{type} and is_active='1'")
|
@Select("select t.\"value\" as val,\"type\",\"id\" as k from \"ynrealname\".\"t_dict\" t where t.\"type\" = #{type} and \"is_active\"='1'")
|
||||||
List<Dict> listByType(String type);
|
List<Dict> listByType(String type);
|
||||||
|
|
||||||
ProjectBean getOrg(String companyId);
|
ProjectBean getOrg(String companyId);
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ import java.util.Map;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface RoleDao {
|
public interface RoleDao {
|
||||||
|
|
||||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
@SelectKey(statement = "SELECT IDENTITY()", keyProperty = "id", before = false, resultType = Long.class)
|
||||||
@Insert("insert into sys_role(name, company_id, description, type, level, status) values(#{name}, #{companyId}, #{description}, #{type}, #{level}, #{status})")
|
@Insert("insert into \"ynrealname\".\"sys_role\"(\"name\", \"company_id\", \"description\", \"type\", \"level\", \"status\") values(#{name}, #{companyId}, #{description}, #{type}, #{level}, #{status})")
|
||||||
int save(Role role);
|
int save(Role role);
|
||||||
|
|
||||||
int count(@Param("params") Map<String, Object> params);
|
int count(@Param("params") Map<String, Object> params);
|
||||||
|
|
@ -20,26 +20,26 @@ public interface RoleDao {
|
||||||
|
|
||||||
Role getById(Long id);
|
Role getById(Long id);
|
||||||
|
|
||||||
@Select("select * from sys_role t where t.name = #{name} and t.company_id = #{companyId} and t.is_active = '1'")
|
@Select("select * from \"ynrealname\".\"sys_role\" t where t.\"name\" = #{name} and t.\"company_id\" = #{companyId} and t.\"is_active\" = '1'")
|
||||||
Role getRole(@Param("companyId") String companyId,@Param("name")String name);
|
Role getRole(@Param("companyId") String companyId,@Param("name")String name);
|
||||||
|
|
||||||
@Update("update sys_role set name = #{name}, company_id = #{companyId}, description = #{description}, type = #{type}, level = #{level}, status = #{status} where id = #{id}")
|
@Update("update \"ynrealname\".\"sys_role\" set \"name\" = #{name}, \"company_id\" = #{companyId}, \"description\" = #{description}, \"type\" = #{type}, \"level\" = #{level}, \"status\" = #{status} where \"id\" = #{id}")
|
||||||
int update(Role role);
|
int update(Role role);
|
||||||
|
|
||||||
@Select("select * from sys_role r inner join sys_role_user ru on r.id = ru.roleId where ru.userId = #{userId}")
|
@Select("select * from \"ynrealname\".\"sys_role\" r inner join \"ynrealname\".\"sys_role_user\" ru on r.\"id\" = ru.\"roleId\" where ru.\"userId\" = #{userId}")
|
||||||
List<Role> listByUserId(Long userId);
|
List<Role> listByUserId(Long userId);
|
||||||
|
|
||||||
@Delete("delete from sys_role_permission where roleId = #{roleId}")
|
@Delete("delete from \"ynrealname\".\"sys_role_permission\" where \"roleId\" = #{roleId}")
|
||||||
int deleteRolePermission(Long roleId);
|
int deleteRolePermission(Long roleId);
|
||||||
|
|
||||||
int saveRolePermission(@Param("roleId") Long roleId, @Param("permissionIds") List<Long> permissionIds);
|
int saveRolePermission(@Param("roleId") Long roleId, @Param("permissionIds") List<Long> permissionIds);
|
||||||
|
|
||||||
@Update("update sys_role set is_active = '0' where id = #{id}")
|
@Update("update \"ynrealname\".\"sys_role\" set \"is_active\" = '0' where \"id\" = #{id}")
|
||||||
int delete(Long id);
|
int delete(Long id);
|
||||||
|
|
||||||
@Delete("delete from sys_role_user where roleId = #{roleId}")
|
@Delete("delete from \"ynrealname\".\"sys_role_user\" where \"roleId\" = #{roleId}")
|
||||||
int deleteRoleUser(Long roleId);
|
int deleteRoleUser(Long roleId);
|
||||||
|
|
||||||
@Update("update sys_role set status = #{status} where id = #{id}")
|
@Update("update \"ynrealname\".\"sys_role\" set \"status\" = #{status} where \"id\" = #{id}")
|
||||||
int updateStatus(Role o);
|
int updateStatus(Role o);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,22 +13,22 @@ public interface SubCompanyDao {
|
||||||
|
|
||||||
List<SubCompanyBean> list(@Param("params")Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
|
List<SubCompanyBean> list(@Param("params")Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
|
||||||
|
|
||||||
@Select("SELECT id,NAME AS subCompanyName FROM pm_dept where name = #{companyName} and is_active = '1'")
|
@Select("SELECT \"id\",\"name\" AS subCompanyName FROM \"ynrealname\".\"pm_dept\" where \"name\" = #{companyName} and \"is_active\" = '1'")
|
||||||
SubCompanyBean getCompanyByName(String companyName);
|
SubCompanyBean getCompanyByName(String companyName);
|
||||||
|
|
||||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
@SelectKey(statement = "SELECT IDENTITY()", keyProperty = "id", before = false, resultType = Long.class)
|
||||||
@Insert("INSERT INTO `pm_dept`(`NAME`, `abbreviation`, `company_id`, `status`, `IS_ACTIVE`) VALUES (#{subCompanyName}, #{abbreviation}, #{companyId}, '1', '1')")
|
@Insert("INSERT INTO \"ynrealname\".\"pm_dept\"(\"name\", \"abbreviation\", \"company_id\", \"status\", \"is_active\") VALUES (#{subCompanyName}, #{abbreviation}, #{companyId}, '1', '1')")
|
||||||
int saveCompany(SubCompanyBean o);
|
int saveCompany(SubCompanyBean o);
|
||||||
|
|
||||||
@Select("select id,NAME AS subCompanyName,company_id as companyId,abbreviation from `pm_dept` where id = #{id}")
|
@Select("select \"id\",\"name\" AS subCompanyName,\"company_id\" as companyId,\"abbreviation\" from \"ynrealname\".\"pm_dept\" where \"id\" = #{id}")
|
||||||
SubCompanyBean getCompanyById(Long id);
|
SubCompanyBean getCompanyById(Long id);
|
||||||
|
|
||||||
int updateCompany(SubCompanyBean o);
|
int updateCompany(SubCompanyBean o);
|
||||||
|
|
||||||
@Update("update pm_dept set is_active = '0' where id = #{id}")
|
@Update("update \"ynrealname\".\"pm_dept\" set \"is_active\" = '0' where \"id\" = #{id}")
|
||||||
int deleteCompany(Long id);
|
int deleteCompany(Long id);
|
||||||
|
|
||||||
@Update("update pm_dept set status = #{status} where id = #{id}")
|
@Update("update \"ynrealname\".\"pm_dept\" set \"status\" = #{status} where \"id\" = #{id}")
|
||||||
int updateCompanyStatus(SubCompanyBean o);
|
int updateCompanyStatus(SubCompanyBean o);
|
||||||
|
|
||||||
int saveSubCompanyWithOrg(SubCompanyBean o);
|
int saveSubCompanyWithOrg(SubCompanyBean o);
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ public interface UserDao {
|
||||||
|
|
||||||
UserBean getById(Long id);
|
UserBean getById(Long id);
|
||||||
|
|
||||||
@Select("select t.id as userId,t.* from \"ynrealname\".\"sys_user\" t where t.\"username\" = #{username}")
|
@Select("select t.\"id\" as userId,t.* from \"ynrealname\".\"sys_user\" t where t.\"username\" = #{username}")
|
||||||
SysUser getUser(String username);
|
SysUser getUser(String username);
|
||||||
|
|
||||||
@Update("update \"ynrealname\".\"sys_user\" t set t.\"password\" = #{password} where t.\"id\" = #{id}")
|
@Update("update \"ynrealname\".\"sys_user\" t set t.\"password\" = #{password} where t.\"id\" = #{id}")
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
<if test="params.keyWord != null and params.keyWord != ''">
|
<if test="params.keyWord != null and params.keyWord != ''">
|
||||||
and (
|
and (
|
||||||
t."name" like concat('%', #{params.keyWord}, '%') or
|
t."name" like concat('%', #{params.keyWord}, '%') or
|
||||||
pc.NAME like concat('%', #{params.keyWord}, '%') or
|
pc."name" like concat('%', #{params.keyWord}, '%') or
|
||||||
t."description" like concat('%', #{params.keyWord}, '%')
|
t."description" like concat('%', #{params.keyWord}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -19,14 +19,14 @@
|
||||||
|
|
||||||
<select id="count" resultType="int">
|
<select id="count" resultType="int">
|
||||||
select count(1) from "ynrealname"."sys_role" t
|
select count(1) from "ynrealname"."sys_role" t
|
||||||
LEFT JOIN "ynrealname"."pm_company" pc ON t."company_id" = pc.ID
|
LEFT JOIN "ynrealname"."pm_company" pc ON t."company_id" = pc."id"
|
||||||
<include refid="where" />
|
<include refid="where" />
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="list" resultType="com.bonus.system.api.model.Role">
|
<select id="list" resultType="com.bonus.system.api.model.Role">
|
||||||
SELECT
|
SELECT
|
||||||
t."id",
|
t."id",
|
||||||
pc.NAME AS companyName,
|
pc."name" AS companyName,
|
||||||
t."name",
|
t."name",
|
||||||
t."description",
|
t."description",
|
||||||
CONCAT(
|
CONCAT(
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
t."updateTime" as changeTime
|
t."updateTime" as changeTime
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."sys_role" t
|
"ynrealname"."sys_role" t
|
||||||
LEFT JOIN "ynrealname"."pm_company" pc ON t."company_id" = pc.ID and pc.IS_ACTIVE = '1'
|
LEFT JOIN "ynrealname"."pm_company" pc ON t."company_id" = pc."id" and pc."is_active" = '1'
|
||||||
<include refid="where" />
|
<include refid="where" />
|
||||||
order by t."level" ASC
|
order by t."level" ASC
|
||||||
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
SELECT
|
SELECT
|
||||||
t."id",
|
t."id",
|
||||||
t."company_id" as companyId,
|
t."company_id" as companyId,
|
||||||
pc.NAME AS companyName,
|
pc."name" AS companyName,
|
||||||
t."name",
|
t."name",
|
||||||
t."description",
|
t."description",
|
||||||
t."type",
|
t."type",
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
t."updateTime" as changeTime
|
t."updateTime" as changeTime
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."sys_role" t
|
"ynrealname"."sys_role" t
|
||||||
LEFT JOIN "ynrealname"."pm_company" pc ON t."company_id" = pc.ID
|
LEFT JOIN "ynrealname"."pm_company" pc ON t."company_id" = pc."id"
|
||||||
where t."id" = #{id}
|
where t."id" = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
select count(1)
|
select count(1)
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."sys_user" t
|
"ynrealname"."sys_user" t
|
||||||
LEFT JOIN "ynrealname"."pm_organization" po ON t."org_id" = po.ID
|
LEFT JOIN "ynrealname"."pm_organization" po ON t."org_id" = po."id"
|
||||||
LEFT JOIN "ynrealname"."sys_role_user" sru ON sru."userId" = t."id" and sru."is_active" = '1'
|
LEFT JOIN "ynrealname"."sys_role_user" sru ON sru."userId" = t."id" and sru."is_active" = '1'
|
||||||
LEFT JOIN "ynrealname"."sys_role" sr ON sr."id" = sru."roleId"
|
LEFT JOIN "ynrealname"."sys_role" sr ON sr."id" = sru."roleId"
|
||||||
LEFT JOIN "ynrealname"."bm_project" bp ON bp."id" = t."pro_id"
|
LEFT JOIN "ynrealname"."bm_project" bp ON bp."id" = t."pro_id"
|
||||||
|
|
@ -21,10 +21,10 @@
|
||||||
and t."phone" like concat('%', #{params.phonenumber}, '%')
|
and t."phone" like concat('%', #{params.phonenumber}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="params.orgId != null and params.orgId != '' and params.roleLevel < 3">
|
<if test="params.orgId != null and params.orgId != '' and params.roleLevel < 3">
|
||||||
AND po.ID in (${params.orgAll})
|
AND po."id" in (${params.orgAll})
|
||||||
</if>
|
</if>
|
||||||
<if test="params.orgId != null and params.orgId != '' and params.roleLevel >= 3">
|
<if test="params.orgId != null and params.orgId != '' and params.roleLevel >= 3">
|
||||||
AND po.ID = #{params.orgId}
|
AND po."id" = #{params.orgId}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.keyWord != null and params.keyWord != ''">
|
<if test="params.keyWord != null and params.keyWord != ''">
|
||||||
and (
|
and (
|
||||||
|
|
@ -43,8 +43,8 @@
|
||||||
t."id_number" AS idNumber,
|
t."id_number" AS idNumber,
|
||||||
t."phone" AS phonenumber,
|
t."phone" AS phonenumber,
|
||||||
CASE
|
CASE
|
||||||
WHEN sr."type" LIKE '%3%' THEN po2.NAME
|
WHEN sr."type" LIKE '%3%' THEN po2."name"
|
||||||
ELSE po.NAME
|
ELSE po."name"
|
||||||
END AS orgName,
|
END AS orgName,
|
||||||
sr."name" AS roleName,
|
sr."name" AS roleName,
|
||||||
CASE
|
CASE
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
t."is_push"
|
t."is_push"
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."sys_user" t
|
"ynrealname"."sys_user" t
|
||||||
LEFT JOIN "ynrealname"."pm_organization" po ON t."org_id" = po.ID
|
LEFT JOIN "ynrealname"."pm_organization" po ON t."org_id" = po."id"
|
||||||
LEFT JOIN "ynrealname"."sys_role_user" sru ON sru."userId" = t."id"
|
LEFT JOIN "ynrealname"."sys_role_user" sru ON sru."userId" = t."id"
|
||||||
AND sru."is_active" = '1'
|
AND sru."is_active" = '1'
|
||||||
LEFT JOIN "ynrealname"."sys_role" sr ON sr."id" = sru."roleId"
|
LEFT JOIN "ynrealname"."sys_role" sr ON sr."id" = sru."roleId"
|
||||||
|
|
@ -66,7 +66,7 @@
|
||||||
LEFT JOIN "ynrealname"."bm_sub_relation" bsr ON bsr."v" = btur."team_id" and bsr."is_active" = '1' and bsr."type" = '3'
|
LEFT JOIN "ynrealname"."bm_sub_relation" bsr ON bsr."v" = btur."team_id" and bsr."is_active" = '1' and bsr."type" = '3'
|
||||||
LEFT JOIN "ynrealname"."bm_sub_contract" bsc ON bsc."id" = bsr."sub_contract_id" and bsc."is_active" = '1'
|
LEFT JOIN "ynrealname"."bm_sub_contract" bsc ON bsc."id" = bsr."sub_contract_id" and bsc."is_active" = '1'
|
||||||
LEFT JOIN "ynrealname"."bm_project" bp ON bp."id" = bsc."pro_id" and bp."is_active" = '1'
|
LEFT JOIN "ynrealname"."bm_project" bp ON bp."id" = bsc."pro_id" and bp."is_active" = '1'
|
||||||
LEFT JOIN "ynrealname"."pm_organization" po2 ON bp."company_id" = po2.ID
|
LEFT JOIN "ynrealname"."pm_organization" po2 ON bp."company_id" = po2."id"
|
||||||
LEFT JOIN ( SELECT "id_number", "project_id", "is_furlough_person" FROM "ynrealname"."bm_worker_ein_history" WHERE ( "is_furlough_person" = '1' OR "exit_status" != 1 ) AND "is_active" = '1' FETCH FIRST 1 ROWS ONLY) bweh ON bweh."id_number" = t."id_number"
|
LEFT JOIN ( SELECT "id_number", "project_id", "is_furlough_person" FROM "ynrealname"."bm_worker_ein_history" WHERE ( "is_furlough_person" = '1' OR "exit_status" != 1 ) AND "is_active" = '1' FETCH FIRST 1 ROWS ONLY) bweh ON bweh."id_number" = t."id_number"
|
||||||
LEFT JOIN "ynrealname"."bm_project" bp2 ON bp2."id" = bweh."project_id"
|
LEFT JOIN "ynrealname"."bm_project" bp2 ON bp2."id" = bweh."project_id"
|
||||||
<where>
|
<where>
|
||||||
|
|
@ -78,10 +78,10 @@
|
||||||
and t."phone" like concat('%', #{params.phonenumber}, '%')
|
and t."phone" like concat('%', #{params.phonenumber}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="params.orgId != null and params.orgId != '' and params.roleLevel < 3">
|
<if test="params.orgId != null and params.orgId != '' and params.roleLevel < 3">
|
||||||
AND po.ID in (${params.orgAll})
|
AND po."id" in (${params.orgAll})
|
||||||
</if>
|
</if>
|
||||||
<if test="params.orgId != null and params.orgId != '' and params.roleLevel >= 3">
|
<if test="params.orgId != null and params.orgId != '' and params.roleLevel >= 3">
|
||||||
AND po.ID = #{params.orgId}
|
AND po."id" = #{params.orgId}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.keyWord != null and params.keyWord != ''">
|
<if test="params.keyWord != null and params.keyWord != ''">
|
||||||
and (
|
and (
|
||||||
|
|
@ -149,13 +149,13 @@
|
||||||
END as isBlacklist,
|
END as isBlacklist,
|
||||||
role."type" as auth
|
role."type" as auth
|
||||||
FROM
|
FROM
|
||||||
( SELECT "id", "username", "phone", ID_NUMBER FROM "ynrealname"."sys_user"
|
( SELECT "id", "username", "phone", "id_number" FROM "ynrealname"."sys_user"
|
||||||
WHERE "is_push" != 1 AND "is_active" = '1' AND "phone" is not null
|
WHERE "is_push" != 1 AND "is_active" = '1' AND "phone" is not null
|
||||||
<if test="id != null and id != ''">
|
<if test="id != null and id != ''">
|
||||||
and "id" = #{id}
|
and "id" = #{id}
|
||||||
</if>
|
</if>
|
||||||
FETCH FIRST 30 ROWS ONLY ) "user"
|
FETCH FIRST 30 ROWS ONLY ) "user"
|
||||||
LEFT JOIN "ynrealname"."bm_blacklist_worker" blaceUser ON "user".ID_NUMBER = blaceUser.ID_NUMBER
|
LEFT JOIN "ynrealname"."bm_blacklist_worker" blaceUser ON "user"."id_number" = blaceUser."id_number"
|
||||||
LEFT JOIN "ynrealname"."sys_role_user" roleUser ON "user"."id" = roleUser."userId"
|
LEFT JOIN "ynrealname"."sys_role_user" roleUser ON "user"."id" = roleUser."userId"
|
||||||
AND roleUser."is_active" = '1'
|
AND roleUser."is_active" = '1'
|
||||||
LEFT JOIN "ynrealname"."sys_role" role ON "role"."id" = roleUser."roleId"
|
LEFT JOIN "ynrealname"."sys_role" role ON "role"."id" = roleUser."roleId"
|
||||||
|
|
@ -259,12 +259,12 @@
|
||||||
where t."id" = #{id}
|
where t."id" = #{id}
|
||||||
</update>
|
</update>
|
||||||
<update id="pwdChange">
|
<update id="pwdChange">
|
||||||
UPDATE "ynrealname"."sys_user" SET "password" = #{passWord} WHERE "phone" = #{phone} and IS_ACTIVE='1'
|
UPDATE "ynrealname"."sys_user" SET "password" = #{passWord} WHERE "phone" = #{phone} and "is_active"='1'
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateUserPushStatus">
|
<update id="updateUserPushStatus">
|
||||||
<foreach collection="list" item="user" separator=";">
|
<foreach collection="list" item="user" separator=";">
|
||||||
UPDATE "ynrealname"."sys_user" SET "is_push"= #{user.status} WHERE "phone" = #{user.phone} and IS_ACTIVE = #{user.isActive}
|
UPDATE "ynrealname"."sys_user" SET "is_push"= #{user.status} WHERE "phone" = #{user.phone} and "is_active" = #{user.isActive}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -249,8 +249,8 @@
|
||||||
bbl."name" LIKE concat('%', #{params.keyWord}, '%')
|
bbl."name" LIKE concat('%', #{params.keyWord}, '%')
|
||||||
or bbl."id_number" LIKE concat('%', #{params.keyWord}, '%')
|
or bbl."id_number" LIKE concat('%', #{params.keyWord}, '%')
|
||||||
or bbl."pro_name" LIKE concat('%', #{params.keyWord}, '%')
|
or bbl."pro_name" LIKE concat('%', #{params.keyWord}, '%')
|
||||||
or bbl."sub_name" LIKE concat('%', #{params.keyWord}, '%')
|
or bbl."sub_name" LIKE concat('%', #{params.subName}, '%')
|
||||||
or bbl."event" LIKE concat('%', #{params.keyWord}, '%')
|
or bbl."event" LIKE concat('%', #{params.event}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test='params.status != null and params.status !=""'>
|
<if test='params.status != null and params.status !=""'>
|
||||||
|
|
@ -274,10 +274,10 @@
|
||||||
AND
|
AND
|
||||||
(
|
(
|
||||||
bbl."name" LIKE concat('%', #{params.keyWord}, '%')
|
bbl."name" LIKE concat('%', #{params.keyWord}, '%')
|
||||||
or bbl."id_number" LIKE concat('%', #{params.keyWord}, '%')
|
or bbl."id_number" LIKE concat('%', #{params.idNumber}, '%')
|
||||||
or bbl."pro_name" LIKE concat('%', #{params.keyWord}, '%')
|
or bbl."pro_name" LIKE concat('%', #{params.proName}, '%')
|
||||||
or bbl."sub_name" LIKE concat('%', #{params.keyWord}, '%')
|
or bbl."sub_name" LIKE concat('%', #{params.subName}, '%')
|
||||||
or bbl."event" LIKE concat('%', #{params.keyWord}, '%')
|
or bbl."event" LIKE concat('%', #{params.event}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test='params.status != null and params.status !=""'>
|
<if test='params.status != null and params.status !=""'>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,6 @@ import java.util.List;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface DictDao {
|
public interface DictDao {
|
||||||
|
|
||||||
@Select("select t.value as val,type,id as k from t_dict t where t.type = #{type} and t.is_active = '1'")
|
@Select("select t.\"value\" as val, t.\"type\", t.\"id\" as k from \"ynrealname\".\"t_dict\" t where t.\"type\" = #{type} and t.\"is_active\" = '1'")
|
||||||
List<Dict> listByType(String type);
|
List<Dict> listByType(String type);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@ public interface PermissionDao {
|
||||||
@Select("SELECT" +
|
@Select("SELECT" +
|
||||||
"\tDISTINCT p.*\n" +
|
"\tDISTINCT p.*\n" +
|
||||||
"FROM \"ynrealname\".\"sys_permission\" p\n" +
|
"FROM \"ynrealname\".\"sys_permission\" p\n" +
|
||||||
"INNER JOIN \"ynrealname\".\"sys_role_permission\" rp ON p.ID = rp.\"permissionId\" AND rp.\"is_active\" = 1\n" +
|
"INNER JOIN \"ynrealname\".\"sys_role_permission\" rp ON p.\"id\" = rp.\"permissionId\" AND rp.\"is_active\" = 1\n" +
|
||||||
"INNER JOIN \"ynrealname\".\"sys_role_user\" ru ON ru.\"roleId\" = rp.\"roleId\" AND ru.\"is_active\" = 1\n" +
|
"INNER JOIN \"ynrealname\".\"sys_role_user\" ru ON ru.\"roleId\" = rp.\"roleId\" AND ru.\"is_active\" = 1\n" +
|
||||||
"WHERE ru.\"userId\" = #{userId} AND ru.\"is_active\" = 1 AND p.is_active = 1\n" +
|
"WHERE ru.\"userId\" = #{userId} AND ru.\"is_active\" = 1 AND p.\"is_active\" = 1\n" +
|
||||||
"ORDER BY p.sort")
|
"ORDER BY p.\"sort\"")
|
||||||
List<Permission> listByUserId(Long userId);
|
List<Permission> listByUserId(Long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
<select id="getCompany" resultType="com.bonus.system.api.domain.SelectBean">
|
<select id="getCompany" resultType="com.bonus.system.api.domain.SelectBean">
|
||||||
SELECT "id","name" FROM "ynrealname"."pm_company"
|
SELECT "id","name" FROM "ynrealname"."pm_company"
|
||||||
WHERE IS_ACTIVE = '1'
|
WHERE "is_active" = '1'
|
||||||
<if test="companyId != null and companyId != ''">
|
<if test="companyId != null and companyId != ''">
|
||||||
AND "id" = #{companyId}
|
AND "id" = #{companyId}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
WHERE bp."is_active" = '1'
|
WHERE bp."is_active" = '1'
|
||||||
<if test="companyId != null and companyId != ''">
|
<if test="companyId != null and companyId != ''">
|
||||||
and bp."company_id" = (
|
and bp."company_id" = (
|
||||||
SELECT "id" FROM "ynrealname"."pm_organization" WHERE "is_active" = '1' and PARENT_ID = '0' and "foreign_id" = #{companyId})
|
SELECT "id" FROM "ynrealname"."pm_organization" WHERE "is_active" = '1' and "parent_id" = '0' and "foreign_id" = #{companyId})
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -43,19 +43,19 @@
|
||||||
|
|
||||||
<select id="getCompanyAndSubCompany" resultType="com.bonus.system.api.domain.SelectBean">
|
<select id="getCompanyAndSubCompany" resultType="com.bonus.system.api.domain.SelectBean">
|
||||||
SELECT
|
SELECT
|
||||||
ID,
|
"id",
|
||||||
NAME,
|
"name",
|
||||||
CASE WHEN "company_id" = "foreign_id" THEN 1 ELSE 2 END as type
|
CASE WHEN "company_id" = "foreign_id" THEN 1 ELSE 2 END as type
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."pm_organization"
|
"ynrealname"."pm_organization"
|
||||||
WHERE
|
WHERE
|
||||||
IS_ACTIVE = '1'
|
"is_active" = '1'
|
||||||
AND "foreign_id" IS NOT NULL
|
AND "foreign_id" IS NOT NULL
|
||||||
<if test="orgId != null and orgId != '' and roleLevel < 3 and roleLevel > 1">
|
<if test="orgId != null and orgId != '' and roleLevel < 3 and roleLevel > 1">
|
||||||
AND INSTR(ID, getParentList(#{orgId})) > 0
|
AND INSTR("id", getParentList(#{orgId})) > 0
|
||||||
</if>
|
</if>
|
||||||
<if test="orgId != null and orgId != '' and roleLevel >= 3">
|
<if test="orgId != null and orgId != '' and roleLevel >= 3">
|
||||||
AND INSTR(ID, getParentList(#{orgId})) > 0
|
AND INSTR("id", getParentList(#{orgId})) > 0
|
||||||
OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY
|
OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
<select id="getPrincipal" resultType="com.bonus.system.api.domain.SelectBean">
|
<select id="getPrincipal" resultType="com.bonus.system.api.domain.SelectBean">
|
||||||
SELECT
|
SELECT
|
||||||
su."id",
|
su."id",
|
||||||
su."username" AS NAME,
|
su."username" AS "name",
|
||||||
COUNT(DISTINCT bp."id") as proNum,
|
COUNT(DISTINCT bp."id") as proNum,
|
||||||
<![CDATA[ NVL(WM_CONCAT(bp."name"||'<br/>') ,'无')as proName ]]>
|
<![CDATA[ NVL(WM_CONCAT(bp."name"||'<br/>') ,'无')as proName ]]>
|
||||||
FROM
|
FROM
|
||||||
|
|
@ -106,16 +106,16 @@
|
||||||
SELECT bp."id",bp."name"
|
SELECT bp."id",bp."name"
|
||||||
FROM "ynrealname"."pm_organization" pmo
|
FROM "ynrealname"."pm_organization" pmo
|
||||||
LEFT JOIN "ynrealname"."bm_project" bp ON pmo."id" = bp."company_id" AND bp."is_active" = '1'
|
LEFT JOIN "ynrealname"."bm_project" bp ON pmo."id" = bp."company_id" AND bp."is_active" = '1'
|
||||||
WHERE pmo.ID = #{orgId}
|
WHERE pmo."id" = #{orgId}
|
||||||
<if test="type == 1">
|
<if test="type == 1">
|
||||||
AND bp."pro_status" IN (0,2,3)
|
AND bp."pro_status" IN (0,2,3)
|
||||||
</if>
|
</if>
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT bp."id" ,bp."name"
|
SELECT bp."id" ,bp."name"
|
||||||
FROM "ynrealname"."pm_organization" pmo
|
FROM "ynrealname"."pm_organization" pmo
|
||||||
LEFT JOIN "ynrealname"."pm_organization" pmo2 ON pmo."id" = pmo2.PARENT_ID AND pmo2.IS_ACTIVE = '1'
|
LEFT JOIN "ynrealname"."pm_organization" pmo2 ON pmo."id" = pmo2."parent_id" AND pmo2."is_active" = '1'
|
||||||
LEFT JOIN "ynrealname"."bm_project" bp ON pmo2."id" = bp."company_id" AND bp."is_active" = '1'
|
LEFT JOIN "ynrealname"."bm_project" bp ON pmo2."id" = bp."company_id" AND bp."is_active" = '1'
|
||||||
WHERE pmo.ID = 1 AND NVL(bp."name",'1') = bp."name"
|
WHERE pmo."id" = 1 AND NVL(bp."name",'1') = bp."name"
|
||||||
<if test="type == 1">
|
<if test="type == 1">
|
||||||
AND bp."pro_status" IN (0,2,3)
|
AND bp."pro_status" IN (0,2,3)
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -160,7 +160,7 @@
|
||||||
<select id="getPlanAuditor" resultType="com.bonus.system.api.domain.SelectBean">
|
<select id="getPlanAuditor" resultType="com.bonus.system.api.domain.SelectBean">
|
||||||
SELECT
|
SELECT
|
||||||
su."id",
|
su."id",
|
||||||
su."username" AS name
|
su."username" AS "name"
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."sys_user" su
|
"ynrealname"."sys_user" su
|
||||||
LEFT JOIN "ynrealname"."sys_role_user" sru ON sru."userId" = su."id"
|
LEFT JOIN "ynrealname"."sys_role_user" sru ON sru."userId" = su."id"
|
||||||
|
|
@ -193,7 +193,7 @@
|
||||||
<select id="getCompanyPlanAuditor" resultType="com.bonus.system.api.domain.SelectBean">
|
<select id="getCompanyPlanAuditor" resultType="com.bonus.system.api.domain.SelectBean">
|
||||||
SELECT
|
SELECT
|
||||||
t."id",
|
t."id",
|
||||||
t."username" AS name
|
t."username" AS "name"
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."sys_user" t
|
"ynrealname"."sys_user" t
|
||||||
LEFT JOIN "ynrealname"."sys_role_user" sru ON sru."roleId" = t."id"
|
LEFT JOIN "ynrealname"."sys_role_user" sru ON sru."roleId" = t."id"
|
||||||
|
|
@ -238,9 +238,9 @@
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."pm_organization"
|
"ynrealname"."pm_organization"
|
||||||
WHERE
|
WHERE
|
||||||
PARENT_ID = '1'
|
"parent_id" = '1'
|
||||||
AND "foreign_id" IS NOT NULL
|
AND "foreign_id" IS NOT NULL
|
||||||
AND IS_ACTIVE = '1'
|
AND "is_active" = '1'
|
||||||
<if test="orgId != null and orgId != '' ">
|
<if test="orgId != null and orgId != '' ">
|
||||||
and "id" = #{orgId}
|
and "id" = #{orgId}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -250,7 +250,7 @@
|
||||||
<select id="getTeamByProId" resultType="com.bonus.system.api.domain.SelectBean">
|
<select id="getTeamByProId" resultType="com.bonus.system.api.domain.SelectBean">
|
||||||
SELECT
|
SELECT
|
||||||
bst."id",
|
bst."id",
|
||||||
bst."team_name" as name
|
bst."team_name" as "name"
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."bm_sub_contract" bsc
|
"ynrealname"."bm_sub_contract" bsc
|
||||||
LEFT JOIN "ynrealname"."bm_sub_relation" bsr ON bsr."sub_contract_id" = bsc."id"
|
LEFT JOIN "ynrealname"."bm_sub_relation" bsr ON bsr."sub_contract_id" = bsc."id"
|
||||||
|
|
@ -292,7 +292,7 @@
|
||||||
|
|
||||||
<select id="getCertificateSub" resultType="com.bonus.system.api.domain.SelectBean">
|
<select id="getCertificateSub" resultType="com.bonus.system.api.domain.SelectBean">
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT CASE WHEN (bsct."name" IS NULL OR bsct."name" = '') THEN bsc."name" ELSE bsct."name" END AS name
|
DISTINCT CASE WHEN (bsct."name" IS NULL OR bsct."name" = '') THEN bsc."name" ELSE bsct."name" END AS "name"
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."bm_subcontractor" bs
|
"ynrealname"."bm_subcontractor" bs
|
||||||
LEFT JOIN "ynrealname"."bm_subcontractor_certificate" bsc ON bsc."sub_id" = bs."id" AND bsc."is_active" = '1'
|
LEFT JOIN "ynrealname"."bm_subcontractor_certificate" bsc ON bsc."sub_id" = bs."id" AND bsc."is_active" = '1'
|
||||||
|
|
@ -334,7 +334,7 @@
|
||||||
<if test="level != null and level != ''">
|
<if test="level != null and level != ''">
|
||||||
and sr."level" = #{level}
|
and sr."level" = #{level}
|
||||||
</if>
|
</if>
|
||||||
order by sr."id" DESC
|
order by sr."id" DESC
|
||||||
</select>
|
</select>
|
||||||
<select id="getProBySubId" resultType="com.bonus.system.api.domain.SelectBean">
|
<select id="getProBySubId" resultType="com.bonus.system.api.domain.SelectBean">
|
||||||
SELECT
|
SELECT
|
||||||
|
|
@ -351,17 +351,17 @@
|
||||||
</select>
|
</select>
|
||||||
<select id="getSubCompanyBySonId" resultType="com.bonus.system.api.domain.SelectBean">
|
<select id="getSubCompanyBySonId" resultType="com.bonus.system.api.domain.SelectBean">
|
||||||
WITH RECURSIVE org_tree("id", "parent_id", "level") AS (
|
WITH RECURSIVE org_tree("id", "parent_id", "level") AS (
|
||||||
SELECT ID, PARENT_ID, 1 as "level"
|
SELECT "id", "parent_id", 1 as "level"
|
||||||
FROM "ynrealname"."pm_organization"
|
FROM "ynrealname"."pm_organization"
|
||||||
WHERE ID = #{orgId}
|
WHERE "id" = #{orgId}
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT p.ID, p.PARENT_ID, ot."level" + 1
|
SELECT p."id", p."parent_id", ot."level" + 1
|
||||||
FROM "ynrealname"."pm_organization" p
|
FROM "ynrealname"."pm_organization" p
|
||||||
INNER JOIN org_tree ot ON p.ID = ot."parent_id"
|
INNER JOIN org_tree ot ON p."id" = ot."parent_id"
|
||||||
WHERE p.PARENT_ID > 0
|
WHERE p."parent_id" > 0
|
||||||
)
|
)
|
||||||
SELECT ot."id" as orgId,
|
SELECT ot."id" as orgId,
|
||||||
(SELECT NAME FROM "ynrealname"."pm_organization" WHERE ID = ot."id" AND IS_ACTIVE = '1') AS orgName,
|
(SELECT "name" FROM "ynrealname"."pm_organization" WHERE "id" = ot."id" AND "is_active" = '1') AS orgName,
|
||||||
ot."parent_id" as parentId,
|
ot."parent_id" as parentId,
|
||||||
ot."level"
|
ot."level"
|
||||||
FROM org_tree ot
|
FROM org_tree ot
|
||||||
|
|
@ -371,14 +371,14 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getCerSub" resultType="com.bonus.system.api.domain.SelectBean">
|
<select id="getCerSub" resultType="com.bonus.system.api.domain.SelectBean">
|
||||||
SELECT "id","sub_name" as name FROM "ynrealname"."bm_subcontractor" where "is_active" = '1'
|
SELECT "id","sub_name" as "name" FROM "ynrealname"."bm_subcontractor" where "is_active" = '1'
|
||||||
<if test="subId != null and subId != ''">
|
<if test="subId != null and subId != ''">
|
||||||
and "id" = #{subId}
|
and "id" = #{subId}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getAttendanceMachineByProId" resultType="com.bonus.system.api.domain.SelectBean">
|
<select id="getAttendanceMachineByProId" resultType="com.bonus.system.api.domain.SelectBean">
|
||||||
select bam."id", bam."attendance_machine_id" as name
|
select bam."id", bam."attendance_machine_id" as "name"
|
||||||
from "ynrealname"."bm_attendance_machine" bam
|
from "ynrealname"."bm_attendance_machine" bam
|
||||||
left join "ynrealname"."bm_attendance_machine_pro_relation" bamr on bamr."attendance_machine_id" = bam."id" and bamr."is_active" = 1
|
left join "ynrealname"."bm_attendance_machine_pro_relation" bamr on bamr."attendance_machine_id" = bam."id" and bamr."is_active" = 1
|
||||||
left join "ynrealname"."bm_project" bp on bp."id" = bamr."pro_id"
|
left join "ynrealname"."bm_project" bp on bp."id" = bamr."pro_id"
|
||||||
|
|
@ -390,17 +390,17 @@
|
||||||
|
|
||||||
<select id="getTwoComById" resultType="java.lang.String">
|
<select id="getTwoComById" resultType="java.lang.String">
|
||||||
WITH RECURSIVE org_tree("id", "parent_id", "level") AS (
|
WITH RECURSIVE org_tree("id", "parent_id", "level") AS (
|
||||||
SELECT ID, PARENT_ID, 1 as "level"
|
SELECT "id", "parent_id", 1 as "level"
|
||||||
FROM "ynrealname"."pm_organization"
|
FROM "ynrealname"."pm_organization"
|
||||||
WHERE ID = #{orgId}
|
WHERE "id" = #{orgId}
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT p.ID, p.PARENT_ID, ot."level" + 1
|
SELECT p."id", p."parent_id", ot."level" + 1
|
||||||
FROM "ynrealname"."pm_organization" p
|
FROM "ynrealname"."pm_organization" p
|
||||||
INNER JOIN org_tree ot ON p.ID = ot."parent_id"
|
INNER JOIN org_tree ot ON p."id" = ot."parent_id"
|
||||||
WHERE p.PARENT_ID > 0
|
WHERE p."parent_id" > 0
|
||||||
)
|
)
|
||||||
SELECT ot."id" as orgId,
|
SELECT ot."id" as orgId,
|
||||||
(SELECT NAME FROM "ynrealname"."pm_organization" WHERE ID = ot."id" AND IS_ACTIVE = '1') AS orgName,
|
(SELECT "name" FROM "ynrealname"."pm_organization" WHERE "id" = ot."id" AND "is_active" = '1') AS orgName,
|
||||||
ot."parent_id" as parentId,
|
ot."parent_id" as parentId,
|
||||||
ot."level"
|
ot."level"
|
||||||
FROM org_tree ot
|
FROM org_tree ot
|
||||||
|
|
@ -442,6 +442,6 @@
|
||||||
WHERE eqb."is_active" = '1'
|
WHERE eqb."is_active" = '1'
|
||||||
</select>
|
</select>
|
||||||
<select id="getTDict" resultType="com.bonus.system.api.domain.SelectBean">
|
<select id="getTDict" resultType="com.bonus.system.api.domain.SelectBean">
|
||||||
select t."value" as name,"id" as id from "ynrealname"."t_dict" t where t."type" = #{type} and t."is_active" = '1'
|
select t."value" as "name","id" as "id" from "ynrealname"."t_dict" t where t."type" = #{type} and t."is_active" = '1'
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -9,9 +9,9 @@
|
||||||
t."id_number" as idNumber,
|
t."id_number" as idNumber,
|
||||||
t."phone" as phonenumber,
|
t."phone" as phonenumber,
|
||||||
po."company_id" as companyId,
|
po."company_id" as companyId,
|
||||||
po."NAME" as companyName,
|
po."name" as companyName,
|
||||||
t."org_id" as orgId,
|
t."org_id" as orgId,
|
||||||
po."PARENT_ID" as parentId,
|
po."parent_id" as parentId,
|
||||||
t."pro_id" as proId,
|
t."pro_id" as proId,
|
||||||
t."sub_id" as subId,
|
t."sub_id" as subId,
|
||||||
sru."roleId",
|
sru."roleId",
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
t."password",
|
t."password",
|
||||||
btur."team_id" as teamId
|
btur."team_id" as teamId
|
||||||
FROM "ynrealname"."sys_user" t
|
FROM "ynrealname"."sys_user" t
|
||||||
LEFT JOIN "ynrealname"."pm_organization" po on po."ID" = t."org_id" and po."IS_ACTIVE" = 1
|
LEFT JOIN "ynrealname"."pm_organization" po on po."id" = t."org_id" and po."is_active" = 1
|
||||||
left join "ynrealname"."sys_role_user" sru on sru."userId" = t."id" and sru."is_active" = 1
|
left join "ynrealname"."sys_role_user" sru on sru."userId" = t."id" and sru."is_active" = 1
|
||||||
left join "ynrealname"."sys_role" sr on sr."id" = sru."roleId" and sr."is_active" = 1
|
left join "ynrealname"."sys_role" sr on sr."id" = sru."roleId" and sr."is_active" = 1
|
||||||
left join "ynrealname"."bm_team_user_relation" btur on btur."id_number" = t."id_number" and btur."is_active" = 1
|
left join "ynrealname"."bm_team_user_relation" btur on btur."id_number" = t."id_number" and btur."is_active" = 1
|
||||||
|
|
@ -31,33 +31,33 @@
|
||||||
<select id="selectProOrgByTeamId" resultType="com.bonus.system.api.domain.SysUser">
|
<select id="selectProOrgByTeamId" resultType="com.bonus.system.api.domain.SysUser">
|
||||||
select bsc."pro_id" as proId,
|
select bsc."pro_id" as proId,
|
||||||
po."company_id" as companyId,
|
po."company_id" as companyId,
|
||||||
po.NAME as companyName,
|
po."name" as companyName,
|
||||||
bp."company_id" as orgId
|
bp."company_id" as orgId
|
||||||
from "ynrealname"."bm_sub_relation" bsr
|
from "ynrealname"."bm_sub_relation" bsr
|
||||||
left join "ynrealname"."bm_sub_contract" bsc on bsc."id" = bsr."sub_contract_id" and bsc."is_active" = 1
|
left join "ynrealname"."bm_sub_contract" bsc on bsc."id" = bsr."sub_contract_id" and bsc."is_active" = 1
|
||||||
left join "ynrealname"."bm_project" bp on bp."id" = bsc."pro_id" and bp."is_active" = 1
|
left join "ynrealname"."bm_project" bp on bp."id" = bsc."pro_id" and bp."is_active" = 1
|
||||||
LEFT JOIN "ynrealname"."pm_organization" po on po.ID = bp."company_id" and po.IS_ACTIVE = 1
|
LEFT JOIN "ynrealname"."pm_organization" po on po."id" = bp."company_id" and po."is_active" = 1
|
||||||
where bsr."is_active" = 1 and bsr."type" = 3 and bsr."value" = #{teamId}
|
where bsr."is_active" = 1 and bsr."type" = 3 and bsr."value" = #{teamId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getSubCompany" resultType="com.bonus.system.api.domain.SelectBean">
|
<select id="getSubCompany" resultType="com.bonus.system.api.domain.SelectBean">
|
||||||
WITH RECURSIVE org_tree (orgId, orgName, parentId, level) AS (
|
WITH RECURSIVE org_tree (orgId, orgName, parentId, level) AS (
|
||||||
SELECT
|
SELECT
|
||||||
ID,
|
"id",
|
||||||
NAME,
|
"name",
|
||||||
PARENT_ID,
|
"parent_id",
|
||||||
1
|
1
|
||||||
FROM "ynrealname"."pm_organization"
|
FROM "ynrealname"."pm_organization"
|
||||||
WHERE ID = 2 AND IS_ACTIVE = '1'
|
WHERE "id" = 2 AND "is_active" = '1'
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT
|
SELECT
|
||||||
p.ID,
|
p."id",
|
||||||
p.NAME,
|
p."name",
|
||||||
p.PARENT_ID,
|
p."parent_id",
|
||||||
t.level + 1
|
t.level + 1
|
||||||
FROM "ynrealname"."pm_organization" p
|
FROM "ynrealname"."pm_organization" p
|
||||||
INNER JOIN org_tree t ON p.ID = t.parentId
|
INNER JOIN org_tree t ON p."id" = t.parentId
|
||||||
WHERE p.IS_ACTIVE = '1' AND p.PARENT_ID > 0
|
WHERE p."is_active" = '1' AND p."parent_id" > 0
|
||||||
)
|
)
|
||||||
SELECT orgId, orgName, parentId, level
|
SELECT orgId, orgName, parentId, level
|
||||||
FROM org_tree
|
FROM org_tree
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue