PhysicalBlindStructuresMapper.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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="org.dromara.physical.mapper.PhysicalBlindStructuresMapper">
  6. <!-- 查询所有(可选分页) -->
  7. <select id="selectPhysicalBlindStructureAllPage" resultType="org.dromara.physical.domain.vo.PhysicalBlindStructuresVo">
  8. SELECT
  9. id,
  10. name,
  11. description,
  12. created_at,
  13. updated_at,
  14. create_user_id,
  15. update_user_id
  16. FROM physical_blind_structures ${ew.customSqlSegment}
  17. </select>
  18. <!-- 查询所有(可选分页) -->
  19. <select id="selectPhysicalBlindStructureList" resultType="org.dromara.physical.domain.vo.PhysicalBlindStructuresVo">
  20. SELECT
  21. id,
  22. name,
  23. description,
  24. created_at,
  25. updated_at,
  26. create_user_id,
  27. update_user_id
  28. FROM physical_blind_structures ${ew.customSqlSegment}
  29. </select>
  30. <!-- 查询所有(可选分页) -->
  31. <select id="selectPhysicalBlindStructureById" resultType="org.dromara.physical.domain.vo.PhysicalBlindStructuresVo">
  32. SELECT
  33. id,
  34. name,
  35. description,
  36. created_at,
  37. updated_at,
  38. create_user_id,
  39. update_user_id
  40. FROM physical_blind_structures WHERE id = #{id}
  41. </select>
  42. <!-- 插入(动态非空字段) -->
  43. <insert id="insertPhysicalBlindStructure" useGeneratedKeys="true" keyProperty="id">
  44. INSERT INTO physical_blind_structures (
  45. <trim suffixOverrides=",">
  46. <if test="name != null and name != ''">name,</if>
  47. <if test="description != null and description != ''">description,</if>
  48. <if test="createUserId != null">create_user_id,</if>
  49. <if test="updateUserId != null">update_user_id,</if>
  50. created_at,
  51. updated_at
  52. </trim>
  53. ) VALUES (
  54. <trim suffixOverrides=",">
  55. <if test="name != null and name != ''">#{name},</if>
  56. <if test="description != null and description != ''">#{description},</if>
  57. <if test="createUserId != null">#{createUserId},</if>
  58. <if test="updateUserId != null">#{updateUserId},</if>
  59. NOW(),
  60. NOW()
  61. </trim>
  62. )
  63. </insert>
  64. <!-- 更新(动态非空字段) -->
  65. <update id="updatePhysicalBlindStructure">
  66. UPDATE physical_blind_structures
  67. <set>
  68. <if test="name != null and name != ''">name = #{name},</if>
  69. <if test="description != null">description = #{description},</if>
  70. <if test="updateUserId != null">update_user_id = #{updateUserId},</if>
  71. updated_at = NOW()
  72. </set>
  73. WHERE id = #{id}
  74. </update>
  75. <delete id="deletePhysicalBlindStructure">
  76. DELETE FROM physical_blind_structures
  77. <where>
  78. id IN
  79. <foreach item="id" collection="ids" open="(" separator="," close=")">
  80. <if test="id > 0">
  81. #{id}
  82. </if>
  83. </foreach>
  84. </where>
  85. </delete>
  86. </mapper>