LeadingGroupPositionMapper.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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.zhyc.xps.sys.mapper.LeadingGroupPositionMapper">
  4. <resultMap id="LeadingGroupPositionDtoResultMap" type="com.zhyc.xps.sys.dto.LeadingGroupPositionDto">
  5. <result column="oc_id" property="ocId" jdbcType="BIGINT" />
  6. <result column="lgp_id" property="lgpId" jdbcType="BIGINT" />
  7. <result column="lgp_name" property="lgpName" jdbcType="VARCHAR" />
  8. <result column="lgp_duty" property="lgpDuty" jdbcType="VARCHAR" />
  9. <result column="lgp_desc" property="lgpDesc" jdbcType="VARCHAR" />
  10. </resultMap>
  11. <sql id="LeadingGroupPositionDto_Cols">
  12. A.oc_id,
  13. A.lgp_id,
  14. A.lgp_name,
  15. A.lgp_duty,
  16. A.lgp_desc
  17. </sql>
  18. <!--基于ID查询-->
  19. <select id="getById" resultMap="LeadingGroupPositionDtoResultMap">
  20. SELECT
  21. <include refid="LeadingGroupPositionDto_Cols"/>
  22. FROM leading_group_position AS A
  23. WHERE A.oc_id = #{ocId ,jdbcType=BIGINT}
  24. AND A.lgp_id = #{lgpId ,jdbcType=BIGINT}
  25. </select>
  26. <!--分页查询-->
  27. <select id="getByPage" parameterType="java.util.Map" resultMap="LeadingGroupPositionDtoResultMap">
  28. SELECT
  29. <include refid="LeadingGroupPositionDto_Cols"/>
  30. FROM leading_group_position AS A
  31. WHERE A.deleted_flag = 0
  32. <if test="ocId != null">
  33. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  34. </if>
  35. <if test="lgpId != null">
  36. AND A.lgp_id = #{lgpId ,jdbcType=BIGINT}
  37. </if>
  38. <if test="keywords != null and keywords != ''">
  39. AND A.lgp_name LIKE "%"#{keywords}"%"
  40. </if>
  41. ORDER BY A.oc_id DESC
  42. </select>
  43. <!--列表查询-->
  44. <select id="getByList" parameterType="java.util.Map" resultMap="LeadingGroupPositionDtoResultMap">
  45. SELECT
  46. <include refid="LeadingGroupPositionDto_Cols"/>
  47. FROM leading_group_position AS A
  48. WHERE A.deleted_flag = 0
  49. <if test="ocId != null">
  50. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  51. </if>
  52. <if test="lgpId != null">
  53. AND A.lgp_id = #{lgpId ,jdbcType=BIGINT}
  54. </if>
  55. <if test="keywords != null and keywords != ''">
  56. AND A.lgp_name LIKE "%"#{keywords}"%"
  57. </if>
  58. </select>
  59. <!--新增Create-->
  60. <insert id="create" parameterType="com.zhyc.xps.sys.entity.LeadingGroup">
  61. INSERT INTO leading_group_position
  62. <trim prefix="(" suffix=")" suffixOverrides=",">
  63. <if test="ocId != null">
  64. oc_id,
  65. </if>
  66. <if test="lgpId != null">
  67. lgp_id,
  68. </if>
  69. <if test="lgpName != null and lgpName != ''">
  70. lgp_name,
  71. </if>
  72. <if test="lgpDuty != null and lgpDuty != ''">
  73. lgp_duty,
  74. </if>
  75. <if test="lgpDesc != null and lgpDesc != ''">
  76. lgp_desc,
  77. </if>
  78. <if test="createdBy != null">
  79. created_by,
  80. </if>
  81. <if test="createdAt != null">
  82. created_at,
  83. </if>
  84. </trim>
  85. <trim prefix="values (" suffix=")" suffixOverrides=",">
  86. <if test="ocId != null ">
  87. #{ocId ,jdbcType=BIGINT},
  88. </if>
  89. <if test="lgpId != null">
  90. #{lgpId ,jdbcType=BIGINT},
  91. </if>
  92. <if test="lgpName != null and lgpName != ''">
  93. #{lgpName ,jdbcType=VARCHAR},
  94. </if>
  95. <if test="lgpDuty != null and lgpDuty != ''">
  96. #{lgpDuty ,jdbcType=VARCHAR},
  97. </if>
  98. <if test="lgpDesc != null and lgpDesc != ''">
  99. #{lgpDesc ,jdbcType=VARCHAR},
  100. </if>
  101. <if test="createdBy != null">
  102. #{createdBy ,jdbcType=BIGINT},
  103. </if>
  104. <if test="createdAt != null">
  105. #{createdAt ,jdbcType=TIMESTAMP},
  106. </if>
  107. </trim>
  108. </insert>
  109. <!--更新-->
  110. <update id="update" parameterType="com.zhyc.xps.sys.entity.LeadingGroup">
  111. UPDATE leading_group_position
  112. <trim suffixOverrides=",">
  113. <set>
  114. <if test="lgpName != null and lgpName != ''">
  115. lgp_name = #{lgpName, jdbcType=VARCHAR},
  116. </if>
  117. <if test="lgpDuty != null and lgpDuty != ''">
  118. lgp_duty = #{lgpDuty ,jdbcType=VARCHAR},
  119. </if>
  120. <if test="lgpDesc != null and lgpDesc != ''">
  121. lgp_desc = #{lgpDesc, jdbcType=VARCHAR},
  122. </if>
  123. <if test="updatedBy != null ">
  124. updated_by = #{updatedBy ,jdbcType=BIGINT},
  125. </if>
  126. <if test="updatedAt != null">
  127. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  128. </if>
  129. </set>
  130. </trim>
  131. WHERE oc_Id = #{ocId ,jdbcType=BIGINT}
  132. AND lgp_id = #{lgpId ,jdbcType=BIGINT}
  133. </update>
  134. <!--删除-->
  135. <update id="delete" parameterType="java.util.Map">
  136. UPDATE leading_group_position
  137. <trim prefix="set" suffixOverrides=",">
  138. <if test="deletedFlag != null">
  139. deleted_flag = #{deletedFlag,jdbcType=BIGINT},
  140. </if>
  141. <if test="deletedAt != null">
  142. deleted_at = #{deletedAt,jdbcType=TIMESTAMP},
  143. </if>
  144. <if test="deletedBy != null">
  145. deleted_by = #{deletedBy,jdbcType=BIGINT}
  146. </if>
  147. </trim>
  148. WHERE deleted_flag = 0
  149. <if test="ocId != null">
  150. AND oc_id = #{ocId ,jdbcType=BIGINT}
  151. </if>
  152. <if test="lgpId != null">
  153. AND lgp_id = #{lgpId ,jdbcType=BIGINT}
  154. </if>
  155. </update>
  156. </mapper>