FncSubjectMapper.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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.ydtech.modules.fnc.dao.FncSubjectMapper">
  4. <resultMap id="BaseResultMap" type="com.ydtech.modules.fnc.model.FncSubject">
  5. <id column="fnc_year" jdbcType="VARCHAR" property="fncYear"/>
  6. <id column="sbjt_no" jdbcType="VARCHAR" property="sbjtNo"/>
  7. <result column="sbjt_name" jdbcType="VARCHAR" property="sbjtName"/>
  8. <result column="status" jdbcType="VARCHAR" property="status"/>
  9. <result column="createtime" jdbcType="DATE" property="createtime"/>
  10. <result column="create_by" jdbcType="VARCHAR" property="createBy"/>
  11. <result column="shop_id" jdbcType="VARCHAR" property="shopId"/>
  12. </resultMap>
  13. <sql id="Base_Column_List">
  14. fnc_year, sbjt_no, sbjt_name, status, createtime, create_by, shop_id
  15. </sql>
  16. <select id="selectBySbjtNo" parameterType="java.lang.String" resultMap="BaseResultMap">
  17. select
  18. <include refid="Base_Column_List"/>
  19. from fnc_subject
  20. where sbjt_no = #{sbjtNo,jdbcType=VARCHAR}
  21. </select>
  22. <select id="selectBySbjtName" parameterType="java.lang.String" resultMap="BaseResultMap">
  23. select
  24. <include refid="Base_Column_List"/>
  25. from fnc_subject
  26. where sbjt_name = #{sbjtName,jdbcType=VARCHAR}
  27. </select>
  28. <insert id="insert" parameterType="com.ydtech.modules.fnc.model.FncSubject">
  29. insert into fnc_subject (fnc_year, sbjt_no, sbjt_name, status, createtime, create_by, shop_id)
  30. values (#{fncYear,jdbcType=VARCHAR}, #{sbjtNo,jdbcType=VARCHAR}, #{sbjtName,jdbcType=VARCHAR},
  31. #{status,jdbcType=VARCHAR}, #{createtime,jdbcType=DATE},
  32. #{createBy,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR})
  33. </insert>
  34. <select id="selectBySbjtNameIsExits" resultType="java.lang.Integer">
  35. select count(1)
  36. from fnc_subject
  37. where sbjt_name = #{sbjtName,jdbcType=VARCHAR}
  38. AND sbjt_no != #{sbjtNo,jdbcType=VARCHAR}
  39. </select>
  40. <update id="updateByPrimaryKeySelective" parameterType="com.ydtech.modules.fnc.model.FncSubject">
  41. update fnc_subject
  42. <set>
  43. <if test="sbjtName != null">
  44. sbjt_name = #{sbjtName,jdbcType=VARCHAR},
  45. </if>
  46. <if test="fncYear != null">
  47. fnc_year = #{fncYear,jdbcType=VARCHAR},
  48. </if>
  49. <if test="status != null">
  50. status = #{status,jdbcType=VARCHAR},
  51. </if>
  52. <if test="createtime != null">
  53. createtime = #{createtime,jdbcType=DATE},
  54. </if>
  55. <if test="createBy != null">
  56. create_by = #{createBy,jdbcType=VARCHAR},
  57. </if>
  58. <if test="shopId != null">
  59. shop_id = #{shopId,jdbcType=VARCHAR},
  60. </if>
  61. </set>
  62. where sbjt_no = #{sbjtNo,jdbcType=VARCHAR}
  63. </update>
  64. <select id="select" resultMap="BaseResultMap">
  65. select
  66. <include refid="Base_Column_List"/>
  67. from fnc_subject
  68. where 1=1
  69. <if test="sbjtNo != null and sbjtNo != '' ">
  70. and sbjt_No = #{sbjtNo,jdbcType=VARCHAR}
  71. </if>
  72. <if test="sbjtName != null and sbjtName != ''">
  73. and sbjt_name like concat('%', #{sbjtName,jdbcType=VARCHAR},'%')
  74. </if>
  75. <if test="fncYear != null and fncYear != ''">
  76. and fnc_year = #{fncYear,jdbcType=VARCHAR}
  77. </if>
  78. <if test="status != null and status != ''">
  79. and status = #{status,jdbcType=VARCHAR}
  80. </if>
  81. <if test="createtime != null">
  82. and createtime = #{createtime,jdbcType=DATE}
  83. </if>
  84. <if test="createBy != null and createBy != ''">
  85. and create_by = #{createBy,jdbcType=VARCHAR}
  86. </if>
  87. <if test="shopId != null and shopId != ''">
  88. and shop_id = #{shopId,jdbcType=VARCHAR}
  89. </if>
  90. order by sbjt_no
  91. </select>
  92. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  93. delete
  94. from fnc_subject
  95. where sbjt_no = #{sbjtNo,jdbcType=VARCHAR}
  96. </delete>
  97. </mapper>