MarketLogMapper.xml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.dayou.mapper.MarketLogMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.dayou.entity.MarketLog">
  6. <result column="id" property="id" />
  7. <result column="deleted" property="deleted" />
  8. <result column="created" property="created" />
  9. <result column="modified" property="modified" />
  10. <result column="user_id" property="userId" />
  11. <result column="task_situation" property="taskSituation" />
  12. <result column="log_date" property="logDate" />
  13. </resultMap>
  14. <!-- 通用查询结果列 -->
  15. <sql id="Base_Column_List">
  16. ml.id,
  17. ml.deleted,
  18. ml.created,
  19. ml.modified,
  20. ml.user_id, ml.task_situation, ml.log_date
  21. </sql>
  22. <select id="getList" resultType="com.dayou.vo.ItemUserLogVO">
  23. select <include refid="Base_Column_List"/>,u.name as userName
  24. from market_log ml left join user u on u.id = ml.user_id
  25. where u.deleted = 0 and ml.deleted = 0
  26. <choose>
  27. <when test="startDate!=null">
  28. and ml.log_date &gt;= #{startDate}
  29. </when>
  30. <otherwise>
  31. and ml.log_date &gt;= date_add(curDate(),INTERVAL -10 DAY)
  32. </otherwise>
  33. </choose>
  34. <choose>
  35. <when test="endDate!=null">
  36. and ml.log_date &lt;= #{endDate}
  37. </when>
  38. <otherwise>
  39. and ml.log_date &lt;= curDate()
  40. </otherwise>
  41. </choose>
  42. <if test="userIds!=null and userIds.size!=0">
  43. and ml.user_id in
  44. <foreach collection="userIds" open="(" close=")" separator="," item="userId">
  45. #{userId}
  46. </foreach>
  47. </if>
  48. </select>
  49. </mapper>