AppPermitMapper.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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.zhyc.xps.sys.mapper.AppPermitMapper">
  5. <resultMap id="AppPermitDtoMap" type="com.zhyc.xps.sys.dto.AppPermitDto" >
  6. <result column="oc_id" property="ocId" jdbcType="BIGINT" /><!--OC ID-->
  7. <result column="app_id" property="appId" jdbcType="BIGINT" /><!--App ID-->
  8. <result column="app_cat_title" property="appCatTitle" jdbcType="VARCHAR"/>
  9. <result column="app_cat_id" property="appCatId" jdbcType="BIGINT" />
  10. <result column="app_title" property="appTitle" jdbcType="VARCHAR"/>
  11. <result column="app_desc" property="appDesc" jdbcType="VARCHAR"/>
  12. <result column="app_logo" property="appLogo" jdbcType="VARCHAR"/>
  13. <result column="app_url" property="appUrl" jdbcType="VARCHAR"/>
  14. <result column="app_param" property="appParam" jdbcType="VARCHAR"/>
  15. <result column="app_desc" property="appDesc" jdbcType="VARCHAR"/>
  16. </resultMap>
  17. <sql id="AppPermitDto_Cols">
  18. A.app_id,
  19. A.oc_id,
  20. B.app_cat_id,
  21. C.app_cat_title,
  22. B.app_title,
  23. B.app_url,
  24. B.app_param,
  25. B.app_logo,
  26. B.app_desc
  27. </sql>
  28. <!--基于ID查询-->
  29. <select id="getById" resultMap="AppPermitDtoMap">
  30. SELECT
  31. <include refid="AppPermitDto_Cols"/>
  32. FROM app_permit AS A
  33. LEFT JOIN app AS B ON (A.app_id = B.app_id)
  34. LEFT JOIN app_cat AS C ON (B.app_cat_id = C.app_cat_id)
  35. WHERE A.oc_id = #{ocId ,jdbcType=BIGINT} AND A.app_id = #{appId ,jdbcType=BIGINT}
  36. </select>
  37. <!--列表查询-->
  38. <select id="getByList" resultMap="AppPermitDtoMap" parameterType="java.util.Map">
  39. SELECT
  40. <include refid="AppPermitDto_Cols"/>
  41. FROM app_permit AS A
  42. LEFT JOIN app AS B ON (A.app_id = B.app_id)
  43. LEFT JOIN app_cat AS C ON (B.app_cat_id = C.app_cat_id)
  44. WHERE A.oc_id = #{ocId ,jdbcType=BIGINT}
  45. <if test="keywords != null and keywords != ''">
  46. AND B.app_title like "%"#{keywords}"%"
  47. </if>
  48. <if test="appCatId != null">
  49. AND B.app_cat_id = #{appCatId ,jdbcType=BIGINT}
  50. </if>
  51. ORDER BY A.app_id ASC
  52. </select>
  53. <!--分页查询-->
  54. <select id="getByPage" resultMap="AppPermitDtoMap" parameterType="java.util.Map">
  55. SELECT
  56. <include refid="AppPermitDto_Cols"/>
  57. FROM app_permit AS A
  58. LEFT JOIN app AS B ON (A.app_id = B.app_id)
  59. LEFT JOIN app_cat AS C ON (B.app_cat_id = C.app_cat_id)
  60. WHERE A.oc_id = #{ocId ,jdbcType=BIGINT}
  61. <if test="keywords != null and keywords != ''">
  62. AND B.app_title like "%"#{keyword}"%"
  63. </if>
  64. <if test="appCatId != null">
  65. AND B.app_cat_id = #{appCatId ,jdbcType=BIGINT}
  66. </if>
  67. ORDER BY A.app_id ASC
  68. </select>
  69. <!--新增-->
  70. <insert id="create" parameterType="com.zhyc.xps.sys.entity.AppPermit" keyProperty="appId">
  71. INSERT INTO app_permit
  72. <trim prefix="(" suffix=")" suffixOverrides=",">
  73. <if test="appId != null">
  74. app_id,
  75. </if>
  76. <if test="ocId != null">
  77. oc_id,
  78. </if>
  79. </trim>
  80. <trim prefix="values (" suffix=")" suffixOverrides=",">
  81. <if test="appId != null">
  82. #{appId ,jdbcType=BIGINT},
  83. </if>
  84. <if test="ocId != null">
  85. #{ocId ,jdbcType=BIGINT},
  86. </if>
  87. </trim>
  88. </insert>
  89. <!--删除 -->
  90. <delete id="delete" parameterType="java.util.Map">
  91. DELETE from app_permit
  92. WHERE oc_id = #{ocId, jdbcType=BIGINT} AND app_id = #{appId ,jdbcType=BIGINT}
  93. </delete>
  94. </mapper>