TbAssetInventoryMapper.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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.ruoyi.inventory.mapper.TbAssetInventoryMapper">
  6. <resultMap type="TbAssetInventory" id="TbAssetInventoryResult">
  7. <result property="id" column="id" />
  8. <result property="orderNumber" column="order_number" />
  9. <result property="name" column="name" />
  10. <result property="inventoryDepartment" column="inventory_department" />
  11. <result property="inventoryBy" column="inventory_by" />
  12. <result property="inventoryDate" column="inventory_date" />
  13. <result property="inventoryLocation" column="inventory_location" />
  14. <result property="inventoryStatus" column="inventory_status" />
  15. <result property="inventoryResult" column="inventory_result" />
  16. <result property="recordStatus" column="record_status" />
  17. <result property="remark" column="remark" />
  18. <result property="createdTime" column="created_time" />
  19. <result property="updatedTime" column="updated_time" />
  20. </resultMap>
  21. <sql id="selectTbAssetInventoryVo">
  22. select id, order_number, name, inventory_department, inventory_by, inventory_date, inventory_location, inventory_status, inventory_result, record_status, remark, created_time, updated_time from tb_asset_inventory
  23. </sql>
  24. <select id="selectTbAssetInventoryList" parameterType="TbAssetInventory" resultMap="TbAssetInventoryResult">
  25. <include refid="selectTbAssetInventoryVo"/>
  26. <where>
  27. <if test="orderNumber != null and orderNumber != ''"> and order_number = #{orderNumber}</if>
  28. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  29. <if test="inventoryDepartment != null and inventoryDepartment != ''"> and inventory_department = #{inventoryDepartment}</if>
  30. <if test="inventoryBy != null and inventoryBy != ''"> and inventory_by = #{inventoryBy}</if>
  31. <if test="inventoryDate != null "> and inventory_date = #{inventoryDate}</if>
  32. <if test="inventoryLocation != null and inventoryLocation != ''"> and inventory_location = #{inventoryLocation}</if>
  33. <if test="inventoryStatus != null "> and inventory_status = #{inventoryStatus}</if>
  34. <if test="inventoryResult != null "> and inventory_result = #{inventoryResult}</if>
  35. <if test="recordStatus != null "> and record_status = #{recordStatus}</if>
  36. </where>
  37. </select>
  38. <select id="selectTbAssetInventoryById" parameterType="Long" resultMap="TbAssetInventoryResult">
  39. <include refid="selectTbAssetInventoryVo"/>
  40. where id = #{id}
  41. </select>
  42. <insert id="insertTbAssetInventory" parameterType="TbAssetInventory" useGeneratedKeys="true" keyProperty="id">
  43. insert into tb_asset_inventory
  44. <trim prefix="(" suffix=")" suffixOverrides=",">
  45. <if test="orderNumber != null and orderNumber != ''">order_number,</if>
  46. <if test="name != null and name != ''">name,</if>
  47. <if test="inventoryDepartment != null and inventoryDepartment != ''">inventory_department,</if>
  48. <if test="inventoryBy != null and inventoryBy != ''">inventory_by,</if>
  49. <if test="inventoryDate != null">inventory_date,</if>
  50. <if test="inventoryLocation != null and inventoryLocation != ''">inventory_location,</if>
  51. <if test="inventoryStatus != null">inventory_status,</if>
  52. <if test="inventoryResult != null">inventory_result,</if>
  53. <if test="recordStatus != null">record_status,</if>
  54. <if test="remark != null">remark,</if>
  55. <if test="createdTime != null">created_time,</if>
  56. <if test="updatedTime != null">updated_time,</if>
  57. </trim>
  58. <trim prefix="values (" suffix=")" suffixOverrides=",">
  59. <if test="orderNumber != null and orderNumber != ''">#{orderNumber},</if>
  60. <if test="name != null and name != ''">#{name},</if>
  61. <if test="inventoryDepartment != null and inventoryDepartment != ''">#{inventoryDepartment},</if>
  62. <if test="inventoryBy != null and inventoryBy != ''">#{inventoryBy},</if>
  63. <if test="inventoryDate != null">#{inventoryDate},</if>
  64. <if test="inventoryLocation != null and inventoryLocation != ''">#{inventoryLocation},</if>
  65. <if test="inventoryStatus != null">#{inventoryStatus},</if>
  66. <if test="inventoryResult != null">#{inventoryResult},</if>
  67. <if test="recordStatus != null">#{recordStatus},</if>
  68. <if test="remark != null">#{remark},</if>
  69. <if test="createdTime != null">#{createdTime},</if>
  70. <if test="updatedTime != null">#{updatedTime},</if>
  71. </trim>
  72. </insert>
  73. <update id="updateTbAssetInventory" parameterType="TbAssetInventory">
  74. update tb_asset_inventory
  75. <trim prefix="SET" suffixOverrides=",">
  76. <if test="orderNumber != null and orderNumber != ''">order_number = #{orderNumber},</if>
  77. <if test="name != null and name != ''">name = #{name},</if>
  78. <if test="inventoryDepartment != null and inventoryDepartment != ''">inventory_department = #{inventoryDepartment},</if>
  79. <if test="inventoryBy != null and inventoryBy != ''">inventory_by = #{inventoryBy},</if>
  80. <if test="inventoryDate != null">inventory_date = #{inventoryDate},</if>
  81. <if test="inventoryLocation != null and inventoryLocation != ''">inventory_location = #{inventoryLocation},</if>
  82. <if test="inventoryStatus != null">inventory_status = #{inventoryStatus},</if>
  83. <if test="inventoryResult != null">inventory_result = #{inventoryResult},</if>
  84. <if test="recordStatus != null">record_status = #{recordStatus},</if>
  85. <if test="remark != null">remark = #{remark},</if>
  86. <if test="createdTime != null">created_time = #{createdTime},</if>
  87. <if test="updatedTime != null">updated_time = #{updatedTime},</if>
  88. </trim>
  89. where id = #{id}
  90. </update>
  91. <delete id="deleteTbAssetInventoryById" parameterType="Long">
  92. delete from tb_asset_inventory where id = #{id}
  93. </delete>
  94. <delete id="deleteTbAssetInventoryByIds" parameterType="String">
  95. delete from tb_asset_inventory where id in
  96. <foreach item="id" collection="array" open="(" separator="," close=")">
  97. #{id}
  98. </foreach>
  99. </delete>
  100. <select id="selectTbAssetInventoryDTOList" parameterType="com.ruoyi.inventory.domain.dto.TbAssetInventoryDTO" resultType="com.ruoyi.inventory.domain.dto.TbAssetInventoryDTO">
  101. select
  102. a.id,
  103. a.order_number orderNumber,
  104. a.name,
  105. b.dept_name deptName,
  106. a.inventory_by inventoryBy,
  107. a.inventory_date inventoryDate,
  108. a.inventory_location inventoryLocation,
  109. a.inventory_status inventoryStatus,
  110. a.inventory_result inventoryResult,
  111. a.record_status recordResult,
  112. a.record_status recordStatus,
  113. a.remark,
  114. a.created_time createdTime,
  115. a.updated_time updatedTime
  116. from
  117. tb_asset_inventory a
  118. left join
  119. sys_dept b
  120. on
  121. a.inventory_department = b.dept_id
  122. where
  123. a.inventory_by = #{inventoryBy}
  124. </select>
  125. </mapper>