DictionaryMapper.xml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.tld.mapper.DictionaryMapper">
  5. <!-- 查询字典表明 -->
  6. <select id="getTableName" resultType="String">
  7. select table_name from tld_dictionary_pulic where name = #{type}
  8. </select>
  9. <!-- 物料字典新增 -->
  10. <insert id="addMaterial">
  11. insert into tld_material(code,name,tld_id,specification_and_model,unit_of_measurement,size,is_not_disable,is_recommend)
  12. values(#{code},#{name},#{tldId},#{specificationAndModel},#{unitOfMeasurement},'0','0','0')
  13. </insert>
  14. <!-- 字典新增 -->
  15. <insert id="addDictionary">
  16. insert into ${tableName}(code,name,tld_id)
  17. values(#{code},#{name},#{tldId})
  18. </insert>
  19. <!-- 查询字典内容 -->
  20. <select id="getDictionary" resultType="com.tld.model.Dictionary">
  21. select * from ${tableName}
  22. <trim prefix="WHERE" prefixOverrides="and |or">
  23. <if test="name != null and name != ''">
  24. and name = #{name}
  25. </if>
  26. <if test="code != null and code != ''">
  27. and code = #{code}
  28. </if>
  29. <if test="tldId != null and tldId != ''">
  30. and tld_id = #{tldId}
  31. </if>
  32. </trim>
  33. </select>
  34. <!-- 查询字典内容分页 -->
  35. <select id="getDictionaryPage" resultType="com.tld.model.Dictionary">
  36. select
  37. a.*,b.name as materialType
  38. from ${tableName} a
  39. left join tld_material_type b on a.wllb_class = b.tld_id
  40. <trim prefix="WHERE" prefixOverrides="and |or">
  41. <if test="name != null and name != ''">
  42. and a.name = #{name}
  43. </if>
  44. <if test="code != null and code != ''">
  45. and a.code = #{code}
  46. </if>
  47. <if test="tldId != null and tldId != ''">
  48. and a.tld_id = #{tldId}
  49. </if>
  50. </trim>
  51. </select>
  52. <!-- 库账对存字典新增 -->
  53. <insert id="addTreasuryAccount">
  54. insert into tld_treasury_account(material_id,code,name,num)
  55. values(#{materialId},#{code},#{name},#{num})
  56. </insert>
  57. </mapper>