MgrOrganizationMapper.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <!DOCTYPE mapper
  2. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.bosshand.virgo.core.dao.MgrOrganizationDao">
  5. <resultMap type="com.bosshand.virgo.core.model.MgrOrganization" id="MgrOrganizationResult" >
  6. <id column="id" property="id"/>
  7. <result column="logo" property="logo"/>
  8. <result column="name" property="name"/>
  9. <result column="contact" property="contact"/>
  10. <result column="contactTel" property="contactTel"/>
  11. <result column="address" property="address"/>
  12. <result column="businessLicense" property="businessLicense"/>
  13. <result column="introduction" property="introduction"/>
  14. <result column="registerDate" property="registerDate"/>
  15. <result column="status" property="status"/>
  16. <result column="organizedDataCenter" property="organizedDataCenter"/>
  17. <result column="organizationCode" property="organizationCode"/>
  18. <result column="facilitator" property="facilitator"/>
  19. <result column="creditNo" property="creditNo"/>
  20. <result column="legalPerson" property="legalPerson"/>
  21. <result column="certificationStatus" property="certificationStatus"/>
  22. </resultMap>
  23. <select id="getById" resultMap="MgrOrganizationResult">
  24. select * from mgr_organization where id = #{id}
  25. </select>
  26. <select id="listAll" resultMap="MgrOrganizationResult">
  27. select * from mgr_organization where status = 1
  28. </select>
  29. <select id="listByIds" resultMap="MgrOrganizationResult">
  30. select * from mgr_organization
  31. <choose>
  32. <when test="list != null and list.size>0">
  33. where id in (
  34. <foreach collection="list" item="item" index="index"
  35. separator=",">
  36. #{item}
  37. </foreach>
  38. )
  39. </when>
  40. <otherwise>
  41. where 1=0
  42. </otherwise>
  43. </choose>
  44. </select>
  45. <select id="get" resultMap="MgrOrganizationResult">
  46. select * from mgr_organization where id = #{id}
  47. </select>
  48. <select id="getByOrganizationCode" resultMap="MgrOrganizationResult">
  49. select * from mgr_organization where organizationCode = #{organizationCode}
  50. </select>
  51. <select id="getByOrganizationName" resultMap="MgrOrganizationResult">
  52. select * from mgr_organization where name like '%${name}%'
  53. </select>
  54. <select id="organizationByIds" parameterType="list" resultMap="MgrOrganizationResult">
  55. select * from mgr_organization where id in (
  56. <trim>
  57. <if test="list.size > 0">
  58. <foreach collection="list" item="item" index="index" separator=",">
  59. #{item}
  60. </foreach>
  61. </if>
  62. </trim>
  63. )
  64. </select>
  65. <select id="getList" resultMap="MgrOrganizationResult">
  66. select * from mgr_organization
  67. <where>
  68. <trim>
  69. <if test="name != null and name !=''">name = #{name}</if>
  70. <if test="registerDate != null and registerDate !=''">registerDate = #{registerDate}</if>
  71. <if test="status == 0 or status == 1">status = #{status}</if>
  72. </trim>
  73. </where>
  74. order by registerDate desc limit #{currIndex} , #{pageSize}
  75. </select>
  76. <select id="getTotalCount" parameterType="map" resultType="Integer">
  77. SELECT count(*) FROM mgr_organization
  78. <where>
  79. <trim>
  80. <if test="name != null and name !=''">name = #{name}</if>
  81. <if test="registerDate != null and registerDate !=''">registerDate = #{registerDate}</if>
  82. <if test="status == 0 or status == 1">status = #{status}</if>
  83. </trim>
  84. </where>
  85. </select>
  86. <insert id="insert" parameterType="com.bosshand.virgo.core.model.MgrOrganization" useGeneratedKeys="true" keyProperty="id">
  87. INSERT into mgr_organization(logo, name, contact, contactTel, address, businessLicense, introduction, registerDate, status, organizationCode, facilitator, creditNo, legalPerson)
  88. values(#{logo}, #{name}, #{contact}, #{contactTel}, #{address}, #{businessLicense}, #{introduction}, now(), #{status}, #{organizationCode}, #{facilitator}, #{creditNo}, #{legalPerson})
  89. </insert>
  90. <update id="update" parameterType="com.bosshand.virgo.core.model.MgrOrganization">
  91. UPDATE mgr_organization
  92. <trim prefix="set" suffixOverrides=",">
  93. <if test="id!=null">id=#{id},</if>
  94. <if test="logo!=null">logo=#{logo},</if>
  95. <if test="name!=null">name=#{name},</if>
  96. <if test="contact!=null">contact=#{contact},</if>
  97. <if test="contactTel!=null">contactTel=#{contactTel},</if>
  98. <if test="address!=null">address=#{address},</if>
  99. <if test="businessLicense!=null">businessLicense=#{businessLicense},</if>
  100. <if test="introduction!=null">introduction=#{introduction},</if>
  101. <if test="registerDate!=null">registerDate=#{registerDate},</if>
  102. <if test="organizedDataCenter!=0">organizedDataCenter=#{organizedDataCenter},</if>
  103. <if test="facilitator!=null">facilitator=#{facilitator},</if>
  104. <if test="creditNo!=null">creditNo=#{creditNo},</if>
  105. <if test="legalPerson!=null">legalPerson=#{legalPerson},</if>
  106. </trim>
  107. WHERE id=#{id}
  108. </update>
  109. <update id="updateStatus" parameterType="com.bosshand.virgo.core.model.MgrOrganization">
  110. UPDATE mgr_organization
  111. <trim prefix="set" suffixOverrides=",">
  112. <if test="status == 0 or status == 1">status=#{status},</if>
  113. </trim>
  114. WHERE id=#{id}
  115. </update>
  116. <update id="updateCertificationStatus" parameterType="com.bosshand.virgo.core.model.MgrOrganization">
  117. UPDATE mgr_organization
  118. <trim prefix="set" suffixOverrides=",">
  119. <if test="certificationStatus == 0 or certificationStatus == 1">certificationStatus=#{certificationStatus},</if>
  120. </trim>
  121. WHERE id=#{id}
  122. </update>
  123. <update id="setOrganizedDataCenter" parameterType="com.bosshand.virgo.core.model.MgrOrganization">
  124. UPDATE mgr_organization set organizedDataCenter = #{organizedDataCenter} WHERE id=#{id}
  125. </update>
  126. </mapper>