综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CmcDeviceHandoverMapper.xml 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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.oa.mapper.CmcDeviceHandoverMapper">
  6. <resultMap type="CmcDeviceHandover" id="CmcDeviceHandoverResult">
  7. <result property="deviceHandoverId" column="device_handover_id" />
  8. <result property="deviceId" column="device_id" />
  9. <result property="handoverDeptId" column="handover_dept_id" />
  10. <result property="handoverUserId" column="handover_user_id" />
  11. <result property="handoverDate" column="handover_date" />
  12. <result property="receiveDeptId" column="receive_dept_id" />
  13. <result property="receiveUserId" column="receive_user_id" />
  14. <result property="description" column="description" />
  15. <result property="reason" column="reason" />
  16. <result property="remark" column="remark" />
  17. <association property="handoverUser" javaType="SysUser" resultMap="HandoverUserResult" />
  18. <association property="receiveUser" javaType="SysDept" resultMap="ReceiveUserResult" />
  19. <association property="handoverDept" javaType="SysDept" resultMap="HandoverDeptResult" />
  20. <association property="receiveDept" javaType="SysDept" resultMap="ReceiveDeptResult" />
  21. <association property="device" javaType="CmcDevice" resultMap="CmcDeviceResult" />
  22. </resultMap>
  23. <resultMap type="SysUser" id="HandoverUserResult">
  24. <result property="userId" column="user_id" />
  25. <result property="nickName" column="handover_nick_name" />
  26. </resultMap>
  27. <resultMap type="SysUser" id="ReceiveUserResult">
  28. <result property="userId" column="user_id" />
  29. <result property="nickName" column="receive_nick_name" />
  30. </resultMap>
  31. <resultMap type="SysDept" id="HandoverDeptResult">
  32. <result property="deptId" column="dept_id" />
  33. <result property="deptName" column="handover_dept_name" />
  34. </resultMap>
  35. <resultMap type="SysDept" id="ReceiveDeptResult">
  36. <result property="deptId" column="dept_id" />
  37. <result property="deptName" column="receive_dept_name" />
  38. </resultMap>
  39. <resultMap type="CmcDevice" id="CmcDeviceResult">
  40. <result property="deviceId" column="device_id" />
  41. <result property="deviceNumber" column="device_number" />
  42. <result property="code" column="code" />
  43. <result property="name" column="name" />
  44. <result property="series" column="series" />
  45. <result property="brand" column="brand" />
  46. </resultMap>
  47. <sql id="selectCmcDeviceHandoverVo">
  48. select dh.device_handover_id, dh.device_id, dv.device_number, dv.code, dv.name, dv.brand, dv.series, dh.handover_dept_id, d.dept_name as handover_dept_name, u.nick_name as handover_nick_name, dh.handover_user_id, dh.handover_date,
  49. dh.receive_dept_id, d1.dept_name as receive_dept_name, dh.receive_user_id, u1.nick_name as receive_nick_name, dh.description, dh.reason, dh.remark from cmc_device_handover as dh
  50. left join sys_user as u on u.user_id = dh.handover_user_id
  51. left join sys_user as u1 on u1.user_id = dh.receive_user_id
  52. left join sys_dept as d on d.dept_id = dh.handover_dept_id
  53. left join sys_dept as d1 on d1.dept_id = dh.receive_dept_id
  54. left join cmc_device as dv on dv.device_id = dh.device_id
  55. </sql>
  56. <select id="selectCmcDeviceHandoverList" parameterType="CmcDeviceHandover" resultMap="CmcDeviceHandoverResult">
  57. <include refid="selectCmcDeviceHandoverVo"/>
  58. <where>
  59. <if test="deviceId != null "> and dh.device_id = #{deviceId}</if>
  60. <if test="handoverDeptId != null "> and dh.handover_dept_id = #{handoverDeptId}</if>
  61. <if test="handoverUserId != null "> and dh.handover_user_id = #{handoverUserId}</if>
  62. <if test="handoverDate != null "> and dh.handover_date = #{handoverDate}</if>
  63. <if test="receiveDeptId != null "> and dh.receive_dept_id = #{receiveDeptId}</if>
  64. <if test="receiveUserId != null "> and dh.receive_user_id = #{receiveUserId}</if>
  65. <if test="description != null and description != ''"> and dh.description = #{description}</if>
  66. <if test="reason != null and reason != ''"> and dh.reason = #{reason}</if>
  67. </where>
  68. </select>
  69. <select id="selectCmcDeviceHandoverByDeviceHandoverId" parameterType="String" resultMap="CmcDeviceHandoverResult">
  70. <include refid="selectCmcDeviceHandoverVo"/>
  71. where dh.device_handover_id = #{deviceHandoverId}
  72. </select>
  73. <insert id="insertCmcDeviceHandover" parameterType="CmcDeviceHandover">
  74. insert into cmc_device_handover
  75. <trim prefix="(" suffix=")" suffixOverrides=",">
  76. <if test="deviceHandoverId != null">device_handover_id,</if>
  77. <if test="deviceId != null">device_id,</if>
  78. <if test="handoverDeptId != null">handover_dept_id,</if>
  79. <if test="handoverUserId != null">handover_user_id,</if>
  80. <if test="handoverDate != null">handover_date,</if>
  81. <if test="receiveDeptId != null">receive_dept_id,</if>
  82. <if test="receiveUserId != null">receive_user_id,</if>
  83. <if test="description != null">description,</if>
  84. <if test="reason != null">reason,</if>
  85. <if test="remark != null">remark,</if>
  86. </trim>
  87. <trim prefix="values (" suffix=")" suffixOverrides=",">
  88. <if test="deviceHandoverId != null">#{deviceHandoverId},</if>
  89. <if test="deviceId != null">#{deviceId},</if>
  90. <if test="handoverDeptId != null">#{handoverDeptId},</if>
  91. <if test="handoverUserId != null">#{handoverUserId},</if>
  92. <if test="handoverDate != null">#{handoverDate},</if>
  93. <if test="receiveDeptId != null">#{receiveDeptId},</if>
  94. <if test="receiveUserId != null">#{receiveUserId},</if>
  95. <if test="description != null">#{description},</if>
  96. <if test="reason != null">#{reason},</if>
  97. <if test="remark != null">#{remark},</if>
  98. </trim>
  99. </insert>
  100. <update id="updateCmcDeviceHandover" parameterType="CmcDeviceHandover">
  101. update cmc_device_handover
  102. <trim prefix="SET" suffixOverrides=",">
  103. <if test="deviceId != null">device_id = #{deviceId},</if>
  104. <if test="handoverDeptId != null">handover_dept_id = #{handoverDeptId},</if>
  105. <if test="handoverUserId != null">handover_user_id = #{handoverUserId},</if>
  106. <if test="handoverDate != null">handover_date = #{handoverDate},</if>
  107. <if test="receiveDeptId != null">receive_dept_id = #{receiveDeptId},</if>
  108. <if test="receiveUserId != null">receive_user_id = #{receiveUserId},</if>
  109. <if test="description != null">description = #{description},</if>
  110. <if test="reason != null">reason = #{reason},</if>
  111. <if test="remark != null">remark = #{remark},</if>
  112. </trim>
  113. where device_handover_id = #{deviceHandoverId}
  114. </update>
  115. <delete id="deleteCmcDeviceHandoverByDeviceHandoverId" parameterType="String">
  116. delete from cmc_device_handover where device_handover_id = #{deviceHandoverId}
  117. </delete>
  118. <delete id="deleteCmcDeviceHandoverByDeviceHandoverIds" parameterType="String">
  119. delete from cmc_device_handover where device_handover_id in
  120. <foreach item="deviceHandoverId" collection="array" open="(" separator="," close=")">
  121. #{deviceHandoverId}
  122. </foreach>
  123. </delete>
  124. </mapper>