TacPawpLawsDao.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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="cn.com.goldenwater.dcproj.dao.TacPawpLawsDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.TacPawpLaws" id="tacPawpLawsResultMap">
  5. <result property="tacType" column="TAC_TYPE"/>
  6. <result property="class1Name" column="CLASS1_NAME"/>
  7. <result property="class2Name" column="CLASS2_NAME"/>
  8. <result property="sn" column="SN"/>
  9. <result property="lawName" column="LAW_NAME"/>
  10. <result property="id" column="ID"/>
  11. </resultMap>
  12. <sql id="table_columns">
  13. ID,
  14. TAC_TYPE,
  15. CLASS1_NAME,
  16. CLASS2_NAME,
  17. SN,
  18. LAW_NAME
  19. </sql>
  20. <sql id="entity_properties">
  21. #{id}
  22. #{tacType},
  23. #{class1Name},
  24. #{class2Name},
  25. #{sn},
  26. #{lawName}
  27. </sql>
  28. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  29. <sql id="page_where">
  30. <trim prefix="where" prefixOverrides="and | or ">
  31. <if test="class1Name != null and class1Name != ''">and CLASS1_NAME like '%${class1Name}%'</if>
  32. <if test="class2Name != null and class2Name != ''">and CLASS2_NAME like '%${class2Name}%'</if>
  33. <if test="sn != null and sn != ''">and SN = #{sn}</if>
  34. <if test="lawName != null and lawName != ''">and LAW_NAME like '%${lawName}%'</if>
  35. <if test="id != null and id != ''">and ID = #{id}</if>
  36. </trim>
  37. </sql>
  38. <select id="get" resultMap="tacPawpLawsResultMap" parameterType="String">
  39. select
  40. <include refid="table_columns"/>
  41. from TAC_PAWP_LAWS where ID = #{id}
  42. </select>
  43. <select id="getBy" resultMap="tacPawpLawsResultMap">
  44. select
  45. <include refid="table_columns"/>
  46. from TAC_PAWP_LAWS
  47. <include refid="page_where"/>
  48. </select>
  49. <select id="findAll" resultMap="tacPawpLawsResultMap">
  50. select
  51. <include refid="table_columns"/>
  52. from TAC_PAWP_LAWS
  53. </select>
  54. <select id="findList" resultMap="tacPawpLawsResultMap">
  55. select
  56. <include refid="table_columns"/>
  57. from TAC_PAWP_LAWS
  58. <include refid="page_where"/>
  59. </select>
  60. <select id="selectCount" resultType="int">
  61. select count(ID) from TAC_PAWP_LAWS
  62. <include refid="page_where"/>
  63. </select>
  64. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacPawpLaws">
  65. insert into TAC_PAWP_LAWS(
  66. <include refid="table_columns"/>
  67. )
  68. values (
  69. <include refid="entity_properties"/>
  70. )
  71. </insert>
  72. <delete id="delete" parameterType="java.lang.String">
  73. delete from TAC_PAWP_LAWS where ID = #{id}
  74. </delete>
  75. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacPawpLaws">
  76. delete from TAC_PAWP_LAWS
  77. <include refid="page_where"/>
  78. </delete>
  79. <update id="deleteInFlag" parameterType="java.lang.String">
  80. update TAC_PAWP_LAWS set flag_valid = 0 where ID = #{id}
  81. </update>
  82. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacPawpLaws">
  83. update TAC_PAWP_LAWS
  84. <trim prefix="set" suffixOverrides=",">
  85. <if test="class1Name != null and class1Name != ''">CLASS1_NAME = #{class1Name},</if>
  86. <if test="class2Name != null and class2Name != ''">CLASS2_NAME = #{class2Name},</if>
  87. <if test="sn != null and sn != ''">SN = #{sn},</if>
  88. <if test="lawName != null and lawName != ''">LAW_NAME = #{lawName},</if>
  89. </trim>
  90. <where>ID = #{id}</where>
  91. </update>
  92. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacPawpLaws">
  93. update TAC_PAWP_LAWS
  94. <trim prefix="set" suffixOverrides=",">
  95. <if test="class1Name != null and class1Name != ''">CLASS1_NAME = #{class1Name},</if>
  96. <if test="class2Name != null and class2Name != ''">CLASS2_NAME = #{class2Name},</if>
  97. <if test="sn != null and sn != ''">SN = #{sn},</if>
  98. <if test="lawName != null and lawName != ''">LAW_NAME = #{lawName},</if>
  99. </trim>
  100. <include refid="page_where"/>
  101. </update>
  102. <!-- 其他自定义SQL -->
  103. </mapper>