jack
2024-04-02 4046f94a57f0c10e9509a49ad0d37d701aeb8186
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nq.dao.StockOptionMapper" >
  <resultMap id="BaseResultMap" type="com.nq.pojo.StockOption" >
      <id column="id"  property="id" />
      <result column="user_id" property="userId"  />
      <result column="stock_id" property="stockId"  />
      <result column="add_time" property="addTime"  />
      <result column="stock_code" property="stockCode"  />
      <result column="stock_name" property="stockName" />
      <result column="stock_gid" property="stockGid" />
      <result column="is_lock" property="isLock"  />
  </resultMap>
  <sql id="Base_Column_List" >
    id, user_id, stock_id, add_time, stock_code, stock_name, stock_gid, is_lock
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from stock_option
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from stock_option
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.nq.pojo.StockOption" >
    insert into stock_option (id, user_id, stock_id, 
      add_time, stock_code, stock_name, 
      stock_gid, is_lock)
    values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{stockId,jdbcType=INTEGER}, 
      #{addTime,jdbcType=TIMESTAMP}, #{stockCode,jdbcType=VARCHAR}, #{stockName,jdbcType=VARCHAR}, 
      #{stockGid,jdbcType=VARCHAR}, #{isLock,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.nq.pojo.StockOption" >
    insert into stock_option
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="userId != null" >
        user_id,
      </if>
      <if test="stockId != null" >
        stock_id,
      </if>
      <if test="addTime != null" >
        add_time,
      </if>
      <if test="stockCode != null" >
        stock_code,
      </if>
      <if test="stockName != null" >
        stock_name,
      </if>
      <if test="stockGid != null" >
        stock_gid,
      </if>
      <if test="isLock != null" >
        is_lock,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="userId != null" >
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="stockId != null" >
        #{stockId,jdbcType=INTEGER},
      </if>
      <if test="addTime != null" >
        #{addTime,jdbcType=TIMESTAMP},
      </if>
      <if test="stockCode != null" >
        #{stockCode,jdbcType=VARCHAR},
      </if>
      <if test="stockName != null" >
        #{stockName,jdbcType=VARCHAR},
      </if>
      <if test="stockGid != null" >
        #{stockGid,jdbcType=VARCHAR},
      </if>
      <if test="isLock != null" >
        #{isLock,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.nq.pojo.StockOption" >
    update stock_option
    <set >
      <if test="userId != null" >
        user_id = #{userId,jdbcType=INTEGER},
      </if>
      <if test="stockId != null" >
        stock_id = #{stockId,jdbcType=INTEGER},
      </if>
      <if test="addTime != null" >
        add_time = #{addTime,jdbcType=TIMESTAMP},
      </if>
      <if test="stockCode != null" >
        stock_code = #{stockCode,jdbcType=VARCHAR},
      </if>
      <if test="stockName != null" >
        stock_name = #{stockName,jdbcType=VARCHAR},
      </if>
      <if test="stockGid != null" >
        stock_gid = #{stockGid,jdbcType=VARCHAR},
      </if>
      <if test="isLock != null" >
        is_lock = #{isLock,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.nq.pojo.StockOption" >
    update stock_option
    set user_id = #{userId,jdbcType=INTEGER},
      stock_id = #{stockId,jdbcType=INTEGER},
      add_time = #{addTime,jdbcType=TIMESTAMP},
      stock_code = #{stockCode,jdbcType=VARCHAR},
      stock_name = #{stockName,jdbcType=VARCHAR},
      stock_gid = #{stockGid,jdbcType=VARCHAR},
      is_lock = #{isLock,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
 
 
 
  <select id="findMyOptionIsExistByCode" resultMap="BaseResultMap" parameterType="map">
    SELECT
    <include refid="Base_Column_List"/>
    FROM stock_option
    WHERE user_id = #{uid} and stock_code = #{stockCode}
  </select>
 
  <select id="findMyOptionByKeywords" resultMap="BaseResultMap" parameterType="map">
    SELECT
    <include refid="Base_Column_List"/>
    FROM stock_option
    <where>
      user_id = #{uid}
    <if test="stockType !=null and stockType!= ''">
        and    stock_gid = #{stockType}
    </if>
      <if test="keyWords != null and keyWords != '' ">
        and stock_code like CONCAT('%','${keyWords}','%')
      </if>
    </where>
    order by stock_code asc
  </select>
 
 
  <select id="isOption" parameterType="map" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List"/>
    FROM stock_option
    WHERE user_id = #{uid} and stock_code = #{code}
  </select>
 
 
 
 
 
 
</mapper>