TInvoiceUserUnitMapper.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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.project.invoice.mapper.TInvoiceUserUnitMapper">
  6. <resultMap type="TInvoiceUserUnit" id="TInvoiceUserUnitResult">
  7. <result property="id" column="id" />
  8. <result property="userUnit" column="user_unit" />
  9. <result property="userIds" column="user_ids" />
  10. <result property="delFlag" column="del_flag" />
  11. <result property="createrCode" column="creater_code" />
  12. <result property="createdate" column="createdate" />
  13. <result property="updaterCode" column="updater_code" />
  14. <result property="updatedate" column="updatedate" />
  15. <result property="deptId" column="dept_id" />
  16. <result property="remarks" column="remarks" />
  17. <result property="deptName" column="dept_name" />
  18. <result property="nickName" column="nick_name" />
  19. </resultMap>
  20. <sql id="selectTInvoiceUserUnitVo">
  21. select d.id, d.user_unit, d.user_ids, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks ,s.dept_name,u.nick_name from t_invoice_user_unit d
  22. left join sys_dept s on s.dept_id = d.dept_id
  23. left join sys_user u on d.user_ids = u.user_id
  24. </sql>
  25. <select id="selectTInvoiceUserUnitList" parameterType="TInvoiceUserUnit" resultMap="TInvoiceUserUnitResult">
  26. <include refid="selectTInvoiceUserUnitVo"/>
  27. <where>
  28. <if test="userUnit != null and userUnit != ''"> and user_unit = #{userUnit}</if>
  29. <if test="userIds != null and userIds != ''"> and user_ids = #{userIds}</if>
  30. <if test="createrCode != null and createrCode != ''"> and creater_code = #{createrCode}</if>
  31. <if test="createdate != null "> and createdate = #{createdate}</if>
  32. <if test="updaterCode != null "> and updater_code = #{updaterCode}</if>
  33. <if test="updatedate != null "> and updatedate = #{updatedate}</if>
  34. <if test="deptId != null "> and dept_id = #{deptId}</if>
  35. <if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
  36. and d.del_flag = 0
  37. </where>
  38. <!-- 数据范围过滤 -->
  39. ${params.dataScope}
  40. order by user_unit
  41. </select>
  42. <select id="selectTInvoiceUserUnitListToExcel" parameterType="TInvoiceUserUnit" resultMap="TInvoiceUserUnitResult">
  43. select d.id, d.user_unit, d.user_ids, d.del_flag, su.nick_name creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks ,s.dept_name,u.nick_name from t_invoice_user_unit d
  44. left join sys_dept s on s.dept_id = d.dept_id
  45. left join sys_user u on d.user_ids = u.user_id
  46. left join sys_user su on d.creater_code = su.user_id
  47. <where>
  48. <if test="userUnit != null and userUnit != ''"> and user_unit = #{userUnit}</if>
  49. <if test="userIds != null and userIds != ''"> and user_ids = #{userIds}</if>
  50. <if test="createrCode != null and createrCode != ''"> and creater_code = #{createrCode}</if>
  51. <if test="createdate != null "> and createdate = #{createdate}</if>
  52. <if test="updaterCode != null "> and updater_code = #{updaterCode}</if>
  53. <if test="updatedate != null "> and updatedate = #{updatedate}</if>
  54. <if test="deptId != null "> and dept_id = #{deptId}</if>
  55. <if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
  56. and d.del_flag = 0
  57. </where>
  58. <!-- 数据范围过滤 -->
  59. ${params.dataScope}
  60. order by user_unit
  61. </select>
  62. <select id="selectAllTInvoiceUserUnit" parameterType="TInvoiceUserUnit" resultMap="TInvoiceUserUnitResult">
  63. select distinct (d.user_unit) from t_invoice_user_unit d
  64. left join SYS_DEPT s on s.dept_id=d.dept_id
  65. <where>
  66. and d.del_flag = 0
  67. </where>
  68. group by d.user_unit
  69. ${params.dataScope}
  70. </select>
  71. <select id="selectTInvoiceUserUnitById" parameterType="Long" resultMap="TInvoiceUserUnitResult">
  72. <include refid="selectTInvoiceUserUnitVo"/>
  73. where id = #{id}
  74. </select>
  75. <select id="selectTInvoiceUserUnitByUnit" parameterType="String" resultMap="TInvoiceUserUnitResult">
  76. <include refid="selectTInvoiceUserUnitVo"/>
  77. where user_unit = #{userUnit} and d.del_flag=0
  78. </select>
  79. <insert id="insertTInvoiceUserUnit" parameterType="TInvoiceUserUnit">
  80. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  81. SELECT seq_t_invoice_user_unit.NEXTVAL as id FROM DUAL
  82. </selectKey>
  83. insert into t_invoice_user_unit
  84. <trim prefix="(" suffix=")" suffixOverrides=",">
  85. <if test="id != null">id,</if>
  86. <if test="userUnit != null">user_unit,</if>
  87. <if test="userIds != null">user_ids,</if>
  88. <if test="delFlag != null">del_flag,</if>
  89. <if test="createrCode != null">creater_code,</if>
  90. <if test="createdate != null">createdate,</if>
  91. <if test="updaterCode != null">updater_code,</if>
  92. <if test="updatedate != null">updatedate,</if>
  93. <if test="deptId != null">dept_id,</if>
  94. <if test="remarks != null">remarks,</if>
  95. </trim>
  96. <trim prefix="values (" suffix=")" suffixOverrides=",">
  97. <if test="id != null">#{id},</if>
  98. <if test="userUnit != null">#{userUnit},</if>
  99. <if test="userIds != null">#{userIds},</if>
  100. <if test="delFlag != null">#{delFlag},</if>
  101. <if test="createrCode != null">#{createrCode},</if>
  102. <if test="createdate != null">#{createdate},</if>
  103. <if test="updaterCode != null">#{updaterCode},</if>
  104. <if test="updatedate != null">#{updatedate},</if>
  105. <if test="deptId != null">#{deptId},</if>
  106. <if test="remarks != null">#{remarks},</if>
  107. </trim>
  108. </insert>
  109. <update id="updateTInvoiceUserUnit" parameterType="TInvoiceUserUnit">
  110. update t_invoice_user_unit
  111. <trim prefix="SET" suffixOverrides=",">
  112. <if test="userUnit != null">user_unit = #{userUnit},</if>
  113. <if test="userIds != null">user_ids = #{userIds},</if>
  114. <if test="delFlag != null">del_flag = #{delFlag},</if>
  115. <if test="createrCode != null">creater_code = #{createrCode},</if>
  116. <if test="createdate != null">createdate = #{createdate},</if>
  117. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  118. <if test="updatedate != null">updatedate = #{updatedate},</if>
  119. <if test="deptId != null">dept_id = #{deptId},</if>
  120. <if test="remarks != null">remarks = #{remarks},</if>
  121. </trim>
  122. where id = #{id}
  123. </update>
  124. <update id="deleteTInvoiceUserUnitById" parameterType="Long">
  125. update t_invoice_user_unit set del_flag = 2 where id = #{id}
  126. </update>
  127. <update id="deleteTInvoiceUserUnitByIds" parameterType="String">
  128. update t_invoice_user_unit set del_flag = 2 where id in
  129. <foreach item="id" collection="array" open="(" separator="," close=")">
  130. #{id}
  131. </foreach>
  132. </update>
  133. </mapper>