|
@@ -3,23 +3,6 @@
|
3
|
3
|
<mapper namespace="com.yunzhi.marketing.mapper.TaChannelMapper">
|
4
|
4
|
|
5
|
5
|
<select id="channelCode" resultType="int">
|
6
|
|
- drop FUNCTION if exists roundNum;
|
7
|
|
- create function roundNum() returns int
|
8
|
|
- begin
|
9
|
|
- declare x int default 1;
|
10
|
|
- declare y int default 0;
|
11
|
|
- declare a int default 20;
|
12
|
|
- declare b int default 1;
|
13
|
|
- while (b <![CDATA[ < a ]]> ) do
|
14
|
|
- set x = (select (select FLOOR(100000 + RAND()*900000)) as num);
|
15
|
|
- set y = (select count(1) from ta_channel where channel_code = x);
|
16
|
|
- if y = 0
|
17
|
|
- then return x;
|
18
|
|
- END IF;
|
19
|
|
- set b = b + 1;
|
20
|
|
- end while;
|
21
|
|
- return 0;
|
22
|
|
- end;
|
23
|
6
|
select roundNum();
|
24
|
7
|
</select>
|
25
|
8
|
|