ModelInfoMapper.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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.lqkj.info.mapper.ModelInfoMapper">
  6. <resultMap type="ModelInfo" id="ModelInfoResult">
  7. <result property="modelId" column="model_id" />
  8. <result property="modelName" column="model_name" />
  9. <result property="originalPath" column="original_path" />
  10. <result property="modelIcon" column="model_icon" />
  11. <result property="planId" column="plan_id" />
  12. <result property="trans" column="trans" />
  13. </resultMap>
  14. <sql id="selectModelInfoVo">
  15. select model_id, model_name, original_path, model_icon, plan_id, trans from model_info
  16. </sql>
  17. <select id="selectModelInfoList" parameterType="ModelInfo" resultMap="ModelInfoResult">
  18. <include refid="selectModelInfoVo"/>
  19. <where>
  20. <if test="modelName != null and modelName != ''"> and model_name like concat('%', #{modelName}, '%')</if>
  21. <if test="planId != null "> and plan_id = #{planId}</if>
  22. </where>
  23. order by model_id
  24. </select>
  25. <select id="selectModelInfoByModelId" parameterType="Integer" resultMap="ModelInfoResult">
  26. <include refid="selectModelInfoVo"/>
  27. where model_id = #{modelId}
  28. </select>
  29. <insert id="insertModelInfo" parameterType="ModelInfo" useGeneratedKeys="true" keyProperty="modelId">
  30. insert into model_info
  31. <trim prefix="(" suffix=")" suffixOverrides=",">
  32. <if test="modelName != null and modelName != ''">model_name,</if>
  33. <if test="originalPath != null and originalPath != ''">original_path,</if>
  34. <if test="modelIcon != null and modelIcon != ''">model_icon,</if>
  35. <if test="planId != null">plan_id,</if>
  36. <if test="trans != null">trans,</if>
  37. </trim>
  38. <trim prefix="values (" suffix=")" suffixOverrides=",">
  39. <if test="modelName != null and modelName != ''">#{modelName},</if>
  40. <if test="originalPath != null and originalPath != ''">#{originalPath},</if>
  41. <if test="modelIcon != null and modelIcon != ''">#{modelIcon},</if>
  42. <if test="planId != null">#{planId},</if>
  43. <if test="trans != null">#{trans,jdbcType=OTHER,typeHandler=com.lqkj.framework.sql.JsonbTypeHandler},</if>
  44. </trim>
  45. </insert>
  46. <update id="updateModelInfo" parameterType="ModelInfo">
  47. update model_info
  48. <trim prefix="SET" suffixOverrides=",">
  49. model_name = #{modelName},
  50. original_path = #{originalPath},
  51. model_icon = #{modelIcon},
  52. plan_id = #{planId},
  53. trans = #{trans,jdbcType=OTHER,typeHandler=com.lqkj.framework.sql.JsonbTypeHandler},
  54. </trim>
  55. where model_id = #{modelId}
  56. </update>
  57. <delete id="deleteModelInfoByModelId" parameterType="Integer">
  58. delete from model_info where model_id = #{modelId}
  59. </delete>
  60. <delete id="deleteModelInfoByModelIds" parameterType="String">
  61. delete from model_info where model_id in
  62. <foreach item="modelId" collection="array" open="(" separator="," close=")">
  63. #{modelId}
  64. </foreach>
  65. </delete>
  66. </mapper>