BisInspPersOrgDao.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.BisInspPersOrgDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspPersOrg" id="bisInspPersOrgResultMap">
  5. <result property="persId" column="PERS_ID"/>
  6. <result property="orgId" column="ORG_ID"/>
  7. <result property="userType" column="USER_TYPE"/>
  8. </resultMap>
  9. <sql id="table_columns">
  10. PERS_ID,
  11. ORG_ID,
  12. USER_TYPE
  13. </sql>
  14. <sql id="entity_properties">
  15. #{persId},
  16. #{orgId},
  17. #{userType}
  18. </sql>
  19. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  20. <sql id="page_where">
  21. <trim prefix="where" prefixOverrides="and | or ">
  22. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  23. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  24. <if test="userType != null and userType != ''">and USER_TYPE = #{userType}</if>
  25. </trim>
  26. </sql>
  27. <select id="get" resultMap="bisInspPersOrgResultMap" parameterType="String" >
  28. select <include refid="table_columns" /> from BIS_INSP_PERS_ORG where ID = #{id}
  29. </select>
  30. <select id="getBy" resultMap="bisInspPersOrgResultMap">
  31. select <include refid="table_columns" /> from BIS_INSP_PERS_ORG <include refid="page_where" />
  32. </select>
  33. <select id="findAll" resultMap="bisInspPersOrgResultMap">
  34. select <include refid="table_columns" /> from BIS_INSP_PERS_ORG
  35. </select>
  36. <select id="findList" resultMap="bisInspPersOrgResultMap">
  37. select <include refid="table_columns" /> from BIS_INSP_PERS_ORG <include refid="page_where" />
  38. </select>
  39. <select id="selectCount" resultType="int" >
  40. select count(ID) from BIS_INSP_PERS_ORG <include refid="page_where" />
  41. </select>
  42. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspPersOrg">
  43. insert into BIS_INSP_PERS_ORG( <include refid="table_columns" /> )
  44. values ( <include refid="entity_properties" /> )
  45. </insert>
  46. <delete id="delete" parameterType="java.lang.String">
  47. delete from BIS_INSP_PERS_ORG where PERS_ID = #{persId}
  48. </delete>
  49. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPersOrg">
  50. delete from BIS_INSP_PERS_ORG <include refid="page_where" />
  51. </delete>
  52. <update id="deleteInFlag" parameterType="java.lang.String">
  53. update BIS_INSP_PERS_ORG set flag_valid = 0 where ID = #{id}
  54. </update>
  55. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspPersOrg">
  56. update BIS_INSP_PERS_ORG
  57. <trim prefix="set" suffixOverrides=",">
  58. <if test="userType != null and userType != ''">USER_TYPE = #{userType},</if>
  59. </trim>
  60. <where>ORG_ID = #{orgId} and PERS_ID=#{persId}</where>
  61. </update>
  62. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPersOrg">
  63. update BIS_INSP_PERS_ORG
  64. <trim prefix="set" suffixOverrides=",">
  65. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  66. </trim>
  67. <include refid="page_where" />
  68. </update>
  69. <!-- 其他自定义SQL -->
  70. </mapper>