Skip to content

Commit

Permalink
1.fix use function in where conditions column
Browse files Browse the repository at this point in the history
  • Loading branch information
ssignik committed Jan 2, 2025
1 parent eda4ab0 commit 99cb978
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions openeulerSever/src/main/resources/mapper/SoftwareMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
</resultMap>

<resultMap id="SoftwareStatisticsMap" type="com.huawei.it.euler.ddd.domain.software.SoftwareStatistics">
<result column="sum" property="count"/>
<result column="certification_time" property="datePeriod"/>
<result column="test_organization" property="testOrganization"/>
<result column="product_type" property="productType"/>
Expand Down Expand Up @@ -524,27 +523,12 @@

<select id="statistics" parameterType="com.huawei.it.euler.ddd.service.software.cqe.SoftwareStatisticsQuery" resultMap="SoftwareStatisticsMap">
SELECT
1 AS sum,
product_type,
certification_time,
test_organization
FROM
software_t
WHERE
delete_flag = 0
AND `status` = 9
<if test="beginDate != null">
and DATE_FORMAT(certification_time,'%Y-%m-%d') &gt;= DATE_FORMAT(#{beginDate},'%Y-%m-%d')
</if>
<if test="endDate != null">
and DATE_FORMAT(certification_time,'%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate},'%Y-%m-%d')
</if>
<if test="testOrgIdList != null and testOrgIdList.size() > 0">
and test_org_id in
<foreach collection="testOrgIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<include refid="whereStatistics"/>
GROUP BY
product_type,
certification_time,
Expand All @@ -553,5 +537,22 @@
test_organization,
certification_time;
</select>

<sql id="whereStatistics">
<where>
delete_flag = 0
AND `status` = 9
<if test="beginDate != null">
and DATE_FORMAT(certification_time,'%Y-%m-%d') &gt;= DATE_FORMAT(#{beginDate},'%Y-%m-%d')
</if>
<if test="endDate != null">
and DATE_FORMAT(certification_time,'%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate},'%Y-%m-%d')
</if>
<if test="testOrgIdList != null and testOrgIdList.size() > 0">
and test_org_id in
<foreach collection="testOrgIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</sql>
</mapper>

0 comments on commit 99cb978

Please sign in to comment.