浏览代码

第三方用户关联表代码生成

fangq 3 年之前
父节点
当前提交
c5509d502c

+ 129 - 0
smart-city-grid-yinchuan-server/src/main/java/org/springblade/third/auth/controller/AccountOauthController.java

@@ -0,0 +1,129 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.third.auth.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestParam;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.third.auth.entity.AccountOauth;
+import org.springblade.third.auth.vo.AccountOauthVO;
+import org.springblade.third.auth.wrapper.AccountOauthWrapper;
+import org.springblade.third.auth.service.IAccountOauthService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 账户角色关系表 控制器
+ *
+ * @author BladeX
+ * @since 2022-09-30
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("thirdauth/accountoauth")
+@Api(value = "账户角色关系表", tags = "账户角色关系表接口")
+public class AccountOauthController extends BladeController {
+
+	private final IAccountOauthService accountOauthService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入accountOauth")
+	public R<AccountOauthVO> detail(AccountOauth accountOauth) {
+		AccountOauth detail = accountOauthService.getOne(Condition.getQueryWrapper(accountOauth));
+		return R.data(AccountOauthWrapper.build().entityVO(detail));
+	}
+
+	/**
+	 * 分页 账户角色关系表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入accountOauth")
+	public R<IPage<AccountOauthVO>> list(AccountOauth accountOauth, Query query) {
+		IPage<AccountOauth> pages = accountOauthService.page(Condition.getPage(query), Condition.getQueryWrapper(accountOauth));
+		return R.data(AccountOauthWrapper.build().pageVO(pages));
+	}
+
+
+	/**
+	 * 自定义分页 账户角色关系表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入accountOauth")
+	public R<IPage<AccountOauthVO>> page(AccountOauthVO accountOauth, Query query) {
+		IPage<AccountOauthVO> pages = accountOauthService.selectAccountOauthPage(Condition.getPage(query), accountOauth);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 账户角色关系表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入accountOauth")
+	public R save(@Valid @RequestBody AccountOauth accountOauth) {
+		return R.status(accountOauthService.save(accountOauth));
+	}
+
+	/**
+	 * 修改 账户角色关系表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入accountOauth")
+	public R update(@Valid @RequestBody AccountOauth accountOauth) {
+		return R.status(accountOauthService.updateById(accountOauth));
+	}
+
+	/**
+	 * 新增或修改 账户角色关系表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入accountOauth")
+	public R submit(@Valid @RequestBody AccountOauth accountOauth) {
+		return R.status(accountOauthService.saveOrUpdate(accountOauth));
+	}
+
+	
+	/**
+	 * 删除 账户角色关系表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(accountOauthService.deleteLogic(Func.toLongList(ids)));
+	}
+
+	
+}

+ 34 - 0
smart-city-grid-yinchuan-server/src/main/java/org/springblade/third/auth/dto/AccountOauthDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.third.auth.dto;
+
+import org.springblade.third.auth.entity.AccountOauth;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 账户角色关系表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2022-09-30
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class AccountOauthDTO extends AccountOauth {
+	private static final long serialVersionUID = 1L;
+
+}

+ 82 - 0
smart-city-grid-yinchuan-server/src/main/java/org/springblade/third/auth/entity/AccountOauth.java

@@ -0,0 +1,82 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.third.auth.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 账户角色关系表实体类
+ *
+ * @author BladeX
+ * @since 2022-09-30
+ */
+@Data
+@TableName("yc_account_oauth")
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "AccountOauth对象", description = "账户角色关系表")
+public class AccountOauth extends BaseEntity {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 第三方系统用户ID
+	*/
+		@ApiModelProperty(value = "第三方系统用户ID")
+		private String uuid;
+	/**
+	* 系统用户ID
+	*/
+		@ApiModelProperty(value = "系统用户ID")
+		private Long accountId;
+	/**
+	* 账号名,一般是手机号
+	*/
+		@ApiModelProperty(value = "账号名,一般是手机号")
+		private String userName;
+	/**
+	* 用户名
+	*/
+		@ApiModelProperty(value = "用户名")
+		private String nickName;
+	/**
+	* 头像
+	*/
+		@ApiModelProperty(value = "头像")
+		private String avatar;
+	/**
+	* 邮件
+	*/
+		@ApiModelProperty(value = "邮件")
+		private String email;
+	/**
+	* 备注
+	*/
+		@ApiModelProperty(value = "备注")
+		private String mobile;
+	/**
+	* 来源
+	*/
+		@ApiModelProperty(value = "来源")
+		private String source;
+
+
+}

+ 42 - 0
smart-city-grid-yinchuan-server/src/main/java/org/springblade/third/auth/mapper/AccountOauthMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.third.auth.mapper;
+
+import org.springblade.third.auth.entity.AccountOauth;
+import org.springblade.third.auth.vo.AccountOauthVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 账户角色关系表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-09-30
+ */
+public interface AccountOauthMapper extends BaseMapper<AccountOauth> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param accountOauth
+	 * @return
+	 */
+	List<AccountOauthVO> selectAccountOauthPage(IPage page, AccountOauthVO accountOauth);
+
+}

+ 30 - 0
smart-city-grid-yinchuan-server/src/main/java/org/springblade/third/auth/mapper/AccountOauthMapper.xml

@@ -0,0 +1,30 @@
+<?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="org.springblade.third.auth.mapper.AccountOauthMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="accountOauthResultMap" type="org.springblade.third.auth.entity.AccountOauth">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="uuid" property="uuid"/>
+        <result column="account_id" property="accountId"/>
+        <result column="user_name" property="userName"/>
+        <result column="nick_name" property="nickName"/>
+        <result column="avatar" property="avatar"/>
+        <result column="email" property="email"/>
+        <result column="mobile" property="mobile"/>
+        <result column="source" property="source"/>
+    </resultMap>
+
+
+    <select id="selectAccountOauthPage" resultMap="accountOauthResultMap">
+        select * from yc_account_oauth where is_deleted = 0
+    </select>
+
+</mapper>

+ 41 - 0
smart-city-grid-yinchuan-server/src/main/java/org/springblade/third/auth/service/IAccountOauthService.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.third.auth.service;
+
+import org.springblade.third.auth.entity.AccountOauth;
+import org.springblade.third.auth.vo.AccountOauthVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 账户角色关系表 服务类
+ *
+ * @author BladeX
+ * @since 2022-09-30
+ */
+public interface IAccountOauthService extends BaseService<AccountOauth> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param accountOauth
+	 * @return
+	 */
+	IPage<AccountOauthVO> selectAccountOauthPage(IPage<AccountOauthVO> page, AccountOauthVO accountOauth);
+
+}

+ 41 - 0
smart-city-grid-yinchuan-server/src/main/java/org/springblade/third/auth/service/impl/AccountOauthServiceImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.third.auth.service.impl;
+
+import org.springblade.third.auth.entity.AccountOauth;
+import org.springblade.third.auth.vo.AccountOauthVO;
+import org.springblade.third.auth.mapper.AccountOauthMapper;
+import org.springblade.third.auth.service.IAccountOauthService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 账户角色关系表 服务实现类
+ *
+ * @author BladeX
+ * @since 2022-09-30
+ */
+@Service
+public class AccountOauthServiceImpl extends BaseServiceImpl<AccountOauthMapper, AccountOauth> implements IAccountOauthService {
+
+	@Override
+	public IPage<AccountOauthVO> selectAccountOauthPage(IPage<AccountOauthVO> page, AccountOauthVO accountOauth) {
+		return page.setRecords(baseMapper.selectAccountOauthPage(page, accountOauth));
+	}
+
+}

+ 36 - 0
smart-city-grid-yinchuan-server/src/main/java/org/springblade/third/auth/vo/AccountOauthVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.third.auth.vo;
+
+import org.springblade.third.auth.entity.AccountOauth;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 账户角色关系表视图实体类
+ *
+ * @author BladeX
+ * @since 2022-09-30
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "AccountOauthVO对象", description = "账户角色关系表")
+public class AccountOauthVO extends AccountOauth {
+	private static final long serialVersionUID = 1L;
+
+}

+ 49 - 0
smart-city-grid-yinchuan-server/src/main/java/org/springblade/third/auth/wrapper/AccountOauthWrapper.java

@@ -0,0 +1,49 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.third.auth.wrapper;
+
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.third.auth.entity.AccountOauth;
+import org.springblade.third.auth.vo.AccountOauthVO;
+import java.util.Objects;
+
+/**
+ * 账户角色关系表包装类,返回视图层所需的字段
+ *
+ * @author BladeX
+ * @since 2022-09-30
+ */
+public class AccountOauthWrapper extends BaseEntityWrapper<AccountOauth, AccountOauthVO>  {
+
+	public static AccountOauthWrapper build() {
+		return new AccountOauthWrapper();
+ 	}
+
+	@Override
+	public AccountOauthVO entityVO(AccountOauth accountOauth) {
+		AccountOauthVO accountOauthVO = Objects.requireNonNull(BeanUtil.copy(accountOauth, AccountOauthVO.class));
+
+		//User createUser = UserCache.getUser(accountOauth.getCreateUser());
+		//User updateUser = UserCache.getUser(accountOauth.getUpdateUser());
+		//accountOauthVO.setCreateUserName(createUser.getName());
+		//accountOauthVO.setUpdateUserName(updateUser.getName());
+
+		return accountOauthVO;
+	}
+
+}