CompanyMiniappMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.company.mapper.CompanyMiniappMapper">
  6. <resultMap type="CompanyMiniapp" id="CompanyMiniappResult">
  7. <result property="id" column="id" />
  8. <result property="companyId" column="company_id" />
  9. <result property="appId" column="app_id" />
  10. <result property="type" column="type" />
  11. <result property="sortNum" column="sort_num" />
  12. <result property="createTime" column="create_time" />
  13. <result property="createBy" column="create_by" />
  14. <result property="updateBy" column="update_by" />
  15. <result property="updateTime" column="update_time" />
  16. <result property="remark" column="remark" />
  17. </resultMap>
  18. <sql id="selectCompanyMiniappVo">
  19. select id, company_id, app_id, type, sort_num, create_time, create_by, update_by, update_time, remark from company_miniapp
  20. </sql>
  21. <select id="selectCompanyMiniappList" parameterType="CompanyMiniapp" resultMap="CompanyMiniappResult">
  22. <include refid="selectCompanyMiniappVo"/>
  23. <where>
  24. <if test="companyId != null "> and company_id = #{companyId}</if>
  25. <if test="appId != null and appId != ''"> and app_id = #{appId}</if>
  26. <if test="type != null "> and type = #{type}</if>
  27. <if test="sortNum != null "> and sort_num = #{sortNum}</if>
  28. </where>
  29. </select>
  30. <select id="selectCompanyMiniappById" parameterType="Long" resultMap="CompanyMiniappResult">
  31. <include refid="selectCompanyMiniappVo"/>
  32. where id = #{id}
  33. </select>
  34. <select id="getFirstWatchMiniAppNameByCompanyId" resultType="java.lang.String">
  35. select fcpsc.name
  36. from company_miniapp cm
  37. inner join fs_course_play_source_config fcpsc on FIND_IN_SET(fcpsc.appid, cm.app_id) > 0
  38. where cm.company_id = #{companyId}
  39. order by cm.sort_num asc
  40. limit 1
  41. </select>
  42. <insert id="insertCompanyMiniapp" parameterType="CompanyMiniapp" useGeneratedKeys="true" keyProperty="id">
  43. insert into company_miniapp
  44. <trim prefix="(" suffix=")" suffixOverrides=",">
  45. <if test="companyId != null">company_id,</if>
  46. <if test="appId != null">app_id,</if>
  47. <if test="type != null">type,</if>
  48. <if test="sortNum != null">sort_num,</if>
  49. <if test="createTime != null">create_time,</if>
  50. <if test="createBy != null">create_by,</if>
  51. <if test="updateBy != null">update_by,</if>
  52. <if test="updateTime != null">update_time,</if>
  53. <if test="remark != null">remark,</if>
  54. </trim>
  55. <trim prefix="values (" suffix=")" suffixOverrides=",">
  56. <if test="companyId != null">#{companyId},</if>
  57. <if test="appId != null">#{appId},</if>
  58. <if test="type != null">#{type},</if>
  59. <if test="sortNum != null">#{sortNum},</if>
  60. <if test="createTime != null">#{createTime},</if>
  61. <if test="createBy != null">#{createBy},</if>
  62. <if test="updateBy != null">#{updateBy},</if>
  63. <if test="updateTime != null">#{updateTime},</if>
  64. <if test="remark != null">#{remark},</if>
  65. </trim>
  66. </insert>
  67. <update id="updateCompanyMiniapp" parameterType="CompanyMiniapp">
  68. update company_miniapp
  69. <trim prefix="SET" suffixOverrides=",">
  70. <if test="companyId != null">company_id = #{companyId},</if>
  71. <if test="appId != null">app_id = #{appId},</if>
  72. <if test="type != null">type = #{type},</if>
  73. <if test="sortNum != null">sort_num = #{sortNum},</if>
  74. <if test="createTime != null">create_time = #{createTime},</if>
  75. <if test="createBy != null">create_by = #{createBy},</if>
  76. <if test="updateBy != null">update_by = #{updateBy},</if>
  77. <if test="updateTime != null">update_time = #{updateTime},</if>
  78. <if test="remark != null">remark = #{remark},</if>
  79. </trim>
  80. where id = #{id}
  81. </update>
  82. <delete id="deleteCompanyMiniappById" parameterType="Long">
  83. delete from company_miniapp where id = #{id}
  84. </delete>
  85. <delete id="deleteCompanyMiniappByIds" parameterType="String">
  86. delete from company_miniapp where id in
  87. <foreach item="id" collection="array" open="(" separator="," close=")">
  88. #{id}
  89. </foreach>
  90. </delete>
  91. </mapper>