SlApplyApprovalMapper.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zd.smartlock.mapper.SlApplyApprovalMapper">
  6. <resultMap type="com.zd.smartlock.domain.SlApplyApproval" id="SlApplyApprovalResult">
  7. <result property="id" column="id"/>
  8. <result property="applyId" column="apply_id"/>
  9. <result property="deptId" column="dept_id"/>
  10. <result property="deptName" column="dept_name"/>
  11. <result property="approvaId" column="approva_id"/>
  12. <result property="approvaName" column="approva_name"/>
  13. <result property="approvaStatus" column="approva_status"/>
  14. <result property="cretaTime" column="creta_time"/>
  15. </resultMap>
  16. <sql id="selectSlApplyApprovalVo">
  17. select id,
  18. apply_id,
  19. dept_id,
  20. dept_name,
  21. approva_id,
  22. approva_name,
  23. approva_status,
  24. creta_time
  25. from sl_apply_approval
  26. </sql>
  27. <sql id="selectSlApplyApprovalListVo">
  28. select t.id,
  29. t.apply_id,
  30. t.dept_id,
  31. t.dept_name,
  32. t.approva_id,
  33. t.approva_name,
  34. t.approva_status,
  35. t.creta_time
  36. from sl_apply_approval as t
  37. </sql>
  38. <select id="selectSlApplyApprovalList" parameterType="com.zd.smartlock.domain.SlApplyApproval"
  39. resultMap="SlApplyApprovalResult">
  40. <include refid="selectSlApplyApprovalVo"/>
  41. <where>
  42. <if test="applyId != null ">and apply_id = #{applyId}</if>
  43. <if test="approvaId != null ">and approva_id = #{approvaId}</if>
  44. <if test="approvaName != null and approvaName != ''">and approva_name like concat('%', #{approvaName},
  45. '%')
  46. </if>
  47. <if test="approvaStatus != null ">and approva_status = #{approvaStatus}</if>
  48. <if test="cretaTime != null ">and creta_time = #{cretaTime}</if>
  49. </where>
  50. </select>
  51. <select id="getListByIds" resultMap="SlApplyApprovalResult">
  52. <include refid="selectSlApplyApprovalVo"/>
  53. <where>
  54. id in
  55. <foreach item="id" collection="list" open="(" separator="," close=")">
  56. #{id}
  57. </foreach>
  58. </where>
  59. </select>
  60. <select id="selectSlApplyApprovalById" resultMap="SlApplyApprovalResult">
  61. <include refid="selectSlApplyApprovalVo"/>
  62. where id = #{id}
  63. </select>
  64. <insert id="insertSlApplyApproval" parameterType="com.zd.smartlock.domain.SlApplyApproval" useGeneratedKeys="true"
  65. keyProperty="id">
  66. insert into sl_apply_approval
  67. <trim prefix="(" suffix=")" suffixOverrides=",">
  68. <if test="applyId != null">apply_id,</if>
  69. <if test="deptId != null">dept_id,</if>
  70. <if test="deptName != null">dept_name,</if>
  71. <if test="approvaId != null">approva_id,</if>
  72. <if test="approvaName != null">approva_name,</if>
  73. <if test="approvaStatus != null">approva_status,</if>
  74. <if test="cretaTime != null">creta_time,</if>
  75. </trim>
  76. <trim prefix="values (" suffix=")" suffixOverrides=",">
  77. <if test="applyId != null">#{applyId},</if>
  78. <if test="deptId != null">#{deptId},</if>
  79. <if test="deptName != null">#{deptName},</if>
  80. <if test="approvaId != null">#{approvaId},</if>
  81. <if test="approvaName != null">#{approvaName},</if>
  82. <if test="approvaStatus != null">#{approvaStatus},</if>
  83. <if test="cretaTime != null">#{cretaTime},</if>
  84. </trim>
  85. </insert>
  86. <update id="updateSlApplyApproval" parameterType="com.zd.smartlock.domain.SlApplyApproval">
  87. update sl_apply_approval
  88. <trim prefix="SET" suffixOverrides=",">
  89. <if test="applyId != null">apply_id = #{applyId},</if>
  90. <if test="deptId != null">dept_id = #{deptId},</if>
  91. <if test="deptName != null">dept_name = #{deptName},</if>
  92. <if test="approvaId != null">approva_id = #{approvaId},</if>
  93. <if test="approvaName != null">approva_name = #{approvaName},</if>
  94. <if test="approvaStatus != null">approva_status = #{approvaStatus},</if>
  95. <if test="cretaTime != null">creta_time = #{cretaTime},</if>
  96. </trim>
  97. where id = #{id}
  98. </update>
  99. <delete id="deleteSlApplyApprovalById">
  100. delete
  101. from sl_apply_approval
  102. where id = #{id}
  103. </delete>
  104. <delete id="deleteSlApplyApprovalByIds">
  105. delete from sl_apply_approval where id in
  106. <foreach item="id" collection="array" open="(" separator="," close=")">
  107. #{id}
  108. </foreach>
  109. </delete>
  110. </mapper>