Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vehicle-quality-review
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
王飞
vehicle-quality-review
Commits
23c281f1
Commit
23c281f1
authored
Mar 18, 2024
by
盖献康
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug(70605) - 车企管理-当企业已经被样品关联时,需要限制不能删除
parent
eb6d7fb2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
4 deletions
+25
-4
AutomobileEnterpriseController.java
...in/java/com/ruoyi/web/AutomobileEnterpriseController.java
+18
-0
SampleManagementRequest.java
...n/java/com/ruoyi/web/request/SampleManagementRequest.java
+2
-0
SampleManagementMapper.xml
...view/src/main/resources/mapper/SampleManagementMapper.xml
+5
-4
No files found.
quality-review/src/main/java/com/ruoyi/web/AutomobileEnterpriseController.java
View file @
23c281f1
...
...
@@ -4,10 +4,15 @@ import java.util.Arrays;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
cn.hutool.core.collection.CollUtil
;
import
com.ruoyi.common.core.domain.R
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.domain.Sample
;
import
com.ruoyi.service.SampleManagementService
;
import
com.ruoyi.web.request.AutomobileEnterpriseEditRequest
;
import
com.ruoyi.web.request.AutomobileEnterpriseGetInfoRequest
;
import
com.ruoyi.web.request.AutomobileEnterpriseListRequest
;
import
com.ruoyi.web.request.SampleManagementRequest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -39,6 +44,9 @@ public class AutomobileEnterpriseController extends BaseController
@Autowired
private
AutomobileEnterpriseService
automobileEnterpriseService
;
@Autowired
private
SampleManagementService
sampleManagementService
;
/**
* 查询车企信息列表
*/
...
...
@@ -104,6 +112,16 @@ public class AutomobileEnterpriseController extends BaseController
@PostMapping
(
"/remove"
)
public
R
<
Boolean
>
remove
(
@Validated
@RequestBody
AutomobileEnterpriseEditRequest
request
)
{
Long
[]
ids
=
request
.
getIds
();
for
(
Long
id
:
ids
)
{
SampleManagementRequest
sampleManagementRequest
=
new
SampleManagementRequest
();
sampleManagementRequest
.
setManufacturingEnterpriseId
(
id
);
List
<
Sample
>
samples
=
sampleManagementService
.
selectSampleList
(
sampleManagementRequest
);
if
(
CollUtil
.
isNotEmpty
(
samples
))
{
throw
new
ServiceException
(
"已被样品引用,不允许删除"
);
}
}
// 判断样品是否在此企业下
return
R
.
ok
(
automobileEnterpriseService
.
removeBatchByIds
(
Arrays
.
asList
(
request
.
getIds
())));
}
}
quality-review/src/main/java/com/ruoyi/web/request/SampleManagementRequest.java
View file @
23c281f1
...
...
@@ -25,4 +25,6 @@ public class SampleManagementRequest extends PageDomain {
/** 0:整车样品 1:零部件样品 */
@ApiModelProperty
(
"0:整车样品 1:零部件样品"
)
private
String
flag
;
private
Long
manufacturingEnterpriseId
;
}
quality-review/src/main/resources/mapper/SampleManagementMapper.xml
View file @
23c281f1
...
...
@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.ruoyi.mapper.SampleManagementMapper"
>
<resultMap
type=
"com.ruoyi.domain.Sample"
id=
"SampleManagementResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"identificationCode"
column=
"identification_code"
/>
...
...
@@ -61,12 +61,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"flag != null and flag != ''"
>
and sm.flag = #{flag}
</if>
</where>
</select>
<select
id=
"selectSampleManagementById"
parameterType=
"Long"
resultMap=
"SampleManagementResult"
>
<include
refid=
"selectTSampleManagementVo"
/>
where sm.id = #{id}
</select>
<insert
id=
"insertSampleManagement"
parameterType=
"com.ruoyi.domain.Sample"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into t_sample
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
...
...
@@ -162,6 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"identificationCode != null and identificationCode != ''"
>
and sm.identification_code = #{identificationCode}
</if>
<if
test=
"sampleNumber != null and sampleNumber != ''"
>
and sm.sample_number = #{sampleNumber}
</if>
<if
test=
"flag != null and flag != ''"
>
and sm.flag = #{flag}
</if>
<if
test=
"manufacturingEnterpriseId != null"
>
and sm.manufacturing_enterprise_id = #{manufacturingEnterpriseId}
</if>
</where>
</select>
...
...
@@ -183,4 +184,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
ORDER BY ts.id
</select>
</mapper>
\ No newline at end of file
</mapper>
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