提交 | 用户 | 时间
|
71e81e
|
1 |
package cn.stylefeng.guns.modular.demos.service; |
懒 |
2 |
|
|
3 |
import cn.hutool.core.util.RandomUtil; |
|
4 |
import cn.stylefeng.guns.sys.modular.system.entity.User; |
|
5 |
import cn.stylefeng.guns.sys.modular.system.mapper.UserMapper; |
|
6 |
import cn.stylefeng.guns.sys.modular.system.service.UserService; |
|
7 |
import cn.stylefeng.roses.core.mutidatasource.annotion.DataSource; |
|
8 |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
9 |
import org.springframework.beans.factory.annotation.Autowired; |
|
10 |
import org.springframework.stereotype.Service; |
|
11 |
|
|
12 |
import java.util.Date; |
|
13 |
|
|
14 |
/** |
|
15 |
* <p> |
|
16 |
* 管理员表 服务实现类 |
|
17 |
* </p> |
|
18 |
* |
|
19 |
* @author stylefeng |
|
20 |
* @since 2018-12-07 |
|
21 |
*/ |
|
22 |
@Service |
|
23 |
public class GunsDbService extends ServiceImpl<UserMapper, User> { |
|
24 |
|
|
25 |
@Autowired |
|
26 |
private UserService userService; |
|
27 |
|
|
28 |
@DataSource(name = "master") |
|
29 |
public void gunsdb() { |
|
30 |
User user = new User(); |
|
31 |
user.setAccount(RandomUtil.randomString(5)); |
|
32 |
user.setPassword(RandomUtil.randomString(5)); |
|
33 |
user.setCreateTime(new Date()); |
|
34 |
user.setUpdateTime(new Date()); |
|
35 |
user.setCreateUser(1L); |
|
36 |
user.setUpdateUser(1L); |
|
37 |
userService.save(user); |
|
38 |
} |
|
39 |
|
|
40 |
} |