MaterialExtendMapperEx.xml 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.jsh.erp.datasource.mappers.MaterialExtendMapperEx" >
  4. <resultMap extends="com.jsh.erp.datasource.mappers.MaterialExtendMapper.BaseResultMap" id="ResultMapList" type="com.jsh.erp.datasource.vo.MaterialExtendVo4List">
  5. </resultMap>
  6. <select id="getDetailList" parameterType="com.jsh.erp.datasource.entities.MaterialExtendExample" resultType="com.jsh.erp.datasource.vo.MaterialExtendVo4List">
  7. select distinct d.id,d.commodity_unit,d.sku,d.commodity_decimal,d.purchase_decimal,d.wholesale_decimal,
  8. d.low_decimal,d.default_flag,d.production_date,d.expiry_num,d.supplier_id,d.bar_code,d.batch_number,d.inventory,d.depot_id,d.position
  9. from jsh_material_extend d
  10. where d.material_id = #{materialId}
  11. and ifnull(d.delete_flag,'0') !='1'
  12. order by d.default_flag desc,d.id asc
  13. </select>
  14. <select id="getMaxTimeByTenantAndTime" resultType="java.lang.Long">
  15. select max(update_time) from
  16. (
  17. select update_time from jsh_material_extend
  18. where 1=1
  19. <if test="lastTime != null">
  20. and update_time > #{lastTime}
  21. </if>
  22. order by update_time asc
  23. <if test="syncNum != null">
  24. limit 0,#{syncNum}
  25. </if>
  26. ) time_list
  27. </select>
  28. <select id="getListByMId" resultType="com.jsh.erp.datasource.entities.MaterialExtend">
  29. select
  30. <include refid="com.jsh.erp.datasource.mappers.MaterialExtendMapper.Base_Column_List" />
  31. from jsh_material_extend
  32. where 1=1
  33. and ifnull(delete_Flag,'0') !='1'
  34. and material_id in (
  35. <foreach collection="ids" item="id" separator=",">
  36. #{id}
  37. </foreach>
  38. )
  39. group by material_id
  40. </select>
  41. <update id="batchDeleteMaterialExtendByIds">
  42. update jsh_material_extend
  43. set delete_Flag='1'
  44. where 1=1
  45. and ifnull(delete_Flag,'0') !='1'
  46. and id in (
  47. <foreach collection="ids" item="id" separator=",">
  48. #{id}
  49. </foreach>
  50. )
  51. </update>
  52. <update id="batchDeleteMaterialExtendByMIds">
  53. update jsh_material_extend
  54. set delete_Flag='1'
  55. where 1=1
  56. and ifnull(delete_Flag,'0') !='1'
  57. and material_id in (
  58. <foreach collection="ids" item="id" separator=",">
  59. #{id}
  60. </foreach>
  61. )
  62. </update>
  63. <update id="specialUpdatePrice" parameterType="com.jsh.erp.datasource.entities.MaterialExtend">
  64. update jsh_material_extend
  65. set purchase_decimal = #{purchaseDecimal,jdbcType=DECIMAL},
  66. commodity_decimal = #{commodityDecimal,jdbcType=DECIMAL},
  67. wholesale_decimal = #{wholesaleDecimal,jdbcType=DECIMAL},
  68. low_decimal = #{lowDecimal,jdbcType=DECIMAL}
  69. where id = #{id,jdbcType=BIGINT}
  70. and ifnull(delete_flag,'0') !='1'
  71. </update>
  72. <select id="getBasicInfoByMid" resultType="com.jsh.erp.datasource.entities.MaterialExtend">
  73. select * from jsh_material_extend
  74. where material_id=#{materialId} and default_flag='1'
  75. and ifnull(delete_Flag,'0') !='1'
  76. </select>
  77. </mapper>