杜函宇 2 months ago
parent 79c5b7cc52
commit 644e4719fa

@ -129,17 +129,17 @@
</dependency> </dependency>
<!-- Swagger3依赖 --> <!-- Swagger3依赖 -->
<dependency> <!-- <dependency>-->
<groupId>io.springfox</groupId> <!-- <groupId>io.springfox</groupId>-->
<artifactId>springfox-boot-starter</artifactId> <!-- <artifactId>springfox-boot-starter</artifactId>-->
<version>${swagger.version}</version> <!-- <version>${swagger.version}</version>-->
<exclusions> <!-- <exclusions>-->
<exclusion> <!-- <exclusion>-->
<groupId>io.swagger</groupId> <!-- <groupId>io.swagger</groupId>-->
<artifactId>swagger-models</artifactId> <!-- <artifactId>swagger-models</artifactId>-->
</exclusion> <!-- </exclusion>-->
</exclusions> <!-- </exclusions>-->
</dependency> <!-- </dependency>-->
<!-- io常用工具类 --> <!-- io常用工具类 -->
<dependency> <dependency>

@ -16,7 +16,20 @@
</description> </description>
<dependencies> <dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.23</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
<version>4.4.0</version>
</dependency>
<!-- spring-boot-devtools --> <!-- spring-boot-devtools -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -25,17 +38,17 @@
</dependency> </dependency>
<!-- swagger3--> <!-- swagger3-->
<dependency> <!-- <dependency>-->
<groupId>io.springfox</groupId> <!-- <groupId>io.springfox</groupId>-->
<artifactId>springfox-boot-starter</artifactId> <!-- <artifactId>springfox-boot-starter</artifactId>-->
</dependency> <!-- </dependency>-->
<!-- 防止进入swagger页面报类型转换错误排除3.0.0中的引用手动增加1.6.2版本 --> <!-- 防止进入swagger页面报类型转换错误排除3.0.0中的引用手动增加1.6.2版本 -->
<dependency> <!-- <dependency>-->
<groupId>io.swagger</groupId> <!-- <groupId>io.swagger</groupId>-->
<artifactId>swagger-models</artifactId> <!-- <artifactId>swagger-models</artifactId>-->
<version>1.6.2</version> <!-- <version>1.6.2</version>-->
</dependency> <!-- </dependency>-->
<!-- Mysql驱动包 --> <!-- Mysql驱动包 -->
<dependency> <dependency>

@ -3,6 +3,11 @@ package com.ruoyi;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import java.net.InetAddress;
import java.net.UnknownHostException;
/** /**
* *
@ -14,17 +19,21 @@ public class RuoYiApplication
{ {
public static void main(String[] args) public static void main(String[] args)
{ {
// System.setProperty("spring.devtools.restart.enabled", "false"); ConfigurableApplicationContext application = SpringApplication.run(RuoYiApplication.class, args);
SpringApplication.run(RuoYiApplication.class, args); Environment env = application.getEnvironment();
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" + String ip;
" .-------. ____ __ \n" + try {
" | _ _ \\ \\ \\ / / \n" + ip = InetAddress.getLocalHost().getHostAddress();
" | ( ' ) | \\ _. / ' \n" + } catch (UnknownHostException e) {
" |(_ o _) / _( )_ .' \n" + throw new RuntimeException(e);
" | (_,_).' __ ___(_ o _)' \n" + }
" | |\\ \\ | || |(_,_)' \n" + String port = env.getProperty("server.port");
" | | \\ `' /| `-' / \n" + String path = env.getProperty("server.servlet.context-path");
" | | \\ / \\ / \n" + path = path.isEmpty() ? "" : path;
" ''-' `'-' `-..-' "); System.out.println("\n----------------------------------------------------------\n\t"
+ "Application is running! Access URLs:\n\t"
+ "swagger-ui: http://localhost:" + port + path + "doc.html\n\t"
+ "swagger-ui: http://" + ip + ":" + port + path + "doc.html\n\t"
+ "----------------------------------------------------------");
} }
} }

@ -0,0 +1,104 @@
package com.ruoyi.tc.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.tc.domain.UnitOtherConcat;
import com.ruoyi.tc.service.UnitOtherConcatService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
/**
* (unit_other_contact)
* @author du
* @since 2024/11/13 14:50
*/
@RestController
@RequestMapping("/unit/otherConcat")
@Api(tags = "单位其他联系人控制层")
public class UnitOtherConcatController extends BaseController {
/**
*
*/
@Resource
private UnitOtherConcatService unitOtherConcatService;
/**
* unit_id
*
* @param unitId unit_id
* @return
*/
// @PreAuthorize("@ss.hasAnyRoles('admin')")
@ApiOperation(value = "根据unit_id查询该单位所有数据", response = UnitOtherConcat.class)
@GetMapping("/selectAll/{unitId}")
public AjaxResult selectAll(@PathVariable Long unitId) {
return success(unitOtherConcatService.lambdaQuery().eq(UnitOtherConcat::getUnitId,unitId).list());
}
/**
*
*
* @param id
* @return
*/
@ApiOperation(value = "通过主键查询单条数据", response = UnitOtherConcat.class)
@GetMapping("/{id}")
public AjaxResult selectOne(@PathVariable Serializable id) {
return success(unitOtherConcatService.getById(id));
}
/**
*
*
* @param u
* @return
*/
// @PreAuthorize("@ss.hasAnyRoles('admin')")
@ApiOperation(value = "新增数据")
@PostMapping
public AjaxResult insert(@Valid @RequestBody UnitOtherConcat u) {
return success(unitOtherConcatService.save(u));
}
/**
*
*
* @param u
* @return
*/
// @PreAuthorize("@ss.hasAnyRoles('admin')")
@ApiOperation(value = "修改数据")
@PostMapping("/edit")
public AjaxResult update(@RequestBody UnitOtherConcat u) {
return success(unitOtherConcatService.updateById(u));
}
/**
*
*
* @param ids
* @return
*/
// @PreAuthorize("@ss.hasAnyRoles('admin')")
@ApiOperation(value = "删除数据")
@PostMapping("/ids")
public AjaxResult delete(Long[] ids) {
return success(unitOtherConcatService.removeBatchByIds(Arrays.asList(ids)));
}
}

@ -0,0 +1,77 @@
package com.ruoyi.tc.domain;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* (unit_other_contact)
* @author du
* @since 2024/11/13 14:44
*/
@Data
@ApiModel("单位其他联系人")
@TableName(value = "unit_other_contact")
public class UnitOtherConcat implements Serializable {
@TableId(type = IdType.AUTO,value = "id")
private Long id;
@ApiModelProperty("单位id")
@NotNull
private Long unitId;
@ApiModelProperty("其他联系人姓名")
private String qtlxrxm;
@ApiModelProperty("其他联系人联系方式")
private String qtlxrlxfs;
@ApiModelProperty("其他联系人邮箱")
private String qtlxryx;
@ApiModelProperty("其他联系人职务职称")
private String qtlxrzwzc;
/**
*
*/
@ApiModelProperty("创建者")
@TableField(fill = FieldFill.INSERT)
private String createBy;
/**
*
*/
@ApiModelProperty("创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
*
*/
@ApiModelProperty("更新者")
@TableField(fill = FieldFill.UPDATE)
private String updateBy;
/**
*
*/
@ApiModelProperty("更新时间")
@TableField(fill = FieldFill.UPDATE)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private String remark;
}

@ -0,0 +1,16 @@
package com.ruoyi.tc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.tc.domain.UnitOtherConcat;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (unit_other_contact)
* @author ruoyi
*/
public interface UnitOtherConcatMapper extends BaseMapper<UnitOtherConcat>
{
}

@ -0,0 +1,13 @@
package com.ruoyi.tc.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.tc.domain.UnitOtherConcat;
/**
* (unit_other_contact)
* @author du
* @since 2024/11/13 14:55
*/
public interface UnitOtherConcatService extends IService<UnitOtherConcat> {
}

@ -0,0 +1,16 @@
package com.ruoyi.tc.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.tc.domain.UnitOtherConcat;
import com.ruoyi.tc.mapper.UnitOtherConcatMapper;
import com.ruoyi.tc.service.UnitOtherConcatService;
import org.springframework.stereotype.Service;
/**
* (unit_other_contact)
* @author du
* @since 2024/11/13 14:58
*/
@Service
public class UnitOtherConcatServiceImpl extends ServiceImpl<UnitOtherConcatMapper, UnitOtherConcat> implements UnitOtherConcatService {
}

@ -62,17 +62,17 @@ public class SysProfileController extends BaseController
LoginUser loginUser = getLoginUser(); LoginUser loginUser = getLoginUser();
SysUser currentUser = loginUser.getUser(); SysUser currentUser = loginUser.getUser();
currentUser.setNickName(user.getNickName()); currentUser.setNickName(user.getNickName());
currentUser.setEmail(user.getEmail()); // currentUser.setEmail(user.getEmail());
currentUser.setPhonenumber(user.getPhonenumber()); // currentUser.setPhonenumber(user.getPhonenumber());
currentUser.setSex(user.getSex()); // currentUser.setSex(user.getSex());
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) // if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
{ // {
return error("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在"); // return error("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在");
} // }
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) // if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
{ // {
return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在"); // return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在");
} // }
if (userService.updateUserProfile(currentUser) > 0) if (userService.updateUserProfile(currentUser) > 0)
{ {
// 更新缓存用户信息 // 更新缓存用户信息

@ -1,36 +1,31 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.entity.Unit;
import com.ruoyi.common.core.domain.request.UnitRequest;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.*;
import com.ruoyi.system.service.ISysPostService; import org.apache.commons.lang3.ArrayUtils;
import com.ruoyi.system.service.ISysRoleService; import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.system.service.ISysUserService; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* *
@ -39,8 +34,7 @@ import com.ruoyi.system.service.ISysUserService;
*/ */
@RestController @RestController
@RequestMapping("/system/user") @RequestMapping("/system/user")
public class SysUserController extends BaseController public class SysUserController extends BaseController {
{
@Autowired @Autowired
private ISysUserService userService; private ISysUserService userService;
@ -53,44 +47,62 @@ public class SysUserController extends BaseController
@Autowired @Autowired
private ISysPostService postService; private ISysPostService postService;
@Resource
private UnitService unitService;
/** /**
* *
*/ */
@PreAuthorize("@ss.hasPermi('system:user:list')") @PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysUser user) public TableDataInfo list(SysUser user) {
{
startPage(); startPage();
List<SysUser> list = userService.selectUserList(user); List<SysUser> list = userService.selectUserList(user);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "用户管理", businessType = BusinessType.EXPORT) @Log(title = "用户单位管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:user:export')") @PreAuthorize("@ss.hasPermi('system:user:export')")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SysUser user) public void export(HttpServletResponse response, UnitRequest unit) {
{ // List<SysUser> list = userService.selectUserList(user);
List<SysUser> list = userService.selectUserList(user); // ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); // util.exportExcel(response, list, "用户数据");
util.exportExcel(response, list, "用户数据"); List<Unit> list = unitService.selectUnitList(unit);
ExcelUtil<Unit> util = new ExcelUtil<>(Unit.class);
util.exportExcel(response, list, "单位数据");
} }
@Log(title = "用户管理", businessType = BusinessType.IMPORT) @Log(title = "用户单位管理", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:user:import')") @PreAuthorize("@ss.hasPermi('system:user:import')")
@PostMapping("/importData") @PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
{ // ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); // List<SysUser> userList = util.importExcel(file.getInputStream());
List<SysUser> userList = util.importExcel(file.getInputStream()); // String operName = getUsername();
String operName = getUsername(); // String message = userService.importUser(userList, updateSupport, operName);
String message = userService.importUser(userList, updateSupport, operName); ExcelUtil<Unit> util = new ExcelUtil<>(Unit.class);
return success(message); List<Unit> list = util.importExcel(file.getInputStream());
unitService.saveBatch(list);
for (Unit x : list) {
SysUser user = new SysUser();
user.setUserName(x.getUserName());
user.setPassword(SecurityUtils.encryptPassword(x.getUserName().substring(x.getUserName().length() - 6)));
user.setNickName(x.getNickName());
SysUser u = userService.selectUserByUserName(x.getUserName());
if (StringUtils.isNull(u)) {
userService.insertUser(user);
Long[] roles = new Long[]{100L};
userService.insertUserAuth(user.getUserId(), roles);
}
//未做修改
}
return success();
} }
@PostMapping("/importTemplate") @PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) public void importTemplate(HttpServletResponse response) {
{ ExcelUtil<Unit> util = new ExcelUtil<>(Unit.class);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
util.importTemplateExcel(response, "用户数据"); util.importTemplateExcel(response, "用户数据");
} }
@ -98,21 +110,21 @@ public class SysUserController extends BaseController
* *
*/ */
@PreAuthorize("@ss.hasPermi('system:user:query')") @PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping(value = { "/", "/{userId}" }) @GetMapping(value = {"/", "/{userId}"})
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) {
{
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
if (StringUtils.isNotNull(userId)) if (StringUtils.isNotNull(userId)) {
{
userService.checkUserDataScope(userId); userService.checkUserDataScope(userId);
SysUser sysUser = userService.selectUserById(userId); SysUser sysUser = userService.selectUserById(userId);
ajax.put(AjaxResult.DATA_TAG, sysUser); ajax.put(AjaxResult.DATA_TAG, sysUser);
ajax.put("postIds", postService.selectPostListByUserId(userId)); ajax.put("postIds", postService.selectPostListByUserId(userId));
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
ajax.put("unit", unitService.lambdaQuery().eq(Unit::getUserName,sysUser.getUserName()).one());
} }
List<SysRole> roles = roleService.selectRoleAll(); List<SysRole> roles = roleService.selectRoleAll();
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
ajax.put("posts", postService.selectPostAll()); ajax.put("posts", postService.selectPostAll());
ajax.put("posts", postService.selectPostAll());
return ajax; return ajax;
} }
@ -122,23 +134,26 @@ public class SysUserController extends BaseController
@PreAuthorize("@ss.hasPermi('system:user:add')") @PreAuthorize("@ss.hasPermi('system:user:add')")
@Log(title = "用户管理", businessType = BusinessType.INSERT) @Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysUser user) public AjaxResult add(@Validated @RequestBody SysUser user) {
{
deptService.checkDeptDataScope(user.getDeptId()); deptService.checkDeptDataScope(user.getDeptId());
roleService.checkRoleDataScope(user.getRoleIds()); roleService.checkRoleDataScope(user.getRoleIds());
if (!userService.checkUserNameUnique(user)) if (!userService.checkUserNameUnique(user)) {
{
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
} }
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) if (!unitService.lambdaQuery().eq(Unit::getUserName, user.getUserName()).list().isEmpty()) {
{ return error("新增用户'" + user.getUserName() + "'已存在单位!");
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
}
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
{
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
} }
user.setCreateBy(getUsername()); //新增单位到单位信息表
unitService.save(user.getUnitInfo());
// else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
// {
// return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
// }
// else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
// {
// return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
// }
// user.setCreateBy(getUsername());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
return toAjax(userService.insertUser(user)); return toAjax(userService.insertUser(user));
} }
@ -149,25 +164,27 @@ public class SysUserController extends BaseController
@PreAuthorize("@ss.hasPermi('system:user:edit')") @PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysUser user) public AjaxResult edit(@Validated @RequestBody SysUser user) {
{
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId()); userService.checkUserDataScope(user.getUserId());
deptService.checkDeptDataScope(user.getDeptId()); deptService.checkDeptDataScope(user.getDeptId());
roleService.checkRoleDataScope(user.getRoleIds()); roleService.checkRoleDataScope(user.getRoleIds());
if (!userService.checkUserNameUnique(user)) if (!userService.checkUserNameUnique(user)) {
{
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
} }
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) if (!unitService.lambdaQuery().eq(Unit::getUserName, user.getUserName()).list().isEmpty()) {
{ return error("修改用户'" + user.getUserName() + "'已存在单位!");
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
}
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
{
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
} }
user.setUpdateBy(getUsername()); unitService.updateById(user.getUnitInfo());
// else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
// {
// return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
// }
// else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
// {
// return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
// }
// user.setUpdateBy(getUsername());
return toAjax(userService.updateUser(user)); return toAjax(userService.updateUser(user));
} }
@ -177,10 +194,8 @@ public class SysUserController extends BaseController
@PreAuthorize("@ss.hasPermi('system:user:remove')") @PreAuthorize("@ss.hasPermi('system:user:remove')")
@Log(title = "用户管理", businessType = BusinessType.DELETE) @Log(title = "用户管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}") @DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds) public AjaxResult remove(@PathVariable Long[] userIds) {
{ if (ArrayUtils.contains(userIds, getUserId())) {
if (ArrayUtils.contains(userIds, getUserId()))
{
return error("当前用户不能删除"); return error("当前用户不能删除");
} }
return toAjax(userService.deleteUserByIds(userIds)); return toAjax(userService.deleteUserByIds(userIds));
@ -192,12 +207,11 @@ public class SysUserController extends BaseController
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')") @PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/resetPwd") @PutMapping("/resetPwd")
public AjaxResult resetPwd(@RequestBody SysUser user) public AjaxResult resetPwd(@RequestBody SysUser user) {
{
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId()); userService.checkUserDataScope(user.getUserId());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
user.setUpdateBy(getUsername()); // user.setUpdateBy(getUsername());
return toAjax(userService.resetPwd(user)); return toAjax(userService.resetPwd(user));
} }
@ -207,11 +221,10 @@ public class SysUserController extends BaseController
@PreAuthorize("@ss.hasPermi('system:user:edit')") @PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus") @PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysUser user) public AjaxResult changeStatus(@RequestBody SysUser user) {
{
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId()); userService.checkUserDataScope(user.getUserId());
user.setUpdateBy(getUsername()); // user.setUpdateBy(getUsername());
return toAjax(userService.updateUserStatus(user)); return toAjax(userService.updateUserStatus(user));
} }
@ -220,8 +233,7 @@ public class SysUserController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:user:query')") @PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping("/authRole/{userId}") @GetMapping("/authRole/{userId}")
public AjaxResult authRole(@PathVariable("userId") Long userId) public AjaxResult authRole(@PathVariable("userId") Long userId) {
{
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
SysUser user = userService.selectUserById(userId); SysUser user = userService.selectUserById(userId);
List<SysRole> roles = roleService.selectRolesByUserId(userId); List<SysRole> roles = roleService.selectRolesByUserId(userId);
@ -236,8 +248,7 @@ public class SysUserController extends BaseController
@PreAuthorize("@ss.hasPermi('system:user:edit')") @PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.GRANT) @Log(title = "用户管理", businessType = BusinessType.GRANT)
@PutMapping("/authRole") @PutMapping("/authRole")
public AjaxResult insertAuthRole(Long userId, Long[] roleIds) public AjaxResult insertAuthRole(Long userId, Long[] roleIds) {
{
userService.checkUserDataScope(userId); userService.checkUserDataScope(userId);
roleService.checkRoleDataScope(roleIds); roleService.checkRoleDataScope(roleIds);
userService.insertUserAuth(userId, roleIds); userService.insertUserAuth(userId, roleIds);
@ -249,8 +260,7 @@ public class SysUserController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:user:list')") @PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/deptTree") @GetMapping("/deptTree")
public AjaxResult deptTree(SysDept dept) public AjaxResult deptTree(SysDept dept) {
{
return success(deptService.selectDeptTreeList(dept)); return success(deptService.selectDeptTreeList(dept));
} }
} }

@ -1,125 +1,125 @@
package com.ruoyi.web.core.config; //package com.ruoyi.web.core.config;
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.List; //import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; //import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Configuration;
import com.ruoyi.common.config.RuoYiConfig; //import com.ruoyi.common.config.RuoYiConfig;
import io.swagger.annotations.ApiOperation; //import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In; //import io.swagger.models.auth.In;
import springfox.documentation.builders.ApiInfoBuilder; //import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors; //import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors; //import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo; //import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey; //import springfox.documentation.service.ApiKey;
import springfox.documentation.service.AuthorizationScope; //import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.Contact; //import springfox.documentation.service.Contact;
import springfox.documentation.service.SecurityReference; //import springfox.documentation.service.SecurityReference;
import springfox.documentation.service.SecurityScheme; //import springfox.documentation.service.SecurityScheme;
import springfox.documentation.spi.DocumentationType; //import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext; //import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket; //import springfox.documentation.spring.web.plugins.Docket;
//
/** ///**
* Swagger2 // * Swagger2的接口配置
* // *
* @author ruoyi // * @author ruoyi
*/ // */
@Configuration //@Configuration
public class SwaggerConfig //public class SwaggerConfig
{ //{
/** 系统基础配置 */ // /** 系统基础配置 */
@Autowired // @Autowired
private RuoYiConfig ruoyiConfig; // private RuoYiConfig ruoyiConfig;
//
/** 是否开启swagger */ // /** 是否开启swagger */
@Value("${swagger.enabled}") // @Value("${swagger.enabled}")
private boolean enabled; // private boolean enabled;
//
/** 设置请求的统一前缀 */ // /** 设置请求的统一前缀 */
@Value("${swagger.pathMapping}") // @Value("${swagger.pathMapping}")
private String pathMapping; // private String pathMapping;
//
/** // /**
* API // * 创建API
*/ // */
@Bean // @Bean
public Docket createRestApi() // public Docket createRestApi()
{ // {
return new Docket(DocumentationType.OAS_30) // return new Docket(DocumentationType.OAS_30)
// 是否启用Swagger // // 是否启用Swagger
.enable(enabled) // .enable(enabled)
// 用来创建该API的基本信息展示在文档的页面中自定义展示的信息 // // 用来创建该API的基本信息展示在文档的页面中自定义展示的信息
.apiInfo(apiInfo()) // .apiInfo(apiInfo())
// 设置哪些接口暴露给Swagger展示 // // 设置哪些接口暴露给Swagger展示
.select() // .select()
// 扫描所有有注解的api用这种方式更灵活 // // 扫描所有有注解的api用这种方式更灵活
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) // .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
// 扫描指定包中的swagger注解 // // 扫描指定包中的swagger注解
// .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) // // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
// 扫描所有 .apis(RequestHandlerSelectors.any()) // // 扫描所有 .apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any()) // .paths(PathSelectors.any())
.build() // .build()
/* 设置安全模式swagger可以设置访问token */ // /* 设置安全模式swagger可以设置访问token */
.securitySchemes(securitySchemes()) // .securitySchemes(securitySchemes())
.securityContexts(securityContexts()) // .securityContexts(securityContexts())
.pathMapping(pathMapping); // .pathMapping(pathMapping);
} // }
//
/** // /**
* tokenAuthorization // * 安全模式这里指定token通过Authorization头请求头传递
*/ // */
private List<SecurityScheme> securitySchemes() // private List<SecurityScheme> securitySchemes()
{ // {
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>(); // List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue())); // apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
return apiKeyList; // return apiKeyList;
} // }
//
/** // /**
* // * 安全上下文
*/ // */
private List<SecurityContext> securityContexts() // private List<SecurityContext> securityContexts()
{ // {
List<SecurityContext> securityContexts = new ArrayList<>(); // List<SecurityContext> securityContexts = new ArrayList<>();
securityContexts.add( // securityContexts.add(
SecurityContext.builder() // SecurityContext.builder()
.securityReferences(defaultAuth()) // .securityReferences(defaultAuth())
.operationSelector(o -> o.requestMappingPattern().matches("/.*")) // .operationSelector(o -> o.requestMappingPattern().matches("/.*"))
.build()); // .build());
return securityContexts; // return securityContexts;
} // }
//
/** // /**
* // * 默认的安全上引用
*/ // */
private List<SecurityReference> defaultAuth() // private List<SecurityReference> defaultAuth()
{ // {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); // AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; // AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope; // authorizationScopes[0] = authorizationScope;
List<SecurityReference> securityReferences = new ArrayList<>(); // List<SecurityReference> securityReferences = new ArrayList<>();
securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); // securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
return securityReferences; // return securityReferences;
} // }
//
/** // /**
* // * 添加摘要信息
*/ // */
private ApiInfo apiInfo() // private ApiInfo apiInfo()
{ // {
// 用ApiInfoBuilder进行定制 // // 用ApiInfoBuilder进行定制
return new ApiInfoBuilder() // return new ApiInfoBuilder()
// 设置标题 // // 设置标题
.title("标题若依管理系统_接口文档") // .title("标题若依管理系统_接口文档")
// 描述 // // 描述
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...") // .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
// 作者信息 // // 作者信息
.contact(new Contact(ruoyiConfig.getName(), null, null)) // .contact(new Contact(ruoyiConfig.getName(), null, null))
// 版本 // // 版本
.version("版本号:" + ruoyiConfig.getVersion()) // .version("版本号:" + ruoyiConfig.getVersion())
.build(); // .build();
} // }
} //}

@ -6,9 +6,9 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://39.101.188.84:3307/tc-asset-verification?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: password password: Admin123@
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭

@ -1,7 +1,7 @@
# 项目相关配置 # 项目相关配置
ruoyi: ruoyi:
# 名称 # 名称
name: RuoYi name: 太仓资产核查
# 版本 # 版本
version: 3.8.8 version: 3.8.8
# 版权年份 # 版权年份
@ -16,7 +16,7 @@ ruoyi:
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口默认为8080 # 服务器的HTTP端口默认为8080
port: 8080 port: 9015
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
@ -64,7 +64,7 @@ spring:
devtools: devtools:
restart: restart:
# 热部署开关 # 热部署开关
enabled: true enabled: false
# redis 配置 # redis 配置
redis: redis:
# 地址 # 地址
@ -98,7 +98,8 @@ token:
expireTime: 30 expireTime: 30
# MyBatis配置 # MyBatis配置
mybatis: # mybatis-plus配置
mybatis-plus:
# 搜索指定包别名 # 搜索指定包别名
typeAliasesPackage: com.ruoyi.**.domain typeAliasesPackage: com.ruoyi.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件 # 配置mapper的扫描找到所有的mapper.xml映射文件
@ -113,11 +114,9 @@ pagehelper:
params: count=countSql params: count=countSql
# Swagger配置 # Swagger配置
swagger: knife4j:
# 是否开启swagger # production: true
enabled: true enable: true
# 请求前缀
pathMapping: /dev-api
# 防止XSS攻击 # 防止XSS攻击
xss: xss:

@ -0,0 +1,7 @@
<?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.ruoyi.tc.mapper.UnitOtherConcatMapper">
</mapper>

@ -16,6 +16,20 @@
</description> </description>
<dependencies> <dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.3.1</version>
</dependency>
<!-- Spring框架基本的核心工具 --> <!-- Spring框架基本的核心工具 -->
<dependency> <dependency>

@ -18,6 +18,12 @@ import com.ruoyi.common.utils.poi.ExcelHandlerAdapter;
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
public @interface Excel public @interface Excel
{ {
/**
* excel
*/
public boolean required() default false;
/** /**
* excel * excel
*/ */

@ -37,17 +37,28 @@ public class SysUser extends BaseEntity
@Excel(name = "用户名称") @Excel(name = "用户名称")
private String nickName; private String nickName;
/** 用户邮箱 */
@Excel(name = "用户邮箱")
private String email;
/** 手机号码 */ public Unit getUnitInfo() {
@Excel(name = "手机号码", cellType = ColumnType.TEXT) return unitInfo;
private String phonenumber; }
public void setUnitInfo(Unit unitInfo) {
this.unitInfo = unitInfo;
}
/** 用户性别 */ private Unit unitInfo;
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String sex; // /** 用户邮箱 */
// @Excel(name = "用户邮箱")
// private String email;
//
// /** 手机号码 */
// @Excel(name = "手机号码", cellType = ColumnType.TEXT)
// private String phonenumber;
// /** 用户性别 */
// @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
// private String sex;
/** 用户头像 */ /** 用户头像 */
private String avatar; private String avatar;
@ -154,38 +165,38 @@ public class SysUser extends BaseEntity
this.userName = userName; this.userName = userName;
} }
@Email(message = "邮箱格式不正确") // @Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") // @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail() // public String getEmail()
{ // {
return email; // return email;
} // }
//
public void setEmail(String email) // public void setEmail(String email)
{ // {
this.email = email; // this.email = email;
} // }
//
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") // @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
public String getPhonenumber() // public String getPhonenumber()
{ // {
return phonenumber; // return phonenumber;
} // }
//
public void setPhonenumber(String phonenumber) // public void setPhonenumber(String phonenumber)
{ // {
this.phonenumber = phonenumber; // this.phonenumber = phonenumber;
} // }
public String getSex() // public String getSex()
{ // {
return sex; // return sex;
} // }
//
public void setSex(String sex) // public void setSex(String sex)
{ // {
this.sex = sex; // this.sex = sex;
} // }
public String getAvatar() public String getAvatar()
{ {
@ -304,20 +315,20 @@ public class SysUser extends BaseEntity
.append("deptId", getDeptId()) .append("deptId", getDeptId())
.append("userName", getUserName()) .append("userName", getUserName())
.append("nickName", getNickName()) .append("nickName", getNickName())
.append("email", getEmail()) // .append("email", getEmail())
.append("phonenumber", getPhonenumber()) // .append("phonenumber", getPhonenumber())
.append("sex", getSex()) // .append("sex", getSex())
.append("avatar", getAvatar()) .append("avatar", getAvatar())
.append("password", getPassword()) .append("password", getPassword())
.append("status", getStatus()) .append("status", getStatus())
.append("delFlag", getDelFlag()) .append("delFlag", getDelFlag())
.append("loginIp", getLoginIp()) .append("loginIp", getLoginIp())
.append("loginDate", getLoginDate()) .append("loginDate", getLoginDate())
.append("createBy", getCreateBy()) // .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) // .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) // .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) // .append("updateTime", getUpdateTime())
.append("remark", getRemark()) // .append("remark", getRemark())
.append("dept", getDept()) .append("dept", getDept())
.toString(); .toString();
} }

@ -0,0 +1,205 @@
package com.ruoyi.common.core.domain.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.Valid;
import java.io.Serializable;
import java.util.Date;
/**
*
* @author du
* @since 2024/11/13 9:13
*/
@Data
@ApiModel("单位信息")
@TableName(value = "unit_info")
public class Unit implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO,value = "id")
private Long id;
@ApiModelProperty("单位名称/用户昵称")
@Excel(name = "单位名称*",required = true)
private String nickName;
@ApiModelProperty("单位简称")
@Excel(name = "单位简称")
private String dwjc;
@ApiModelProperty("所属区域-省")
@Excel(name = "所属区域-省*")
private String ssqyprovince;
@ApiModelProperty("所属区域-市")
@Excel(name = "所属区域-市")
private String ssqycity;
@ApiModelProperty("所属区域-县")
@Excel(name = "所属区域-区(县)")
private String ssqycounty;
@ApiModelProperty("所属监管单位")
private String ssjgdw;
@ApiModelProperty("上级单位")
@Excel(name = "上级单位")
private String sjdw;
@ApiModelProperty("单位详细地址")
@Excel(name = "单位详细地址")
private String dwxxdz;
@ApiModelProperty("所属行业")
@Excel(name = "所属行业",dictType="sshy",comboReadDict = true)
private Integer sshy;
@ApiModelProperty("单位类型")
@Excel(name = "单位类型",dictType="dwlx",comboReadDict = true )
private Integer dwlx;
@ApiModelProperty("单位标签(多个标签逗号隔开)")
@Excel(name = "单位标签(多个标签逗号隔开)")
private String dwbq;
@ApiModelProperty("单位角色")
@Excel(name = "单位角色",dictType="dwjs",comboReadDict = true)
private Integer dwjs;
@ApiModelProperty("统一社会信用代码/用户账号")
@Excel(name = "统一社会信用代码",required = true)
private String userName;
@ApiModelProperty("是否关基单位")
@Excel(name="是否关基单位",dictType="gjdw",comboReadDict = true)
private Integer gjdw;
@ApiModelProperty("日常运营负责部门")
private String rcyyfzbm;
@ApiModelProperty("单位负责人姓名")
@Excel(name="单位负责人")
private String dwfzrxm;
@ApiModelProperty("单位负责人联系方式")
@Excel(name="单位负责人联系方式")
private String dwfzrlxfs;
@ApiModelProperty("单位负责人邮箱")
@Excel(name="单位负责人邮箱")
private String dwfzryx;
@ApiModelProperty("单位负责人职务职称")
@Excel(name="单位负责人职务职称")
private String dwfzrzwzc;
@ApiModelProperty("分管负责人姓名")
@Excel(name="分管负责人")
private String fgfzrxm;
@ApiModelProperty("分管负责人联系方式")
@Excel(name="分管负责人联系方式")
private String fgfzrlxfs;
@ApiModelProperty("分管负责人邮箱")
@Excel(name="分管负责人邮箱")
private String fgfzryx;
@ApiModelProperty("分管负责人职务职称")
@Excel(name="分管负责人职务职称")
private String fgfzrzwzc;
@ApiModelProperty("部门负责人姓名")
@Excel(name="部门负责人")
private String bmfzrxm;
@ApiModelProperty("部门负责人联系方式")
@Excel(name="部门负责人联系方式")
private String bmfzrlxfs;
@ApiModelProperty("部门负责人邮箱")
@Excel(name="部门负责人邮箱")
private String bmfzryx;
@ApiModelProperty("部门负责人职务职称")
@Excel(name="部门负责人职务职称")
private String bmfzrzwzc;
@ApiModelProperty("第一联系人姓名")
@Excel(name="第一联系人")
private String dylxrxm;
@ApiModelProperty("第一联系人联系方式")
@Excel(name="第一联系人联系方式")
private String dylxrlxfs;
@ApiModelProperty("第一联系人邮箱")
@Excel(name="第一联系人邮箱")
private String dylxryx;
@ApiModelProperty("第一联系人职务职称")
@Excel(name="第一联系人职务职称")
private String dylxrzwzc;
@ApiModelProperty("检查信息")
private String jcxx;
@ApiModelProperty("官网")
@Excel(name = "官网")
private String gw;
@ApiModelProperty("地图位置-经度")
@Excel(name = "地图位置-经度")
private String dtjd;
@ApiModelProperty("地图位置-纬度")
@Excel(name = "地图位置-纬度")
private String dtwd;
@ApiModelProperty("单位直属性质")
@Excel(name = "单位直属性质", dictType="dwzsxz",comboReadDict = true)
private Integer dwzsxz;
/**
*
*/
@ApiModelProperty("创建者")
@TableField(fill = FieldFill.INSERT)
private String createBy;
/**
*
*/
@ApiModelProperty("创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
*
*/
@ApiModelProperty("更新者")
@TableField(fill = FieldFill.UPDATE)
private String updateBy;
/**
*
*/
@ApiModelProperty("更新时间")
@TableField(fill = FieldFill.UPDATE)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
@ApiModelProperty("备注")
@Excel(name = "备注")
private String remark;
}

@ -0,0 +1,23 @@
package com.ruoyi.common.core.domain.request;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
* @author du
* @since 2024/11/13 16:52
*/
@Data
public class UnitRequest {
@ApiModelProperty("统一社会信用代码")
private String userName;
@ApiModelProperty("单位名称")
private String nickName;
@ApiModelProperty("单位类型,传字典数字")
private Integer dwlx;
}

@ -24,6 +24,8 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.exception.ServiceException;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.reflect.FieldUtils; import org.apache.commons.lang3.reflect.FieldUtils;
@ -415,6 +417,12 @@ public class ExcelUtil<T>
// 从map中得到对应列的field. // 从map中得到对应列的field.
Field field = (Field) entry.getValue()[0]; Field field = (Field) entry.getValue()[0];
Excel attr = (Excel) entry.getValue()[1]; Excel attr = (Excel) entry.getValue()[1];
boolean rq = attr.required();
if(rq){
if(StringUtils.isNull(val) || StringUtils.isEmpty(val.toString())) {
throw new ServiceException("第"+i+"行"+attr.name()+"单元格必填项未填写,请正确填写!");
}
}
// 取得类型,并根据对象类型设置值. // 取得类型,并根据对象类型设置值.
Class<?> fieldType = field.getType(); Class<?> fieldType = field.getType();
if (String.class == fieldType) if (String.class == fieldType)

@ -6,6 +6,11 @@ import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import javax.sql.DataSource; import javax.sql.DataSource;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.apache.ibatis.io.VFS; import org.apache.ibatis.io.VFS;
import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean; import org.mybatis.spring.SqlSessionFactoryBean;
@ -113,20 +118,27 @@ public class MyBatisConfig
return resources.toArray(new Resource[resources.size()]); return resources.toArray(new Resource[resources.size()]);
} }
@Bean // @Bean
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception // public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
{ // {
String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage"); // String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
String mapperLocations = env.getProperty("mybatis.mapperLocations"); // String mapperLocations = env.getProperty("mybatis.mapperLocations");
String configLocation = env.getProperty("mybatis.configLocation"); // String configLocation = env.getProperty("mybatis.configLocation");
typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage); // typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
VFS.addImplClass(SpringBootVFS.class); // VFS.addImplClass(SpringBootVFS.class);
//
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); // final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(dataSource); // sessionFactory.setDataSource(dataSource);
sessionFactory.setTypeAliasesPackage(typeAliasesPackage); // sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ","))); // sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation)); // sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
return sessionFactory.getObject(); // return sessionFactory.getObject();
} // }
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
return interceptor;
}
} }

@ -0,0 +1,62 @@
package com.ruoyi.framework.config;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.Objects;
/**
*
*
* @author wu
* @since 2023/5/4 10:16
*/
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {
@Override
public void insertFill(MetaObject metaObject) {
// 获取当前登录用户
String userName = null;
Long userId = null;
try {
LoginUser loginUser = SecurityUtils.getLoginUser();
userName = loginUser.getUser().getNickName();
userId = SecurityUtils.getUserId();
} catch (Exception ignored) {
}
if (!Objects.equals(userName, "")) {
this.strictInsertFill(metaObject, "createBy", String.class, userName);
}
if (userId != null) {
this.strictInsertFill(metaObject, "createId", Long.class, userId);
}
this.strictInsertFill(metaObject, "createTime", Date.class, new Date());
}
@Override
public void updateFill(MetaObject metaObject) {
// 获取当前登录用户
String userName = null;
Long userId = null;
try {
LoginUser loginUser = SecurityUtils.getLoginUser();
userName = loginUser.getUser().getNickName();
userId = SecurityUtils.getUserId();
} catch (Exception ignored) {
}
if (userId != null) {
this.strictUpdateFill(metaObject, "updateId", Long.class, userId);
}
if (!Objects.equals(userName, "")) {
this.strictUpdateFill(metaObject, "updateBy", String.class, userName);
}
this.strictUpdateFill(metaObject, "updateTime", Date.class, new Date());
}
}

@ -115,6 +115,7 @@ public class SecurityConfig
// 静态资源,可匿名访问 // 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
.antMatchers("/system/user/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证 // 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated(); .anyRequest().authenticated();
}) })

@ -109,19 +109,19 @@ public interface SysUserMapper
*/ */
public SysUser checkUserNameUnique(String userName); public SysUser checkUserNameUnique(String userName);
/** // /**
* // * 校验手机号码是否唯一
* // *
* @param phonenumber // * @param phonenumber 手机号码
* @return // * @return 结果
*/ // */
public SysUser checkPhoneUnique(String phonenumber); // public SysUser checkPhoneUnique(String phonenumber);
//
/** // /**
* email // * 校验email是否唯一
* // *
* @param email // * @param email 用户邮箱
* @return // * @return 结果
*/ // */
public SysUser checkEmailUnique(String email); // public SysUser checkEmailUnique(String email);
} }

@ -0,0 +1,24 @@
package com.ruoyi.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.domain.entity.Unit;
import com.ruoyi.common.core.domain.request.UnitRequest;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* unit_info
* @author du
* @since 2024/11/13 15:04
*/
public interface UnitMapper extends BaseMapper<Unit> {
/**
*
*
* @param a
* @return
*/
List<Unit> selectUnitList(@Param("req") UnitRequest a);
}

@ -74,21 +74,21 @@ public interface ISysUserService
*/ */
public boolean checkUserNameUnique(SysUser user); public boolean checkUserNameUnique(SysUser user);
/** // /**
* // * 校验手机号码是否唯一
* // *
* @param user // * @param user 用户信息
* @return // * @return 结果
*/ // */
public boolean checkPhoneUnique(SysUser user); // public boolean checkPhoneUnique(SysUser user);
//
/** // /**
* email // * 校验email是否唯一
* // *
* @param user // * @param user 用户信息
* @return // * @return 结果
*/ // */
public boolean checkEmailUnique(SysUser user); // public boolean checkEmailUnique(SysUser user);
/** /**
* *

@ -0,0 +1,24 @@
package com.ruoyi.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.entity.Unit;
import com.ruoyi.common.core.domain.request.UnitRequest;
import java.util.List;
/**
* unit_info
* @author du
* @since 2024/11/13 15:02
*/
public interface UnitService extends IService<Unit> {
/**
*
*
* @param unit
* @return
*/
List<Unit> selectUnitList(UnitRequest unit);
}

@ -180,41 +180,41 @@ public class SysUserServiceImpl implements ISysUserService
return UserConstants.UNIQUE; return UserConstants.UNIQUE;
} }
/** // /**
* // * 校验手机号码是否唯一
* // *
* @param user // * @param user 用户信息
* @return // * @return
*/ // */
@Override // @Override
public boolean checkPhoneUnique(SysUser user) // public boolean checkPhoneUnique(SysUser user)
{ // {
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); // Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber()); // SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) // if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
{ // {
return UserConstants.NOT_UNIQUE; // return UserConstants.NOT_UNIQUE;
} // }
return UserConstants.UNIQUE; // return UserConstants.UNIQUE;
} // }
//
/** // /**
* email // * 校验email是否唯一
* // *
* @param user // * @param user 用户信息
* @return // * @return
*/ // */
@Override // @Override
public boolean checkEmailUnique(SysUser user) // public boolean checkEmailUnique(SysUser user)
{ // {
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); // Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
SysUser info = userMapper.checkEmailUnique(user.getEmail()); // SysUser info = userMapper.checkEmailUnique(user.getEmail());
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) // if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
{ // {
return UserConstants.NOT_UNIQUE; // return UserConstants.NOT_UNIQUE;
} // }
return UserConstants.UNIQUE; // return UserConstants.UNIQUE;
} // }
/** /**
* *
@ -505,7 +505,7 @@ public class SysUserServiceImpl implements ISysUserService
deptService.checkDeptDataScope(user.getDeptId()); deptService.checkDeptDataScope(user.getDeptId());
String password = configService.selectConfigByKey("sys.user.initPassword"); String password = configService.selectConfigByKey("sys.user.initPassword");
user.setPassword(SecurityUtils.encryptPassword(password)); user.setPassword(SecurityUtils.encryptPassword(password));
user.setCreateBy(operName); // user.setCreateBy(operName);
userMapper.insertUser(user); userMapper.insertUser(user);
successNum++; successNum++;
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功"); successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
@ -517,7 +517,7 @@ public class SysUserServiceImpl implements ISysUserService
checkUserDataScope(u.getUserId()); checkUserDataScope(u.getUserId());
deptService.checkDeptDataScope(user.getDeptId()); deptService.checkDeptDataScope(user.getDeptId());
user.setUserId(u.getUserId()); user.setUserId(u.getUserId());
user.setUpdateBy(operName); // user.setUpdateBy(operName);
userMapper.updateUser(user); userMapper.updateUser(user);
successNum++; successNum++;
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功"); successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");

@ -0,0 +1,31 @@
package com.ruoyi.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.Unit;
import com.ruoyi.common.core.domain.request.UnitRequest;
import com.ruoyi.system.mapper.UnitMapper;
import com.ruoyi.system.service.UnitService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* unit_info
* @author du
* @since 2024/11/13 15:02
*/
@Service
public class UnitServiceImpl extends ServiceImpl<UnitMapper, Unit> implements UnitService {
/**
*
*
* @param unit
* @return
*/
@Override
public List<Unit> selectUnitList(UnitRequest unit) {
return baseMapper.selectUnitList(unit);
}
}

@ -9,9 +9,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deptId" column="dept_id" /> <result property="deptId" column="dept_id" />
<result property="userName" column="user_name" /> <result property="userName" column="user_name" />
<result property="nickName" column="nick_name" /> <result property="nickName" column="nick_name" />
<result property="email" column="email" /> <!-- <result property="email" column="email" />-->
<result property="phonenumber" column="phonenumber" /> <!-- <result property="phonenumber" column="phonenumber" />-->
<result property="sex" column="sex" /> <!-- <result property="sex" column="sex" />-->
<result property="avatar" column="avatar" /> <result property="avatar" column="avatar" />
<result property="password" column="password" /> <result property="password" column="password" />
<result property="status" column="status" /> <result property="status" column="status" />
@ -24,9 +24,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<association property="dept" javaType="SysDept" resultMap="deptResult" /> <association property="dept" javaType="SysDept" resultMap="deptResult" />
<association property="unitInfo"
javaType="Unit"
column="user_name"
select="UnitList"/>
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" /> <collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap> </resultMap>
<select id="UnitList" parameterType="Unit" resultMap="com.ruoyi.system.mapper.UnitMapper.unitResult">
select * from unit_info where user_name = #{user_name}
</select>
<resultMap id="deptResult" type="SysDept"> <resultMap id="deptResult" type="SysDept">
<id property="deptId" column="dept_id" /> <id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" /> <result property="parentId" column="parent_id" />
@ -47,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectUserVo"> <sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, select u.user_id, u.dept_id, u.user_name, u.nick_name, u.avatar, u.password, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u from sys_user u
@ -57,8 +65,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u select u.user_id, u.dept_id, u.nick_name, u.user_name, u.avatar, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
left join unit_info c on u.user_name = c.user_name
where u.del_flag = '0' where u.del_flag = '0'
<if test="userId != null and userId != 0"> <if test="userId != null and userId != 0">
AND u.user_id = #{userId} AND u.user_id = #{userId}
@ -69,9 +78,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND u.status = #{status} AND u.status = #{status}
</if> </if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(u.create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d') AND date_format(u.create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if> </if>
@ -86,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.status, u.create_time
from sys_user u from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id left join sys_user_role ur on u.user_id = ur.user_id
@ -95,15 +101,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userName != null and userName != ''"> <if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%') AND u.user_name like concat('%', #{userName}, '%')
</if> </if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
</select> </select>
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.status, u.create_time
from sys_user u from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id left join sys_user_role ur on u.user_id = ur.user_id
@ -113,9 +116,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userName != null and userName != ''"> <if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%') AND u.user_name like concat('%', #{userName}, '%')
</if> </if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
</select> </select>
@ -134,13 +134,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1 select user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1
</select> </select>
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult"> <!-- <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">-->
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1 <!-- select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1-->
</select> <!-- </select>-->
<!-- -->
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult"> <!-- <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">-->
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 <!-- select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1-->
</select> <!-- </select>-->
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId"> <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user( insert into sys_user(
@ -148,10 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != 0">dept_id,</if> <if test="deptId != null and deptId != 0">dept_id,</if>
<if test="userName != null and userName != ''">user_name,</if> <if test="userName != null and userName != ''">user_name,</if>
<if test="nickName != null and nickName != ''">nick_name,</if> <if test="nickName != null and nickName != ''">nick_name,</if>
<if test="email != null and email != ''">email,</if>
<if test="avatar != null and avatar != ''">avatar,</if> <if test="avatar != null and avatar != ''">avatar,</if>
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
<if test="sex != null and sex != ''">sex,</if>
<if test="password != null and password != ''">password,</if> <if test="password != null and password != ''">password,</if>
<if test="status != null and status != ''">status,</if> <if test="status != null and status != ''">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
@ -162,10 +159,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != ''">#{deptId},</if> <if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="userName != null and userName != ''">#{userName},</if> <if test="userName != null and userName != ''">#{userName},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if> <if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if> <if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
<if test="sex != null and sex != ''">#{sex},</if>
<if test="password != null and password != ''">#{password},</if> <if test="password != null and password != ''">#{password},</if>
<if test="status != null and status != ''">#{status},</if> <if test="status != null and status != ''">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
@ -180,9 +174,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if> <if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if> <if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if> <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="email != null ">email = #{email},</if>
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if>
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if> <if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
<if test="password != null and password != ''">password = #{password},</if> <if test="password != null and password != ''">password = #{password},</if>
<if test="status != null and status != ''">status = #{status},</if> <if test="status != null and status != ''">status = #{status},</if>

@ -0,0 +1,66 @@
<?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.ruoyi.system.mapper.UnitMapper">
<resultMap id="unitResult" type="Unit">
<id property="id" column="id" />
<result property="userName" column="user_name"/>
<result property="nickName" column="nick_name"/>
<result property="dwjc" column="dwjc"/>
<result property="ssqyprovince" column="ssqyprovince"/>
<result property="ssqycity" column="ssqycity"/>
<result property="ssqycity" column="ssqycity"/>
<result property="dwxxdz" column="dwxxdz"/>
<result property="sshy" column="sshy"/>
<result property="dwlx" column="dwlx"/>
<result property="dwbq" column="dwbq"/>
<result property="ssjgdw" column="ssjgdw"/>
<result property="dwjs" column="dwjs"/>
<result property="dwzsxz" column="dwzsxz"/>
<result property="gjdw" column="gjdw"/>
<result property="rcyyfzbm" column="rcyyfzbm"/>
<result property="dwfzrxm" column="dwfzrxm"/>
<result property="dwfzrlxfs" column="dwfzrlxfs"/>
<result property="dwfzryx" column="dwfzryx"/>
<result property="dwfzrzwzc" column="dwfzrzwzc"/>
<result property="fgfzrxm" column="fgfzrxm"/>
<result property="fgfzrlxfs" column="fgfzrlxfs"/>
<result property="fgfzryx" column="fgfzryx"/>
<result property="fgfzrzwzc" column="fgfzrzwzc"/>
<result property="bmfzrxm" column="bmfzrxm"/>
<result property="bmfzrlxfs" column="bmfzrlxfs"/>
<result property="bmfzryx" column="bmfzryx"/>
<result property="bmfzrzwzc" column="bmfzrzwzc"/>
<result property="dylxrxm" column="dylxrxm"/>
<result property="dylxrlxfs" column="dylxrlxfs"/>
<result property="dylxryx" column="dylxryx"/>
<result property="dylxrzwzc" column="dylxrzwzc"/>
<result property="jcxx" column="jcxx"/>
<result property="gw" column="gw"/>
<result property="dtjd" column="dtjd"/>
<result property="dtwd" column="dtwd"/>
<result property="sjdw" column="sjdw"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<select id="selectUnitList" parameterType="unit" resultMap="unitResult">
select * from unit_info
<where>
<if test="req.nickName != null and req.nickName != '' ">
and nick_name like concat('%',#{req.nickName},'%')
</if>
<if test="req.dwlx != null">
and dwlx = #{req.dwlx}
</if>
<if test="req.userName != null and req.userName != '' ">
and user_name like concat('%',#{req.userName},'%')
</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save