DataImportMapper.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.usoftchina.saas.document.mapper.DataImportMapper" >
  4. <resultMap id="DetailMap" type="com.usoftchina.saas.commons.po.DataImportDetail" >
  5. <id column="dd_id" property="dd_id" jdbcType="INTEGER" />
  6. <result column="dd_maindata" property="dd_maindata" jdbcType="VARCHAR" />
  7. <result column="dd_detno" property="dd_detno" jdbcType="INTEGER" />
  8. <result column="dd_diid" property="dd_diid" jdbcType="INTEGER" />
  9. <result column="dd_checked" property="dd_checked" jdbcType="INTEGER" />
  10. <result column="dd_success" property="dd_success" jdbcType="INTEGER" />
  11. <result column="dd_toformal" property="dd_toformal" jdbcType="INTEGER" />
  12. <result column="companyid" property="companyid" jdbcType="INTEGER" />
  13. <result column="dd_detaildata" property="dd_detaildata" jdbcType="VARCHAR" />
  14. <result column="dd_codevalue" property="dd_codevalue" jdbcType="VARCHAR" />
  15. </resultMap>
  16. <delete id="deleteByCaller">
  17. delete from data_import where di_caller=#{caller} and companyid=#{companyid} and
  18. il_toformal=0 and il_result is not null
  19. </delete>
  20. <insert id="insertSelective" parameterType="com.usoftchina.saas.commons.po.DataImport" >
  21. <selectKey resultType="java.lang.Integer" keyProperty="di_id">
  22. SELECT LAST_INSERT_ID() AS ID
  23. </selectKey>
  24. insert into data_import
  25. <trim prefix="(" suffix=")" suffixOverrides="," >
  26. <if test="di_caller != null" >
  27. di_caller,
  28. </if>
  29. <if test="companyid != null" >
  30. companyid,
  31. </if>
  32. <if test="di_date != null" >
  33. di_date,
  34. </if>
  35. <if test="di_count != null" >
  36. di_count,
  37. </if>
  38. <if test="di_result != null" >
  39. di_result,
  40. </if>
  41. <if test="di_success != null" >
  42. di_success,
  43. </if>
  44. <if test="di_man != null" >
  45. di_man,
  46. </if>
  47. <if test="di_toformal != null" >
  48. di_toformal,
  49. </if>
  50. </trim>
  51. <trim prefix="values (" suffix=")" suffixOverrides="," >
  52. <if test="di_caller != null" >
  53. #{di_caller,jdbcType=VARCHAR},
  54. </if>
  55. <if test="companyid != null" >
  56. #{companyid,jdbcType=INTEGER},
  57. </if>
  58. <if test="di_date != null" >
  59. #{di_date,jdbcType=TIMESTAMP},
  60. </if>
  61. <if test="di_count != null" >
  62. #{di_count,jdbcType=INTEGER},
  63. </if>
  64. <if test="di_result != null" >
  65. #{di_result,jdbcType=VARCHAR},
  66. </if>
  67. <if test="di_success != null" >
  68. #{di_success,jdbcType=INTEGER},
  69. </if>
  70. <if test="di_man != null" >
  71. #{di_man,jdbcType=VARCHAR},
  72. </if>
  73. <if test="di_toformal != null" >
  74. #{di_toformal,jdbcType=INTEGER},
  75. </if>
  76. </trim>
  77. </insert>
  78. <update id="updateErr" >
  79. update data_import
  80. set
  81. di_result = #{err},
  82. di_success = 0,
  83. where di_id = #{id}
  84. </update>
  85. <select id="selectDataById" resultMap="DetailMap">
  86. select * from data_importdetail
  87. where dd_diid = #{id}
  88. </select>
  89. <select id="selectMainBycode" resultMap="DetailMap">
  90. select * from data_importdetail
  91. where dd_codevalue = #{code} and dd_diid=#{id} and ifnull(dd_success,0)=0 and ifnull(dd_maindata,'')!='' and companyid=#{companyid}
  92. </select>
  93. <select id="selectMainOnly" resultMap="DetailMap">
  94. select * from data_importdetail
  95. where dd_diid=#{id} and ifnull(dd_success,0)=0 and ifnull(dd_maindata,'')!='' and companyid=#{companyid}
  96. </select>
  97. <update id="updateDataImport" parameterType="integer">
  98. update data_import set di_toformal=1,di_success=1 where di_id=#{id}
  99. </update>
  100. <update id="updateDataImportError">
  101. update data_import set di_toformal=1,di_result=#{err} where di_id=#{id}
  102. </update>
  103. </mapper>