Commit 416ad1c6 authored by neo.wang's avatar neo.wang

Merge branch 'dev_neo' into 'dev'

[DEV] fixed template group self defind sql

See merge request root/atms!43
parents acfd3c60 940f57c3
...@@ -279,18 +279,28 @@ ...@@ -279,18 +279,28 @@
<result column="TemplateGroupName" jdbcType="VARCHAR" property="templateGroupName" /> <result column="TemplateGroupName" jdbcType="VARCHAR" property="templateGroupName" />
</resultMap> </resultMap>
<select id="getSingleOrgByOrgIDToOSTGDto" parameterType="map" resultMap="OrganizationServiceTemplateGroupDto"> <select id="getSingleOrgByOrgIDToOSTGDto" parameterType="map" resultMap="OrganizationServiceTemplateGroupDto">
select SELECT
m.ID as ID, m.ID AS ID,
m.ServiceTypeID as ServiceTypeID, m.service_type_id AS ServiceTypeID,
m.OrganizationID as OrganizationID, m.organization_id AS OrganizationID,
m.TemplateGroupID as TemplateGroupID, m.template_group_id AS TemplateGroupID,
t.Name as TemplateGroupName t.Name AS TemplateGroupName
from OrganizationServiceTemplateGroup as m FROM
left join TemplateGroup as t on m.TemplateGroupID = t.ID organization_service_template_group AS m
where m.OrganizationID = #{orgId} LEFT JOIN
order by m.ServiceTypeID template_group AS t ON m.template_group_id = t.ID
WHERE
m.organization_id = #{orgId}
order by m.service_type_id
</select> </select>
<select id="getOrgnizationServiceTemplateGroupOrgNames" parameterType="java.lang.String" resultType="java.lang.String"> <select id="getOrgnizationServiceTemplateGroupOrgNames" parameterType="java.lang.String" resultType="java.lang.String">
SELECT q.Name FROM OrganizationServiceTemplateGroup p LEFT JOIN Organization q on p.OrganizationID=q.ID WHERE p.TemplateGroupID=#{templateGroupDtoID,jdbcType=VARCHAR} AND q.IsActive=1 SELECT
q.Name
FROM
organization_service_template_group p
LEFT JOIN
Organization q ON p.organization_id = q.ID
WHERE
p.template_group_id = #{templateGroupDtoID,jdbcType=VARCHAR} AND q.IsActive = 1
</select> </select>
</mapper> </mapper>
\ No newline at end of file
package pwc.taxtech.atms; package pwc.taxtech.atms;
import pwc.taxtech.atms.dto.taxadmin.ProjectDisplayDto;
import pwc.taxtech.atms.entitiy.Project;
import java.lang.reflect.Field; import java.lang.reflect.Field;
public class FieldsCompare { public class FieldsCompare {
...@@ -12,18 +9,30 @@ public class FieldsCompare { ...@@ -12,18 +9,30 @@ public class FieldsCompare {
Field[] declaredFields = destClass.getDeclaredFields(); Field[] declaredFields = destClass.getDeclaredFields();
Field[] clsFields = clsSource.getDeclaredFields(); Field[] clsFields = clsSource.getDeclaredFields();
System.out.println(destClass.getName());
System.out.println();
System.out.println(clsSource.getName());
System.out.println(clsFields.toString());
System.out.println(clsSource.getName() + ":" + clsFields.length);
System.out.println(destClass.getName() + ":" + declaredFields.length);
System.out.println(clsSource.getName()+":"+clsFields.length); Field[] fieldsMax = null;
System.out.println(destClass.getName()+":"+declaredFields.length); Field[] fieldsMin = null;
Class fieldsMaxClass = null;
Class fieldsMinClass = null;
if (declaredFields.length > clsFields.length) {
fieldsMax = declaredFields;
fieldsMin = clsFields;
Field[] fieldsMax=null; fieldsMaxClass = destClass;
Class fieldsMinClass=null; fieldsMinClass = clsSource;
if(declaredFields.length>clsFields.length){ } else {
fieldsMax=declaredFields; fieldsMax = clsFields;
fieldsMinClass=clsSource; fieldsMaxClass = clsSource;
}else {
fieldsMax=clsFields; fieldsMin = declaredFields;
fieldsMinClass=destClass; fieldsMinClass = destClass;
} }
for (Field field : fieldsMax) { for (Field field : fieldsMax) {
...@@ -36,12 +45,26 @@ public class FieldsCompare { ...@@ -36,12 +45,26 @@ public class FieldsCompare {
fieldsMinClass.getDeclaredField(fieldName); fieldsMinClass.getDeclaredField(fieldName);
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
System.out.println("NoSuchFieldException "+fieldsMinClass.getName()+ "."+ fieldName); System.out.println("NoSuchFieldException " + fieldsMinClass.getName() + "." + fieldName);
}
}
for (Field field : fieldsMin) {
field.setAccessible(true);
String fieldName = field.getName();
try {
if ("serialVersionUID".equals(fieldName)) {
continue;
}
fieldsMaxClass.getDeclaredField(fieldName);
} catch (NoSuchFieldException e) {
System.out.println("NoSuchFieldException " + fieldsMaxClass.getName() + "." + fieldName);
} }
} }
} }
public static void main(String[] args) throws IllegalAccessException, ClassNotFoundException { public static void main(String[] args) throws IllegalAccessException, ClassNotFoundException {
map(new Project(),new ProjectDisplayDto()); // map(new CompanyBalanceDto(), new CompanyBalance());
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment