CostProjectMemoMapper.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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.hotent.project.dao.CostProjectMemoDao">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.hotent.project.model.CostProjectMemo">
  6. <id column="id" property="id" />
  7. <result column="project_id" property="projectId" />
  8. <result column="title" property="title" />
  9. <result column="content" property="content" />
  10. <result column="memo_date" property="memoDate" />
  11. <result column="time_period" property="timePeriod" />
  12. <result column="reminder_type" property="reminderType" />
  13. <result column="attachment_url" property="attachmentUrl" />
  14. <result column="attachment_name" property="attachmentName" />
  15. <result column="attachment_size" property="attachmentSize" />
  16. <result column="area_code" property="areaCode" />
  17. <result column="area_level" property="areaLevel" />
  18. <result column="create_by" property="createBy" />
  19. <result column="create_time" property="createTime" />
  20. <result column="update_by" property="updateBy" />
  21. <result column="update_time" property="updateTime" />
  22. </resultMap>
  23. <!-- 通用查询结果列 -->
  24. <sql id="Base_Column_List">
  25. id, project_id, title, content, memo_date, time_period, reminder_type, attachment_url, attachment_name, attachment_size, area_code, area_level, create_by, create_time, update_time,update_by
  26. </sql>
  27. <update id="updateMemo">
  28. update cost_project_memo
  29. <trim prefix="set" suffixOverrides=",">
  30. <if test="projectId!= null">
  31. project_id = #{projectId},
  32. </if>
  33. <if test="title != null">
  34. title = #{title},
  35. </if>
  36. <if test="content != null">
  37. content = #{content},
  38. </if>
  39. <if test="memoDate != null">
  40. memo_date = #{memoDate},
  41. </if>
  42. <if test="timePeriod != null">
  43. time_period = #{timePeriod},
  44. </if>
  45. <if test="reminderType != null">
  46. reminder_type = #{reminderType},
  47. </if>
  48. <if test="attachmentUrl != null">
  49. attachment_url = #{attachmentUrl},
  50. </if>
  51. where id = #{id}
  52. </trim>
  53. </update>
  54. <select id="selectPage" resultMap="BaseResultMap">
  55. select
  56. <include refid="Base_Column_List"/>
  57. from
  58. cost_project_memo
  59. ${ew.customSqlSegment}
  60. </select>
  61. <select id="selectList" resultMap="BaseResultMap">
  62. select
  63. <include refid="Base_Column_List"/>
  64. from
  65. cost_project_memo
  66. ${ew.customSqlSegment}
  67. </select>
  68. <select id="selectById" resultMap="BaseResultMap">
  69. select
  70. <include refid="Base_Column_List"/>
  71. from
  72. cost_project_memo
  73. where
  74. id = ${id}
  75. </select>
  76. <select id="getCostProjectMemoPage" resultMap="BaseResultMap">
  77. SELECT
  78. cpm.id,
  79. cpm.project_id,
  80. cpa.project_name,
  81. cpm.memo_date,
  82. cpm.title,
  83. cpm.content,
  84. cpm.reminder_type
  85. FROM
  86. cost_project_memo cpm,
  87. cost_project_approval cpa,
  88. uc_user uc
  89. WHERE
  90. cpm.project_id = cpa.project_id
  91. AND uc.ACCOUNT_ = cpm.create_by
  92. <if test=" projectId != null and projectId != '' ">
  93. AND cpm.project_id=#{projectId}
  94. </if>
  95. <if test=" content != null and content != '' ">
  96. AND cpm.content LIKE CONCAT('%', #{content}, '%')
  97. </if>
  98. <if test=" year != null and year != '' ">
  99. AND cpm.year LIKE CONCAT('%', #{year}, '%')
  100. </if>
  101. <if test="startTime != null and endTime != null
  102. and startTime != '' and endTime != ''">
  103. AND #{param.startTime} &lt;= DATE_FORMAT(cpm.create_time, '%Y-%m-%d')
  104. AND #{param.endTime} &gt;= DATE_FORMAT(cpm.create_time, '%Y-%m-%d')
  105. </if>
  106. <if test=" dataScope != null and dataScope != ''">
  107. <if test=" dataScope ==1">
  108. and (uc.CITY_CODE=#{ cityCode} or cpm.area_code=#{ cityCode})
  109. </if>
  110. <if test=" dataScope ==2">
  111. and (uc.COUNTY_CODE=#{ countyCode} or cpm.area_code=#{ countyCode})
  112. </if>
  113. </if>
  114. ORDER BY cpm.create_time DESC
  115. </select>
  116. </mapper>