DcSpecMapper.xml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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.gqy.document.mapper.DcSpecMapper">
  4. <resultMap type="DcSpec" id="DcSpecResult">
  5. <result property="ps_id" column="ps_id" />
  6. <result property="ps_p_id" column="ps_p_id" />
  7. <result property="ps_no" column="pa_no" />
  8. <result property="ps_name" column="ps_name" />
  9. <result property="ps_status" column="ps_status" />
  10. <result property="ps_dck_id" column="ps_dck_id" />
  11. </resultMap>
  12. <sql id="selectDcSpecVo">
  13. select ps_id, ps_p_id, pa_no, ps_name, ps_dck_id from dc_spec
  14. </sql>
  15. <select id="selectDcSpecList" parameterType="DcSpec" resultMap="DcSpecResult">
  16. <include refid="selectDcSpecVo"/>
  17. <where>
  18. <if test="ps_p_id != null and ps_p_id != ''"> and ps_p_id = #{ps_p_id}</if>
  19. <if test="pa_no != null and pa_no != ''"> and pa_no = #{pa_no}</if>
  20. <if test="ps_name != null and ps_name != ''"> and ps_name like concat('%', #{ps_name}, '%')</if>
  21. <if test="ps_dck_id != null "> and ps_dck_id = #{ps_dck_id}</if>
  22. </where>
  23. </select>
  24. <!-- 其他SQL语句的参数名也需要相应修改 -->
  25. <insert id="insertDcSpec" parameterType="DcSpec" useGeneratedKeys="true" keyProperty="ps_id">
  26. insert into dc_spec
  27. <trim prefix="(" suffix=")" suffixOverrides=",">
  28. <if test="ps_p_id != null and ps_p_id != ''">ps_p_id,</if>
  29. <if test="pa_no != null and pa_no != ''">pa_no,</if>
  30. <if test="ps_name != null and ps_name != ''">ps_name,</if>
  31. <if test="ps_dck_id != null">ps_dck_id,</if>
  32. </trim>
  33. <trim prefix="values (" suffix=")" suffixOverrides=",">
  34. <if test="ps_p_id != null and ps_p_id != ''">#{ps_p_id},</if>
  35. <if test="pa_no != null and pa_no != ''">#{pa_no},</if>
  36. <if test="ps_name != null and ps_name != ''">#{ps_name},</if>
  37. <if test="ps_dck_id != null">#{ps_dck_id},</if>
  38. </trim>
  39. </insert>
  40. <update id="updateDcSpec" parameterType="DcSpec">
  41. update dc_spec
  42. <trim prefix="SET" suffixOverrides=",">
  43. <if test="ps_p_id != null">ps_p_id = #{ps_p_id},</if>
  44. <if test="pa_no != null">pa_no = #{pa_no},</if>
  45. <if test="ps_name != null">ps_name = #{ps_name},</if>
  46. <if test="ps_dck_id != null">ps_dck_id = #{ps_dck_id},</if>
  47. </trim>
  48. where ps_id = #{ps_id}
  49. </update>
  50. <select id="selectDcSpecById" parameterType="Integer" resultMap="DcSpecResult">
  51. <include refid="selectDcSpecVo"/>
  52. where ps_id = #{ps_id}
  53. </select>
  54. </mapper>