Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
car-database-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
中汽研标准应用数据库
car-database-api
Commits
eef0e6df
Commit
eef0e6df
authored
Sep 05, 2024
by
wdy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wangdingyi' into 'master'
车企与单位数据同步 See merge request
!8
parents
7cf6177a
ddeac1ac
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
92 additions
and
24 deletions
+92
-24
AutomobileEnterpriseServiceImpl.java
...m/ruoyi/service/impl/AutomobileEnterpriseServiceImpl.java
+29
-2
AutomobileEnterpriseController.java
...in/java/com/ruoyi/web/AutomobileEnterpriseController.java
+12
-1
SysDeptController.java
...va/com/ruoyi/web/controller/system/SysDeptController.java
+16
-16
SysDept.java
...ain/java/com/ruoyi/common/core/domain/entity/SysDept.java
+12
-0
SysDeptMapper.java
.../src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java
+2
-0
ISysDeptService.java
...c/main/java/com/ruoyi/system/service/ISysDeptService.java
+2
-0
SysDeptServiceImpl.java
...ava/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
+5
-0
SysDeptMapper.xml
...system/src/main/resources/mapper/system/SysDeptMapper.xml
+14
-5
No files found.
quality-review/src/main/java/com/ruoyi/service/impl/AutomobileEnterpriseServiceImpl.java
View file @
eef0e6df
...
...
@@ -4,9 +4,12 @@ import java.util.List;
import
cn.hutool.core.util.ObjUtil
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.ruoyi.common.core.domain.entity.SysDept
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.framework.web.domain.server.Sys
;
import
com.ruoyi.system.service.ISysDeptService
;
import
com.ruoyi.web.request.AutomobileEnterpriseListRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -28,6 +31,9 @@ public class AutomobileEnterpriseServiceImpl extends ServiceImpl<AutomobileEnter
@Autowired
private
AutomobileEnterpriseMapper
automobileEnterpriseMapper
;
@Autowired
private
ISysDeptService
deptService
;
/**
* 查询车企信息
*
...
...
@@ -71,7 +77,20 @@ public class AutomobileEnterpriseServiceImpl extends ServiceImpl<AutomobileEnter
}
automobileEnterprise
.
setCreateTime
(
DateUtils
.
getNowDate
());
automobileEnterprise
.
setCreateBy
(
String
.
valueOf
(
SecurityUtils
.
getUserId
()));
return
automobileEnterpriseMapper
.
insert
(
automobileEnterprise
);
automobileEnterpriseMapper
.
insert
(
automobileEnterprise
);
SysDept
dept
=
new
SysDept
();
dept
.
setOrderNum
(
0
);
dept
.
setParentId
(
100
l
);
dept
.
setAncestors
(
"0,100"
);
dept
.
setDeptType
(
"enterprise"
);
dept
.
setDeptName
(
automobileEnterprise
.
getEnterpriseName
());
dept
.
setAddress
(
automobileEnterprise
.
getAddress
());
dept
.
setPostcode
(
automobileEnterprise
.
getPostcode
());
dept
.
setLeader
(
automobileEnterprise
.
getEnterpriseContact
());
dept
.
setPhone
(
automobileEnterprise
.
getContactNumber
());
dept
.
setAutomobileEnterpriseId
(
automobileEnterprise
.
getId
());
deptService
.
insertDept
(
dept
);
return
1
;
}
/**
...
...
@@ -93,7 +112,15 @@ public class AutomobileEnterpriseServiceImpl extends ServiceImpl<AutomobileEnter
}
automobileEnterprise
.
setUpdateTime
(
DateUtils
.
getNowDate
());
automobileEnterprise
.
setUpdateBy
(
String
.
valueOf
(
SecurityUtils
.
getUserId
()));
return
automobileEnterpriseMapper
.
updateAutomobileEnterprise
(
automobileEnterprise
);
automobileEnterpriseMapper
.
updateAutomobileEnterprise
(
automobileEnterprise
);
SysDept
dept
=
deptService
.
getDeptByAutomobileEnterpriseId
(
automobileEnterprise
.
getId
());
dept
.
setDeptName
(
automobileEnterprise
.
getEnterpriseName
());
dept
.
setAddress
(
automobileEnterprise
.
getAddress
());
dept
.
setPostcode
(
automobileEnterprise
.
getPostcode
());
dept
.
setLeader
(
automobileEnterprise
.
getEnterpriseContact
());
dept
.
setPhone
(
automobileEnterprise
.
getContactNumber
());
deptService
.
updateDept
(
dept
);
return
1
;
}
}
quality-review/src/main/java/com/ruoyi/web/AutomobileEnterpriseController.java
View file @
eef0e6df
...
...
@@ -6,9 +6,11 @@ import javax.servlet.http.HttpServletResponse;
import
cn.hutool.core.collection.CollUtil
;
import
com.ruoyi.common.core.domain.R
;
import
com.ruoyi.common.core.domain.entity.SysDept
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.domain.Sample
;
import
com.ruoyi.service.SampleManagementService
;
import
com.ruoyi.system.service.ISysDeptService
;
import
com.ruoyi.web.request.AutomobileEnterpriseEditRequest
;
import
com.ruoyi.web.request.AutomobileEnterpriseGetInfoRequest
;
import
com.ruoyi.web.request.AutomobileEnterpriseListRequest
;
...
...
@@ -47,6 +49,9 @@ public class AutomobileEnterpriseController extends BaseController
@Autowired
private
SampleManagementService
sampleManagementService
;
@Autowired
private
ISysDeptService
deptService
;
/**
* 查询车企信息列表
*/
...
...
@@ -122,6 +127,12 @@ public class AutomobileEnterpriseController extends BaseController
}
}
// 判断样品是否在此企业下
return
R
.
ok
(
automobileEnterpriseService
.
removeBatchByIds
(
Arrays
.
asList
(
request
.
getIds
())));
automobileEnterpriseService
.
removeBatchByIds
(
Arrays
.
asList
(
request
.
getIds
()));
for
(
Long
id
:
ids
)
{
SysDept
dept
=
deptService
.
getDeptByAutomobileEnterpriseId
(
id
);
deptService
.
deleteDeptById
(
dept
.
getDeptId
());
}
return
R
.
ok
();
}
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
View file @
eef0e6df
...
...
@@ -23,7 +23,7 @@ import com.ruoyi.common.utils.StringUtils;
import
com.ruoyi.system.service.ISysDeptService
;
/**
*
部门
信息
*
单位
信息
*
* @author ruoyi
*/
...
...
@@ -35,7 +35,7 @@ public class SysDeptController extends BaseController
private
ISysDeptService
deptService
;
/**
* 获取
部门
列表
* 获取
单位
列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:dept:list')"
)
@GetMapping
(
"/list"
)
...
...
@@ -46,7 +46,7 @@ public class SysDeptController extends BaseController
}
/**
* 查询
部门
列表(排除节点)
* 查询
单位
列表(排除节点)
*/
@PreAuthorize
(
"@ss.hasPermi('system:dept:list')"
)
@GetMapping
(
"/list/exclude/{deptId}"
)
...
...
@@ -58,7 +58,7 @@ public class SysDeptController extends BaseController
}
/**
* 根据
部门
编号获取详细信息
* 根据
单位
编号获取详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:dept:query')"
)
@GetMapping
(
value
=
"/{deptId}"
)
...
...
@@ -69,26 +69,26 @@ public class SysDeptController extends BaseController
}
/**
* 新增
部门
* 新增
单位
*/
@PreAuthorize
(
"@ss.hasPermi('system:dept:add')"
)
@Log
(
title
=
"
部门
管理"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"
单位
管理"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@Validated
@RequestBody
SysDept
dept
)
{
if
(!
deptService
.
checkDeptNameUnique
(
dept
))
{
return
error
(
"新增
部门'"
+
dept
.
getDeptName
()
+
"'失败,部门
名称已存在"
);
return
error
(
"新增
单位'"
+
dept
.
getDeptName
()
+
"'失败,单位
名称已存在"
);
}
dept
.
setCreateBy
(
getUsername
());
return
toAjax
(
deptService
.
insertDept
(
dept
));
}
/**
* 修改
部门
* 修改
单位
*/
@PreAuthorize
(
"@ss.hasPermi('system:dept:edit')"
)
@Log
(
title
=
"
部门
管理"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"
单位
管理"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@Validated
@RequestBody
SysDept
dept
)
{
...
...
@@ -96,35 +96,35 @@ public class SysDeptController extends BaseController
deptService
.
checkDeptDataScope
(
deptId
);
if
(!
deptService
.
checkDeptNameUnique
(
dept
))
{
return
error
(
"修改
部门'"
+
dept
.
getDeptName
()
+
"'失败,部门
名称已存在"
);
return
error
(
"修改
单位'"
+
dept
.
getDeptName
()
+
"'失败,单位
名称已存在"
);
}
else
if
(
dept
.
getParentId
().
equals
(
deptId
))
{
return
error
(
"修改
部门'"
+
dept
.
getDeptName
()
+
"'失败,上级部门
不能是自己"
);
return
error
(
"修改
单位'"
+
dept
.
getDeptName
()
+
"'失败,上级单位
不能是自己"
);
}
else
if
(
StringUtils
.
equals
(
UserConstants
.
DEPT_DISABLE
,
dept
.
getStatus
())
&&
deptService
.
selectNormalChildrenDeptById
(
deptId
)
>
0
)
{
return
error
(
"该
部门包含未停用的子部门
!"
);
return
error
(
"该
单位包含未停用的子单位
!"
);
}
dept
.
setUpdateBy
(
getUsername
());
return
toAjax
(
deptService
.
updateDept
(
dept
));
}
/**
* 删除
部门
* 删除
单位
*/
@PreAuthorize
(
"@ss.hasPermi('system:dept:remove')"
)
@Log
(
title
=
"
部门
管理"
,
businessType
=
BusinessType
.
DELETE
)
@Log
(
title
=
"
单位
管理"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{deptId}"
)
public
AjaxResult
remove
(
@PathVariable
Long
deptId
)
{
if
(
deptService
.
hasChildByDeptId
(
deptId
))
{
return
warn
(
"存在下级
部门
,不允许删除"
);
return
warn
(
"存在下级
单位
,不允许删除"
);
}
if
(
deptService
.
checkDeptExistUser
(
deptId
))
{
return
warn
(
"
部门
存在用户,不允许删除"
);
return
warn
(
"
单位
存在用户,不允许删除"
);
}
deptService
.
checkDeptDataScope
(
deptId
);
return
toAjax
(
deptService
.
deleteDeptById
(
deptId
));
...
...
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java
View file @
eef0e6df
...
...
@@ -59,6 +59,9 @@ public class SysDept extends BaseEntity
/** 邮编 */
private
String
postcode
;
/** 车企id */
private
Long
automobileEnterpriseId
;
/** 子部门 */
private
List
<
SysDept
>
children
=
new
ArrayList
<
SysDept
>();
...
...
@@ -215,6 +218,14 @@ public class SysDept extends BaseEntity
this
.
deptType
=
deptType
;
}
public
Long
getAutomobileEnterpriseId
()
{
return
automobileEnterpriseId
;
}
public
void
setAutomobileEnterpriseId
(
Long
automobileEnterpriseId
)
{
this
.
automobileEnterpriseId
=
automobileEnterpriseId
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
...
...
@@ -235,6 +246,7 @@ public class SysDept extends BaseEntity
.
append
(
"address"
,
getAddress
())
.
append
(
"postcode"
,
getPostcode
())
.
append
(
"deptType"
,
getDeptType
())
.
append
(
"automobileEnterpriseId"
,
getAutomobileEnterpriseId
())
.
toString
();
}
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java
View file @
eef0e6df
...
...
@@ -118,4 +118,6 @@ public interface SysDeptMapper
* @return 结果
*/
public
int
deleteDeptById
(
Long
deptId
);
SysDept
getDeptByAutomobileEnterpriseId
(
@Param
(
"automobileEnterpriseId"
)
Long
automobileEnterpriseId
);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
View file @
eef0e6df
...
...
@@ -121,4 +121,6 @@ public interface ISysDeptService
* @return 结果
*/
public
int
deleteDeptById
(
Long
deptId
);
public
SysDept
getDeptByAutomobileEnterpriseId
(
Long
automobileEnterpriseId
);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
View file @
eef0e6df
...
...
@@ -293,6 +293,11 @@ public class SysDeptServiceImpl implements ISysDeptService
return
deptMapper
.
deleteDeptById
(
deptId
);
}
@Override
public
SysDept
getDeptByAutomobileEnterpriseId
(
Long
automobileEnterpriseId
)
{
return
deptMapper
.
getDeptByAutomobileEnterpriseId
(
automobileEnterpriseId
);
}
/**
* 递归列表
*/
...
...
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
View file @
eef0e6df
...
...
@@ -23,10 +23,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"address"
column=
"address"
/>
<result
property=
"postcode"
column=
"postcode"
/>
<result
property=
"deptType"
column=
"dept_type"
/>
<result
property=
"automobileEnterpriseId"
column=
"automobile_enterprise_id"
/>
</resultMap>
<sql
id=
"selectDeptVo"
>
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time, d.address, d.postcode, d.dept_type
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time, d.address, d.postcode, d.dept_type
, d.automobile_enterprise_id
from sys_dept d
</sql>
...
...
@@ -89,6 +90,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include
refid=
"selectDeptVo"
/>
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
</select>
<select
id=
"getDeptByAutomobileEnterpriseId"
resultType=
"com.ruoyi.common.core.domain.entity.SysDept"
>
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time, d.address, d.postcode, d.dept_type, d.automobile_enterprise_id
from sys_dept d
where d.automobile_enterprise_id = #{automobileEnterpriseId}
</select>
<insert
id=
"insertDept"
parameterType=
"SysDept"
>
insert into sys_dept(
...
...
@@ -104,7 +110,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createBy != null and createBy != ''"
>
create_by,
</if>
<if
test=
"address != null and address != ''"
>
address,
</if>
<if
test=
"postcode != null and postcode != ''"
>
postcode,
</if>
<if
test=
"deptType != null and deptType != ''"
>
deptType,
</if>
<if
test=
"deptType != null and deptType != ''"
>
dept_type,
</if>
<if
test=
"automobileEnterpriseId != null and automobileEnterpriseId != ''"
>
automobile_enterprise_id,
</if>
create_time
)values(
<if
test=
"deptId != null and deptId != 0"
>
#{deptId},
</if>
...
...
@@ -120,6 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"address != null and address != ''"
>
#{address},
</if>
<if
test=
"postcode != null and postcode != ''"
>
#{postcode},
</if>
<if
test=
"deptType != null and deptType != ''"
>
#{deptType},
</if>
<if
test=
"automobileEnterpriseId != null and automobileEnterpriseId != ''"
>
#{automobileEnterpriseId},
</if>
sysdate()
)
</insert>
...
...
@@ -138,7 +146,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"updateBy != null and updateBy != ''"
>
update_by = #{updateBy},
</if>
<if
test=
"address != null and address != ''"
>
address = #{address},
</if>
<if
test=
"postcode != null and postcode != ''"
>
postcode = #{postcode},
</if>
<if
test=
"deptType != null and deptType != ''"
>
deptType = #{deptType},
</if>
<if
test=
"deptType != null and deptType != ''"
>
dept_type = #{deptType},
</if>
<if
test=
"automobileEnterpriseId != null and automobileEnterpriseId != ''"
>
automobile_enterprise_id = #{automobileEnterpriseId},
</if>
update_time = sysdate()
</set>
where dept_id = #{deptId}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment