mapper.xml 返回map格式

发布时间 2023-10-09 14:33:12作者: wjbk
//DAO层

List<Map<String,Object>> selectRecord(Map<String,Object>map);

 

 

//mapper层

<select id="selectUpCountByTime" parameterType="map" resultType="java.util.HashMap">
  SELECT create_by as username,DATE_FORMAT(create_time,'%Y-%m-%d') as dates,count(0) as counts FROM t_break_rule
  <where>
  del_flag='0'
  <if test="startTime != null">
    and DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') &gt;= DATE_FORMAT(#{startTime,jdbcType=TIMESTAMP},'%Y-%m-%d %H:%i:%S')
  </if>
  <if test="endTime != null">
    and DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') &lt;= DATE_FORMAT(#{endTime,jdbcType=TIMESTAMP},'%Y-%m-%d %H:%i:%S')
  </if>
  </where>
  GROUP BY create_by ,DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY DATE_FORMAT(create_time,'%Y-%m-%d') ASC
</select>