develop
parent
9071d3dd1a
commit
b6088a779e
|
@ -204,11 +204,11 @@ public class InstanceRepository extends BasicGenericDao<Instance, Long> {
|
||||||
return sqlBuilder.toString();
|
return sqlBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildSql(String instanceTable, String instanceValueTable, String moduleId, Long userId, boolean hasAdminRole, String positionKey) throws Exception {
|
private String buildSql(String instanceTable, String instanceValueTable, String moduleId, Long userId, boolean hasAdminRole, String positionKey) throws Exception {
|
||||||
// 行转列的表头
|
// 行转列的表头
|
||||||
String sql;
|
String sql;
|
||||||
if (StringUtils.isNotEmpty(positionKey)) {
|
if (StringUtils.isNotEmpty(positionKey)) {
|
||||||
sql = "SELECT GROUP_CONCAT('MAX(IF(P.ID = ',P.id,',INSV.PROPERTY_VALUE,NULL)) AS ''',P.code,'''') as sqlResult" + " from " +positionKey+".ci_property AS P where P.is_deleted = 0 and P.module_id=" + moduleId;
|
sql = "SELECT GROUP_CONCAT('MAX(IF(P.ID = ',P.id,',INSV.PROPERTY_VALUE,NULL)) AS ''',P.code,'''') as sqlResult" + " from " + positionKey + ".ci_property AS P where P.is_deleted = 0 and P.module_id=" + moduleId;
|
||||||
} else {
|
} else {
|
||||||
sql = "SELECT GROUP_CONCAT('MAX(IF(P.ID = ',P.id,',INSV.PROPERTY_VALUE,NULL)) AS ''',P.code,'''') as sqlResult" + " from ci_property AS P where P.is_deleted = 0 and P.module_id=" + moduleId;
|
sql = "SELECT GROUP_CONCAT('MAX(IF(P.ID = ',P.id,',INSV.PROPERTY_VALUE,NULL)) AS ''',P.code,'''') as sqlResult" + " from ci_property AS P where P.is_deleted = 0 and P.module_id=" + moduleId;
|
||||||
}
|
}
|
||||||
|
@ -228,13 +228,13 @@ public class InstanceRepository extends BasicGenericDao<Instance, Long> {
|
||||||
sqlBuilder.append(" FROM " + instanceTable + " INS");
|
sqlBuilder.append(" FROM " + instanceTable + " INS");
|
||||||
sqlBuilder.append(" LEFT JOIN " + instanceValueTable + " AS INSV ON INS.ID = INSV.instance_id and INSV.is_deleted=0 ");
|
sqlBuilder.append(" LEFT JOIN " + instanceValueTable + " AS INSV ON INS.ID = INSV.instance_id and INSV.is_deleted=0 ");
|
||||||
if (StringUtils.isNotEmpty(positionKey)) {
|
if (StringUtils.isNotEmpty(positionKey)) {
|
||||||
sqlBuilder.append(" LEFT JOIN" +positionKey+".ci_property AS P ON INS.module_id = P.module_id and INSV.property_id=P.id ");
|
sqlBuilder.append(" LEFT JOIN " + positionKey + ".ci_property AS P ON INS.module_id = P.module_id and INSV.property_id=P.id ");
|
||||||
} else {
|
} else {
|
||||||
sqlBuilder.append(" LEFT JOIN ci_property AS P ON INS.module_id = P.module_id and INSV.property_id=P.id ");
|
sqlBuilder.append(" LEFT JOIN ci_property AS P ON INS.module_id = P.module_id and INSV.property_id=P.id ");
|
||||||
}
|
}
|
||||||
if (!hasAdminRole) {
|
if (!hasAdminRole) {
|
||||||
if (StringUtils.isNotEmpty(positionKey)) {
|
if (StringUtils.isNotEmpty(positionKey)) {
|
||||||
sqlBuilder.append(" LEFT JOIN" +positionKey+".ci_instance_authority AU on INS.module_id = AU.module_id and INS.id = AU.instance_id");
|
sqlBuilder.append(" LEFT JOIN " + positionKey + ".ci_instance_authority AU on INS.module_id = AU.module_id and INS.id = AU.instance_id");
|
||||||
} else {
|
} else {
|
||||||
sqlBuilder.append(" LEFT JOIN ci_instance_authority AU on INS.module_id = AU.module_id and INS.id = AU.instance_id");
|
sqlBuilder.append(" LEFT JOIN ci_instance_authority AU on INS.module_id = AU.module_id and INS.id = AU.instance_id");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue