ProjectMapper.xml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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.jeeplus.modules.sg.project.mapper.ProjectMapper">
  4. <sql id="infoColumns">
  5. a.id AS "id",
  6. a.create_by AS "createBy.id",
  7. a.create_date AS "createDate",
  8. a.update_by AS "updateBy.id",
  9. a.update_date AS "updateDate",
  10. a.remarks AS "remarks",
  11. a.del_flag AS "delFlag",
  12. a.project_name AS "projectName",
  13. a.number AS "number",
  14. a.parent_node AS "parentNode",
  15. b.name AS "userName"
  16. </sql>
  17. <select id="get" resultType="WbsProject" >
  18. SELECT
  19. <include refid="infoColumns"/>
  20. FROM sg_wbs_project a left join sys_user b on a.create_by = b.id
  21. WHERE a.id = #{id}
  22. </select>
  23. <select id="findByName" parameterType="String" resultType="WbsProject">
  24. SELECT
  25. a.id AS "id",
  26. a.create_by AS "createBy.id",
  27. a.create_date AS "createDate",
  28. a.update_by AS "updateBy.id",
  29. a.update_date AS "updateDate",
  30. a.remarks AS "remarks",
  31. a.del_flag AS "delFlag",
  32. a.project_name AS "projectName",
  33. a.number AS "number"
  34. FROM sg_wbs_project a
  35. <where>
  36. a.project_name = #{projectName} and a.number = 0
  37. </where>
  38. order by a.create_date DESC
  39. </select>
  40. <select id="getList" resultType="WbsProject" parameterType="com.jeeplus.modules.sg.project.entity.WbsSelection" >
  41. SELECT
  42. <include refid="infoColumns"/>
  43. FROM sg_wbs_project a left join sys_user b on a.create_by = b.id
  44. <where>
  45. <if test="projectId !=null and projectId != ''">
  46. a.id = #{projectId} AND
  47. </if>
  48. <if test="projectName != null and projectName != ''">
  49. a.project_name LIKE CONCAT(CONCAT('%',#{projectName},'%')) AND
  50. </if>
  51. <if test="createBy != null and createBy != ''">
  52. b.name LIKE CONCAT(CONCAT('%',#{createBy},'%')) AND
  53. </if>
  54. <if test="projectStartDate != null and projectEndDate != ''">
  55. a.create_date &gt;= #{projectStartDate} AND
  56. </if>
  57. <if test="projectEndDate != null and projectEndDate != ''">
  58. a.create_date &lt;= #{projectEndDate} AND
  59. </if>
  60. 1 = 1
  61. </where>
  62. ORDER BY a.update_date DESC
  63. </select>
  64. <select id="findAllList" resultType="WbsProject" >
  65. SELECT
  66. <include refid="infoColumns"/>
  67. FROM sg_wbs_project a
  68. <where>
  69. a.del_flag = #{DEL_FLAG_NORMAL}
  70. </where>
  71. <choose>
  72. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  73. ORDER BY ${page.orderBy}
  74. </when>
  75. <otherwise>
  76. ORDER BY a.update_date DESC
  77. </otherwise>
  78. </choose>
  79. </select>
  80. <insert id="insert">
  81. INSERT INTO sg_wbs_project(
  82. id,
  83. create_by,
  84. create_date,
  85. update_by,
  86. update_date,
  87. remarks,
  88. del_flag,
  89. project_name,
  90. number,
  91. parent_node
  92. ) VALUES (
  93. #{id},
  94. #{createBy.id},
  95. #{createDate},
  96. #{updateBy.id},
  97. #{updateDate},
  98. #{remarks},
  99. #{delFlag},
  100. #{projectName},
  101. #{number},
  102. #{parentNode}
  103. )
  104. </insert>
  105. <update id="update">
  106. UPDATE sg_wbs_project SET
  107. project_name = #{projectName},
  108. update_by = #{updateBy.id},
  109. update_date = #{updateDate},
  110. remarks = #{remarks}
  111. WHERE id = #{id}
  112. </update>
  113. <update id="updateNum">
  114. UPDATE sg_wbs_project SET
  115. number = #{number}
  116. <where>
  117. id = #{id}
  118. </where>
  119. </update>
  120. <!--物理删除-->
  121. <update id="delete">
  122. DELETE FROM sg_wbs_project
  123. WHERE id = #{id}
  124. </update>
  125. <!--逻辑删除-->
  126. <update id="deleteByLogic">
  127. UPDATE sg_wbs_project SET
  128. del_flag = #{DEL_FLAG_DELETE}
  129. WHERE id = #{id}
  130. </update>
  131. <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
  132. <select id="findUniqueByProperty" resultType="Goods" statementType="STATEMENT">
  133. select * FROM sg_wbs_project where ${propertyName} = '${value}'
  134. </select>
  135. </mapper>