分組統計用戶數

<select id="countUser" parameterType="tf56.teamwork.query.TwmCountUserQuery" resultType="tf56.teamwork.query.TwmCustomerOperationLogsCount">
		Select inputManName,count(*) count from TwmCustomerOperationLogs
		<where>
			<if test="startTime != null and startTime != ''">
				<![CDATA[ inputDate >= #{startTime}]]>
			</if>
			<if test="endTime != null and endTime != ''">
				<![CDATA[ AND inputDate <= #{endTime}]]>
			</if>
			<if test="null != antUid and antUid.size > 0 " >
				AND inputManId IN
				<foreach collection="antUid" index="index" item="item" separator="," open="(" close=")">
					#{item}
				</foreach>
			</if>
		</where>
		GROUP BY inputManName
	</select>

resultMap和resultType使用

<select id="getTwmCustomerOperationLogs" parameterType="tf56.teamwork.domain.TwmCustomerOperationLogs" resultMap="twmcustomeroperationlogsFieldMap">
		SELECT
		customerStatus,
		MAX(changeStautusTime) changeStautusTime
		FROM TwmCustomerOperationLogs
		<where>
			<if test="customerCode != null and customerCode.toString() != '' " > customerCode = #{customerCode,jdbcType=VARCHAR}</if>
			AND changeStautusTime is not null
		</where>
		GROUP BY customerStatus
</select>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章