TFeesMapper.xml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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.basicData.mapper.TFeesMapper">
  6. <resultMap type="TFees" id="TFeesResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fNo" column="f_no"/>
  9. <result property="fName" column="f_name"/>
  10. <result property="fFeetype" column="f_feetype"/>
  11. <result property="fFeeunitid" column="f_feeunitid"/>
  12. <result property="fCurrency" column="f_currency"/>
  13. <result property="fStatus" column="f_status"/>
  14. <result property="delFlag" column="del_flag"/>
  15. <result property="createBy" column="create_by"/>
  16. <result property="createTime" column="create_time"/>
  17. <result property="updateBy" column="update_by"/>
  18. <result property="updateTime" column="update_time"/>
  19. <result property="remark" column="remark"/>
  20. <result property="fDc" column="f_dc"/>
  21. <result property="isModify" column="is_modify"/>
  22. </resultMap>
  23. <sql id="selectTFeesVo">
  24. select f_id, f_no, f_name, f_feetype, f_feeunitid, f_currency, f_status, del_flag, create_by, create_time, update_by, update_time, remark, f_dc, is_modify from t_fees
  25. </sql>
  26. <select id="selectTFeesList" parameterType="TFees" resultMap="TFeesResult">
  27. <include refid="selectTFeesVo"/>
  28. <where>
  29. <if test="fNo != null and fNo != ''">and f_no like concat('%', #{fNo}, '%')</if>
  30. <if test="fName != null and fName != ''">and f_name like concat('%', #{fName}, '%')</if>
  31. <if test="fFeetype != null and fFeetype != ''">and f_feetype = #{fFeetype}</if>
  32. <if test="fFeeunitid != null ">and f_feeunitid = #{fFeeunitid}</if>
  33. <if test="isModify != null and isModify != ''"> and is_modify = #{isModify}</if>
  34. <if test="fCurrency != null and fCurrency != ''">and f_currency like concat('%', #{fCurrency}, '%')</if>
  35. <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
  36. <if test="fDc != null and fDc != ''">and f_dc like concat('%', #{fDc}, '%') </if>
  37. </where>
  38. ORDER BY CONVERT(f_name USING gbk) asc
  39. </select>
  40. <select id="selectTFeesById" parameterType="Long" resultMap="TFeesResult">
  41. <include refid="selectTFeesVo"/>
  42. where f_id = #{fId}
  43. </select>
  44. <select id="selectTFeesModify" parameterType="TFees" resultType="String">
  45. select is_modify from t_fees where f_id = #{fId}
  46. </select>
  47. <insert id="insertTFees" parameterType="TFees" useGeneratedKeys="true" keyProperty="fId">
  48. insert into t_fees
  49. <trim prefix="(" suffix=")" suffixOverrides=",">
  50. <if test="fNo != null and fNo != ''">f_no,</if>
  51. <if test="fName != null and fName != ''">f_name,</if>
  52. <if test="fFeetype != null">f_feetype,</if>
  53. <if test="fFeeunitid != null">f_feeunitid,</if>
  54. <if test="fCurrency != null">f_currency,</if>
  55. <if test="fStatus != null">f_status,</if>
  56. <if test="delFlag != null">del_flag,</if>
  57. <if test="createBy != null">create_by,</if>
  58. <if test="createTime != null">create_time,</if>
  59. <if test="updateBy != null">update_by,</if>
  60. <if test="updateTime != null">update_time,</if>
  61. <if test="remark != null">remark,</if>
  62. <if test="fDc != null">f_dc,</if>
  63. <if test="isModify != null">is_modify,</if>
  64. </trim>
  65. <trim prefix="values (" suffix=")" suffixOverrides=",">
  66. <if test="fNo != null and fNo != ''">#{fNo},</if>
  67. <if test="fName != null and fName != ''">#{fName},</if>
  68. <if test="fFeetype != null">#{fFeetype},</if>
  69. <if test="fFeeunitid != null">#{fFeeunitid},</if>
  70. <if test="fCurrency != null">#{fCurrency},</if>
  71. <if test="fStatus != null">#{fStatus},</if>
  72. <if test="delFlag != null">#{delFlag},</if>
  73. <if test="createBy != null">#{createBy},</if>
  74. <if test="createTime != null">#{createTime},</if>
  75. <if test="updateBy != null">#{updateBy},</if>
  76. <if test="updateTime != null">#{updateTime},</if>
  77. <if test="remark != null">#{remark},</if>
  78. <if test="fDc != null">#{fDc},</if>
  79. <if test="isModify != null">#{isModify},</if>
  80. </trim>
  81. </insert>
  82. <update id="updateTFees" parameterType="TFees">
  83. update t_fees
  84. <trim prefix="SET" suffixOverrides=",">
  85. <if test="fNo != null and fNo != ''">f_no = #{fNo},</if>
  86. <if test="fName != null and fName != ''">f_name = #{fName},</if>
  87. <if test="fFeetype != null">f_feetype = #{fFeetype},</if>
  88. <if test="fFeeunitid != null">f_feeunitid = #{fFeeunitid},</if>
  89. <if test="fCurrency != null">f_currency = #{fCurrency},</if>
  90. <if test="fStatus != null">f_status = #{fStatus},</if>
  91. <if test="delFlag != null">del_flag = #{delFlag},</if>
  92. <if test="createBy != null">create_by = #{createBy},</if>
  93. <if test="createTime != null">create_time = #{createTime},</if>
  94. <if test="updateBy != null">update_by = #{updateBy},</if>
  95. <if test="updateTime != null">update_time = #{updateTime},</if>
  96. <if test="remark != null">remark = #{remark},</if>
  97. <if test="fDc != null">f_dc = #{fDc},</if>
  98. <if test="isModify != null">is_modify = #{isModify},</if>
  99. </trim>
  100. where f_id = #{fId}
  101. </update>
  102. <delete id="deleteTFeesById" parameterType="Long">
  103. delete from t_fees where f_id = #{fId}
  104. </delete>
  105. <delete id="deleteTFeesByIds" parameterType="String">
  106. delete from t_fees where f_id in
  107. <foreach item="fId" collection="array" open="(" separator="," close=")">
  108. #{fId}
  109. </foreach>
  110. </delete>
  111. <select id="checkFNoUnique" parameterType="String" resultMap="TFeesResult">
  112. select f_id,f_no from t_fees where f_no = #{fNo} limit 1
  113. </select>
  114. <select id="checkUFNnameUnique" parameterType="String" resultMap="TFeesResult">
  115. select f_id,f_name from t_fees where f_name = #{fAame} limit 1
  116. </select>
  117. <select id="selectTFeesByFName" parameterType="string" resultMap="TFeesResult">
  118. select f_id,f_name from t_fees where f_name = #{fAame}
  119. </select>
  120. <select id="seletFeesByCCF" resultMap="TFeesResult">
  121. <include refid="selectTFeesVo"/>
  122. where f_no = 'CCF' and del_flag = 0
  123. </select>
  124. <select id="selectTFeesNameList" resultType="string">
  125. select f_name from t_fees where del_flag = 0 and f_dc like '%D%'
  126. </select>
  127. <select id="getFeeStatistics" resultType="map">
  128. select
  129. ifnull(round(sum(if(f_dc = 'D', f_amount, 0)) / 10000, 2), 0) as receivable,
  130. ifnull(round(sum(if(f_dc = 'D', f_stlamount, 0)) / 10000, 2), 0) as received,
  131. ifnull(round((sum(if(f_dc = 'D', f_amount, 0)) - sum(if(f_dc = 'C', f_amount, 0))) / 10000, 2), 0) as profit
  132. from t_warehousebillsfees wf
  133. left join t_warehousebills tw on wf.f_pid = tw.f_id
  134. left join sys_user u on tw.create_by = u.user_name
  135. left join sys_dept d on tw.f_bsdeptid = d.dept_id
  136. where wf.f_review_date between #{params.beginDate} and #{params.endDate}
  137. ${params.dataScope}
  138. </select>
  139. <select id="getArrearsStatistics" resultType="map">
  140. select
  141. ifnull(tc.f_cname, tc.f_name) as name,
  142. ifnull(round(sum(f_amount) / 10000, 2), 0) as receivable
  143. from t_warehousebillsfees wf
  144. left join t_warehousebills tw on wf.f_pid = tw.f_id
  145. left join sys_user u on tw.create_by = u.user_name
  146. left join sys_dept d on tw.f_bsdeptid = d.dept_id
  147. left join t_corps tc on wf.f_corpid = tc.f_id
  148. where f_dc = 'D'
  149. ${params.dataScope}
  150. group by wf.f_corpid
  151. order by receivable desc
  152. limit 12
  153. </select>
  154. </mapper>