ChannelMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. where info.isvalid=1
  40. <if test="userId !=null and userId !=''">
  41. and e.user_id=#{userId}
  42. </if>
  43. limit #{offset},#{pageSize}
  44. </select>
  45. <select id="countChannelInfo" resultType="java.lang.Long">
  46. select count(distinct info.id) from channel_info info
  47. where info.isvalid=1
  48. <if test="userId !=null and userId !=''">
  49. and e.user_id=#{userId}
  50. </if>
  51. </select>
  52. <select id="selectChannelIdByEmail" resultType="java.lang.Integer">
  53. select channel_id from channel_email_info where isvalid=1 and email=#{email}
  54. </select>
  55. <select id="searchChannelPage" resultMap="BasePageResultMap">
  56. select info.id,
  57. info.channel_name,
  58. info.channel_remark,
  59. wm_concat(e.email) as email,
  60. info.createtime,
  61. info.updatetime,
  62. info.isvalid,
  63. info.creatorid,
  64. info.updaterid,
  65. su.user_id,
  66. su.user_name,
  67. su.email as responbility_email
  68. from channel_info info
  69. left join channel_email_info e
  70. on info.id = e.channel_id and e.isvalid=1
  71. left join channel_responsibility_mapping crm
  72. on crm.channel_id = info.id and crm.isvalid=1
  73. left join sys_user su
  74. on su.user_id = crm.user_id and su.isvalid=1
  75. where info.isvalid=1
  76. <if test="channelName != null and channelName !=''">
  77. and info.channel_name like concat('%',#{channelName},'%')
  78. </if>
  79. GROUP BY info.channel_name
  80. order by info.createtime
  81. limit #{offset},#{pageSize}
  82. </select>
  83. <select id="countChannelInfoPage" resultType="java.lang.Long">
  84. select count(*) from channel_info where isvalid=1
  85. <if test="channelName != null and channelName !=''">
  86. and channel_name like concat('%',#{channelName},'%')
  87. </if>
  88. </select>
  89. <select id="selectAllChannel" resultMap="BaseResultMap">
  90. select id,channel,email,channel_remark from channel_info
  91. where isvalid=1
  92. </select>
  93. </mapper>