OrgSuperviseMapper.xml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.zhyc.xps.sys.mapper.OrgSuperviseMapper">
  4. <resultMap id="OrgSuperviseDtoResultMap" type="com.zhyc.xps.sys.dto.OrgSuperviseDto">
  5. <result column="org_id" property="orgId" jdbcType="BIGINT" />
  6. <result column="org_name" property="orgName" jdbcType="VARCHAR" />
  7. <result column="oc_id" property="ocId" jdbcType="BIGINT" />
  8. <result column="oc_name" property="ocName" jdbcType="VARCHAR" />
  9. </resultMap>
  10. <sql id="OrgSuperviseDto_Cols">
  11. A.org_id,
  12. B.oc_name AS org_name,
  13. A.oc_id,
  14. C.oc_name
  15. </sql>
  16. <!--列表查询-->
  17. <select id="getByList" parameterType="java.util.Map" resultMap="OrgSuperviseDtoResultMap" >
  18. SELECT
  19. <include refid="OrgSuperviseDto_Cols"/>
  20. FROM org_supervise AS A
  21. LEFT JOIN oc AS B ON (A.org_id = B.oc_id)
  22. LEFT JOIN oc AS C ON (A.oc_id = C.oc_id)
  23. WHERE A.deleted_flag = 0
  24. <if test="keywords != null and keywords != ''">
  25. AND B.oc_name like "%"#{keywords}"%"
  26. </if>
  27. <if test="orgId != null">
  28. AND A.org_id = #{orgId}
  29. </if>
  30. <if test="ocId != null">
  31. AND A.oc_id = #{ocId}
  32. </if>
  33. </select>
  34. <insert id="create" parameterType="com.zhyc.xps.sys.entity.OrgSupervise">
  35. INSERT INTO org_supervise
  36. <trim prefix="(" suffix=")" suffixOverrides=",">
  37. <if test="superviseId != null">
  38. supervise_id,
  39. </if>
  40. <if test="orgId != null">
  41. org_id,
  42. </if>
  43. <if test="ocId != null">
  44. oc_id,
  45. </if>
  46. <if test="createdBy != null">
  47. created_by,
  48. </if>
  49. <if test="createdAt != null">
  50. created_at,
  51. </if>
  52. </trim>
  53. <trim prefix="values (" suffix=")" suffixOverrides=",">
  54. <if test="superviseId != null">
  55. #{superviseId ,jdbcType=BIGINT},
  56. </if>
  57. <if test="orgId != null">
  58. #{orgId ,jdbcType=BIGINT},
  59. </if>
  60. <if test="ocId != null">
  61. #{ocId ,jdbcType=BIGINT},
  62. </if>
  63. <if test="createdBy != null">
  64. #{createdBy ,jdbcType=BIGINT},
  65. </if>
  66. <if test="createdAt != null">
  67. #{createdAt ,jdbcType=TIMESTAMP},
  68. </if>
  69. </trim>
  70. </insert>
  71. <!--删除-->
  72. <update id="delete" parameterType="java.util.Map">
  73. UPDATE org_supervise
  74. <trim suffixOverrides=",">
  75. <set>
  76. <if test="deletedFlag != null">
  77. deleted_flag = #{deletedFlag, jdbcType=BIGINT},
  78. </if>
  79. <if test="deletedTime != null">
  80. deleted_time = #{deletedTime, jdbcType=TIMESTAMP},
  81. </if>
  82. <if test="deletedBy != null">
  83. deleted_by = #{deletedBy, jdbcType=BIGINT},
  84. </if>
  85. </set>
  86. </trim>
  87. WHERE 1 = 1
  88. <if test="superviseId != null">
  89. AND supervise_id = #{superviseId ,jdbcType=BIGINT}
  90. </if>
  91. <if test="orgId != null">
  92. AND org_id = #{orgId ,jdbcType=BIGINT}
  93. </if>
  94. <if test="ocId != null">
  95. AND oc_id = #{ocId ,jdbcType=BIGINT}
  96. </if>
  97. </update>
  98. </mapper>