| | |
| | | placeholder="请输入" |
| | | rules={[{ required: true, message: "登录账号不能为空!" }]} |
| | | /> |
| | | <ProFormText |
| | | name="password" |
| | | label="登录密码" |
| | | <ProFormSelect |
| | | name="sex" |
| | | label="性别" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请输入" |
| | | placeholder="请选择" |
| | | options={[ |
| | | { label: '未知', value: 0 }, |
| | | { label: '男', value: 1 }, |
| | | { label: '女', value: 2 }, |
| | | ]} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | |
| | | placeholder="请输入" |
| | | rules={[ |
| | | { |
| | | pattern: /^1[3456789]\d{9}$/, |
| | | message: '请输入正确的手机号码!', |
| | | pattern: /^1[3456789]\d{9}$/, |
| | | message: '请输入正确的手机号码!', |
| | | }, |
| | | { |
| | | required: false, |
| | | message: '手机号码不能为空!', |
| | | required: false, |
| | | message: '手机号码不能为空!', |
| | | }, |
| | | ]} |
| | | |
| | | ]} |
| | | |
| | | /> |
| | | <ProFormText |
| | | name="email" |
| | |
| | | placeholder="请输入" |
| | | rules={[ |
| | | { |
| | | type: 'email', |
| | | message: '请输入正确的邮箱地址!', |
| | | type: 'email', |
| | | message: '请输入正确的邮箱地址!', |
| | | }, |
| | | { |
| | | required: false, |
| | | message: '邮箱不能为空!', |
| | | required: false, |
| | | message: '邮箱不能为空!', |
| | | }, |
| | | ]} |
| | | ]} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormSelect |
| | | name="sex" |
| | | label="性别" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请选择" |
| | | options={[ |
| | | { label: '未知', value: 0 }, |
| | | { label: '男', value: 1 }, |
| | | { label: '女', value: 2 }, |
| | | ]} |
| | | /> |
| | | |
| | | <ProFormSelect |
| | | name="status" |
| | | label="状态" |
| | |
| | | if (column.isPrimaryKey() |
| | | || column.getHumpName().equals("deleted") |
| | | || column.getHumpName().equals("hostId") |
| | | || column.getHumpName().equals("memo") |
| | | ) { |
| | | continue; |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | public class UserController extends BaseController { |
| | | |
| | | public static final String COMMON_PASSWORD = "123456"; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | |
| | | @OperationLog("添加用户") |
| | | @PostMapping("/user/save") |
| | | public R save(@RequestBody User user) { |
| | | |
| | | user.setPassword(userService.encodePassword(COMMON_PASSWORD)); |
| | | |
| | | user.setCreateBy(getLoginUserId()); |
| | | user.setCreateTime(new Date()); |
| | | user.setUpdateBy(getLoginUserId()); |
| | | user.setUpdateTime(new Date()); |
| | | |
| | | if (!userService.save(user)) { |
| | | return R.error("添加失败"); |
| | | } |
| | |
| | | @OperationLog("修改用户") |
| | | @PostMapping("/user/update") |
| | | public R update(@RequestBody User user) { |
| | | |
| | | if (!Cools.isEmpty(user.getPassword())) { |
| | | user.setPassword(userService.encodePassword(user.getPassword())); |
| | | } |
| | | |
| | | user.setUpdateBy(getLoginUserId()); |
| | | user.setUpdateTime(new Date()); |
| | | |
| | | if (!userService.updateById(user)) { |
| | | return R.error("修改失败"); |
| | | } |