AgentDitchMapper.xml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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.ytpm.dao.AgentDitchMapper">
  4. <insert id="insertOne" keyProperty="ditchId" useGeneratedKeys="true">
  5. insert into yt_ditch
  6. (
  7. ditch_id,
  8. ditch_name,
  9. user_id,
  10. app_type,
  11. app_id,
  12. is_delete,
  13. create_time
  14. )
  15. values
  16. (
  17. #{ditchId},
  18. #{ditchName},
  19. #{userId},
  20. #{appType},
  21. #{appId},
  22. #{isDelete},
  23. #{createTime}
  24. )
  25. </insert>
  26. <update id="update">
  27. update yt_ditch
  28. <set>
  29. <if test="ditchName !=null">
  30. ditch_name = #{ditchName},
  31. </if>
  32. <if test="appType !=null">
  33. app_type = #{appType},
  34. </if>
  35. <if test="isDelete !=null">
  36. is_delete = #{isDelete}
  37. </if>
  38. </set>
  39. where ditch_id = #{ditchId}
  40. </update>
  41. <select id="ditchList" resultType="com.ytpm.agent.view.AgentDitchView">
  42. select
  43. ditch_id, ditch_name, app_type, app_id, create_time
  44. from yt_ditch
  45. <where>
  46. user_id = #{userId}
  47. <if test="ditchName != null and ditchName != ''">
  48. AND ditch_name LIKE CONCAT('%', #{ditchName}, '%')
  49. </if>
  50. and is_delete=0
  51. </where>
  52. </select>
  53. <select id="selectById" resultType="com.ytpm.agent.model.YtDitch">
  54. select
  55. ditch_id, ditch_name, user_id, app_type, app_id, is_delete, create_time
  56. from yt_ditch
  57. where ditch_id = #{ditchId}
  58. </select>
  59. </mapper>