ChannelMapper.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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.simuwang.base.mapper.daq.ChannelMapper">
  4. <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.ChannelInfoDO" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="channel_name" property="channelName" jdbcType="VARCHAR" />
  7. <result column="channel_remark" property="channelRemark" jdbcType="VARCHAR" />
  8. <result column="creatorid" property="creatorId" jdbcType="INTEGER" />
  9. <result column="createtime" property="createTime" jdbcType="TIMESTAMP" />
  10. <result column="updaterid" property="updaterId" jdbcType="INTEGER" />
  11. <result column="updatetime" property="updateTime" jdbcType="TIMESTAMP" />
  12. <result column="isvalid" property="isvalid" jdbcType="INTEGER" />
  13. </resultMap>
  14. <delete id="deleteChannelById">
  15. update channel_info set isvalid=0,updatetime=now(),updaterid=#{userId} where id=#{id}
  16. </delete>
  17. <select id="selectByChannelName" resultMap="BaseResultMap">
  18. select * from channel_info where isvalid=1 and channel_name=#{channelName}
  19. </select>
  20. <resultMap id="BasePageResultMap" type="com.simuwang.base.pojo.dos.ChannelPageInfoDO" >
  21. <id column="id" property="id" jdbcType="INTEGER" />
  22. <result column="channel_name" property="channelName" jdbcType="VARCHAR" />
  23. <result column="user_name" property="userName" jdbcType="VARCHAR" />
  24. <result column="user_id" property="userId" jdbcType="VARCHAR" />
  25. <result column="responbility_email" property="responbilityEmail" jdbcType="VARCHAR" />
  26. <result column="email" property="email" jdbcType="VARCHAR" />
  27. <result column="channel_remark" property="channelRemark" jdbcType="VARCHAR" />
  28. <result column="creatorid" property="creatorId" jdbcType="INTEGER" />
  29. <result column="createtime" property="createTime" jdbcType="TIMESTAMP" />
  30. <result column="updaterid" property="updaterId" jdbcType="INTEGER" />
  31. <result column="updatetime" property="updateTime" jdbcType="TIMESTAMP" />
  32. <result column="isvalid" property="isvalid" jdbcType="INTEGER" />
  33. </resultMap>
  34. <select id="searchChannelList" resultMap="BasePageResultMap">
  35. select info.id,
  36. info.channel_name,
  37. info.channel_remark
  38. from channel_info info
  39. join user_channel_mapping e
  40. on info.id = e.channel_id
  41. where info.isvalid=1 and e.isvalid=1
  42. <if test="userId !=null and userId !=''">
  43. and e.user_id=#{userId}
  44. </if>
  45. group by info.id,info.channel_name,info.channel_remark
  46. limit #{offset},#{pageSize}
  47. </select>
  48. <select id="countChannelInfo" resultType="java.lang.Long">
  49. select count(distinct info.id) from channel_info info
  50. join user_channel_mapping e
  51. on info.id = e.channel_id
  52. where info.isvalid=1 and e.isvalid=1
  53. <if test="userId !=null and userId !=''">
  54. and e.user_id=#{userId}
  55. </if>
  56. </select>
  57. <select id="selectChannelIdByEmail" resultType="java.lang.Integer">
  58. select channel_id from channel_email_info where isvalid=1 and email=#{email}
  59. </select>
  60. <select id="searchChannelPage" resultMap="BasePageResultMap">
  61. select info.id,
  62. info.channel_name,
  63. info.channel_remark,
  64. wm_concat(e.email) as email,
  65. info.createtime,
  66. info.updatetime,
  67. info.isvalid,
  68. info.creatorid,
  69. info.updaterid,
  70. su.user_id,
  71. su.user_name,
  72. su.email as responbility_email
  73. from channel_info info
  74. left join channel_email_info e
  75. on info.id = e.channel_id and e.isvalid=1
  76. left join channel_responsibility_mapping crm
  77. on crm.channel_id = info.id and crm.isvalid=1
  78. left join sys_user su
  79. on su.user_id = crm.user_id and su.isvalid=1
  80. where info.isvalid=1
  81. <if test="channelName != null and channelName !=''">
  82. and info.channel_name like concat('%',#{channelName},'%')
  83. </if>
  84. GROUP BY info.channel_name
  85. order by info.createtime
  86. limit #{offset},#{pageSize}
  87. </select>
  88. <select id="countChannelInfoPage" resultType="java.lang.Long">
  89. select count(*) from channel_info where isvalid=1
  90. <if test="channelName != null and channelName !=''">
  91. and channel_name like concat('%',#{channelName},'%')
  92. </if>
  93. </select>
  94. <select id="selectAllChannel" resultMap="BaseResultMap">
  95. select id,channel,email,channel_remark from channel_info
  96. where isvalid=1
  97. </select>
  98. </mapper>