List<QualityDataOfAppDto> findQualityDataOfAppDtoByDeptNoAndAoneProductId(
@Param("deptNo") Long deptNo,
@Param("aoneProductId") Long aoneProductId);
<select id="findQualityDataOfAppDtoByDeptNoAndAoneProductId"
resultType="com.alibaba.swork.info.common.dto.QualityDataOfAppDto">
SELECT
a.id id,
a.gmt_create gmtCreate,
a.gmt_modified gmtModified,
a.app_id appId,
a.app_name appName,
a.dept_no deptNo,
a.dept_name deptName,
a.aone_product_id aoneProductId,
a.aone_product_name aoneProductName,
a.app_score appScore,
a.line_count lineCount,
a.complexity complexity,
a.duplication duplication,
a.comment_rate commentRate,
a.ut_rate utRate,
a.ui_rate uiRate,
a.it_rate itRate,
a.static_code_check_value1 staticCodeCheckValue1,
a.static_code_check_value2 staticCodeCheckValue2,
a.static_code_check_value3 staticCodeCheckValue3,
a.static_code_check_value4 staticCodeCheckValue4,
a.date_stamp dateStamp,
a.deviation deviation,
v.base_value appScoreBaseValue,
b.app_score appScoreRelative,
b.complexity complexityRelative,
b.duplication duplicationRelative,
b.comment_rate commentRateRelative,
b.ut_rate utRateRelative,
b.ui_rate uiRateRelative,
b.it_rate itRateRelative,
b.static_code_check_value1 staticCodeCheckValue1Relative,
b.static_code_check_value2 staticCodeCheckValue2Relative,
b.static_code_check_value3 staticCodeCheckValue3Relative
FROM quality_data_of_app a
LEFT JOIN quality_data_app_base_value v on a.app_id = v.app_id
LEFT JOIN quality_data_of_app b ON a.app_id = b.app_id
AND a.date_stamp =
(SELECT max(date_stamp) FROM quality_data_of_app)
AND b.date_stamp =
(SELECT date_add(max(date_stamp), INTERVAL -1 DAY) FROM quality_data_of_app)
WHERE a.date_stamp =
(SELECT max(date_stamp) FROM quality_data_of_app)
<if test='deptNo != null and deptNo != 0 '>
AND a.dept_name LIKE
(SELECT concat( (select dept_name FROM department WHERE dept_no = #{deptNo}),'%'))
</if>
<if test='aoneProductId != null and aoneProductId != 0 '>
AND a.aone_product_id = #{aoneProductId}
</if>
ORDER BY lineCount desc
</select>