TWarehouseAreaMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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.TWarehouseAreaMapper">
  6. <resultMap type="TWarehouseArea" id="TWarehouseAreaResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fWarehouseid" column="f_warehouseid"/>
  9. <result property="fNo" column="f_no"/>
  10. <result property="fName" column="f_name"/>
  11. <result property="fTotalgross" column="f_totalgross"/>
  12. <result property="fAddr" column="f_addr"/>
  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. </resultMap>
  21. <sql id="selectTWarehouseAreaVo">
  22. select f_id, f_warehouseid, f_no, f_name, f_totalgross ,f_addr, f_status, del_flag, create_by, create_time, update_by, update_time, remark from t_warehouse_area
  23. </sql>
  24. <select id="selectTWarehouseAreaList" parameterType="TWarehouseArea" resultMap="TWarehouseAreaResult">
  25. select a.f_id, a.f_warehouseid, a.f_no, a.f_name,w.f_totalgross, a.f_addr, a.f_status, a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.remark from t_warehouse_area a
  26. left join t_warehouse w on w.f_id = a.f_warehouseid
  27. where a.del_flag = '0'
  28. <if test="fNo != null and fNo != ''">and a.f_no = #{fNo}</if>
  29. <if test="fName != null and fName != ''">and a.f_name like concat('%', #{fName}, '%')</if>
  30. <if test="fStatus != null and fStatus != ''">and a.f_status = #{fStatus}</if>
  31. <if test="fWarehouseid != null and fWarehouseid != 0">
  32. AND (a.f_warehouseid = #{fWarehouseid} OR a.f_warehouseid IN ( SELECT t.f_id FROM t_warehouse t WHERE find_in_set(#{fWarehouseid}, ancestors) ))
  33. </if>
  34. <!-- 数据范围过滤 -->
  35. ${params.dataScope}
  36. </select>
  37. <select id="selectTWarehouseAreaById" parameterType="Long" resultMap="TWarehouseAreaResult">
  38. <include refid="selectTWarehouseAreaVo"/>
  39. where f_id = #{fId}
  40. </select>
  41. <insert id="insertTWarehouseArea" parameterType="TWarehouseArea" useGeneratedKeys="true" keyProperty="fId">
  42. insert into t_warehouse_area
  43. <trim prefix="(" suffix=")" suffixOverrides=",">
  44. <if test="fWarehouseid != null">f_warehouseid,</if>
  45. <if test="fNo != null and fNo != ''">f_no,</if>
  46. <if test="fName != null and fName != ''">f_name,</if>
  47. <if test="fTotalgross != null">f_totalgross,</if>
  48. <if test="fAddr != null and fAddr != ''">f_addr,</if>
  49. <if test="fStatus != null">f_status,</if>
  50. <if test="delFlag != null">del_flag,</if>
  51. <if test="createBy != null">create_by,</if>
  52. <if test="createTime != null">create_time,</if>
  53. <if test="updateBy != null">update_by,</if>
  54. <if test="updateTime != null">update_time,</if>
  55. <if test="remark != null">remark,</if>
  56. </trim>
  57. <trim prefix="values (" suffix=")" suffixOverrides=",">
  58. <if test="fWarehouseid != null">#{fWarehouseid},</if>
  59. <if test="fNo != null and fNo != ''">#{fNo},</if>
  60. <if test="fName != null and fName != ''">#{fName},</if>
  61. <if test="fTotalgross != null">#{fTotalgross},</if>
  62. <if test="fAddr != null and fAddr != ''">#{fAddr},</if>
  63. <if test="fStatus != null">#{fStatus},</if>
  64. <if test="delFlag != null">#{delFlag},</if>
  65. <if test="createBy != null">#{createBy},</if>
  66. <if test="createTime != null">#{createTime},</if>
  67. <if test="updateBy != null">#{updateBy},</if>
  68. <if test="updateTime != null">#{updateTime},</if>
  69. <if test="remark != null">#{remark},</if>
  70. </trim>
  71. </insert>
  72. <update id="updateTWarehouseArea" parameterType="TWarehouseArea">
  73. update t_warehouse_area
  74. <trim prefix="SET" suffixOverrides=",">
  75. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  76. <if test="fNo != null and fNo != ''">f_no = #{fNo},</if>
  77. <if test="fName != null and fName != ''">f_name = #{fName},</if>
  78. <if test="fTotalgross != null">f_totalgross = #{fTotalgross},</if>
  79. <if test="fAddr != null and fAddr != ''">f_addr = #{fAddr},</if>
  80. <if test="fStatus != null">f_status = #{fStatus},</if>
  81. <if test="delFlag != null">del_flag = #{delFlag},</if>
  82. <if test="createBy != null">create_by = #{createBy},</if>
  83. <if test="createTime != null">create_time = #{createTime},</if>
  84. <if test="updateBy != null">update_by = #{updateBy},</if>
  85. <if test="updateTime != null">update_time = #{updateTime},</if>
  86. <if test="remark != null">remark = #{remark},</if>
  87. </trim>
  88. where f_id = #{fId}
  89. </update>
  90. <delete id="deleteTWarehouseAreaById" parameterType="Long">
  91. delete from t_warehouse_area where f_id = #{fId}
  92. </delete>
  93. <delete id="deleteTWarehouseAreaByTWarehoused" parameterType="Long">
  94. delete from t_warehouse_area where f_warehouseid = #{fId}
  95. </delete>
  96. <delete id="deleteTWarehouseAreaByIds" parameterType="String">
  97. delete from t_warehouse_area where f_id in
  98. <foreach item="fId" collection="array" open="(" separator="," close=")">
  99. #{fId}
  100. </foreach>
  101. </delete>
  102. <select id="checkFNoUnique" resultMap="TWarehouseAreaResult">
  103. select f_id,f_no from t_warehouse_area where f_no = #{fNo} and f_warehouseid = #{fWarehouseid} limit 1
  104. </select>
  105. <select id="checkUFNnameUnique" resultMap="TWarehouseAreaResult">
  106. select f_id,f_name from t_warehouse_area where f_name = #{fNname} and f_warehouseid = #{fWarehouseid} limit 1
  107. </select>
  108. <select id="selectTWarehouseAreaByWarehouseId" resultMap="TWarehouseAreaResult">
  109. select f_id from t_warehouse_area where f_warehouseid = #{fId} limit 1
  110. </select>
  111. <select id="selectTWarehouseArea" resultType="java.math.BigDecimal">
  112. SELECT
  113. sum( f_totalgross ) AS fTotalgross
  114. FROM
  115. t_warehouse_area
  116. WHERE
  117. f_warehouseid = #{fId}
  118. </select>
  119. </mapper>