Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
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
李丛阳
education
Commits
e8b4830e
Commit
e8b4830e
authored
Jan 18, 2018
by
curryft
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改question
parent
de837402
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
65 additions
and
10 deletions
+65
-10
BLessonServiceImpl.java
...oft/business/blesson/service/impl/BLessonServiceImpl.java
+0
-1
TQuestionController.java
...ft/business/tquestion/controller/TQuestionController.java
+22
-7
TQuestionRepository.java
...g/rcisoft/business/tquestion/dao/TQuestionRepository.java
+18
-0
TQuestion.java
...java/org/rcisoft/business/tquestion/entity/TQuestion.java
+8
-0
TQuestionService.java
.../rcisoft/business/tquestion/service/TQuestionService.java
+1
-1
TQuestionServiceImpl.java
...business/tquestion/service/impl/TQuestionServiceImpl.java
+14
-1
IdEntity.java
src/main/java/org/rcisoft/core/entity/IdEntity.java
+2
-0
No files found.
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonServiceImpl.java
View file @
e8b4830e
...
@@ -81,7 +81,6 @@ public class BLessonServiceImpl implements BLessonService {
...
@@ -81,7 +81,6 @@ public class BLessonServiceImpl implements BLessonService {
model
.
setDefaultUrl
(
global
.
getDEFAULT_COURSE_LOCATION
());
model
.
setDefaultUrl
(
global
.
getDEFAULT_COURSE_LOCATION
());
UserUtil
.
setCurrentPersistOperation
(
model
);
UserUtil
.
setCurrentPersistOperation
(
model
);
line
=
bLessonRepository
.
insertSelective
(
model
);
line
=
bLessonRepository
.
insertSelective
(
model
);
//添加课程方向信息
//添加课程方向信息
direction
.
setBusinessId
(
IdGen
.
uuid
());
direction
.
setBusinessId
(
IdGen
.
uuid
());
direction
.
setLessionId
(
model
.
getBusinessId
());
direction
.
setLessionId
(
model
.
getBusinessId
());
...
...
src/main/java/org/rcisoft/business/tquestion/controller/TQuestionController.java
View file @
e8b4830e
...
@@ -5,6 +5,7 @@ package org.rcisoft.business.tquestion.controller;
...
@@ -5,6 +5,7 @@ package org.rcisoft.business.tquestion.controller;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -39,6 +40,7 @@ public class TQuestionController extends PaginationController<TQuestion> {
...
@@ -39,6 +40,7 @@ public class TQuestionController extends PaginationController<TQuestion> {
@ApiOperation
(
value
=
"添加"
,
notes
=
"添加"
)
@ApiOperation
(
value
=
"添加"
,
notes
=
"添加"
)
//@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
//@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PostMapping
@PostMapping
@PreAuthorize
(
"hasRole('ROLE_1001')"
)
public
Result
add
(
@Valid
TQuestion
tQuestion
,
BindingResult
bindingResult
)
{
public
Result
add
(
@Valid
TQuestion
tQuestion
,
BindingResult
bindingResult
)
{
if
(
bindingResult
.
hasErrors
())
{
if
(
bindingResult
.
hasErrors
())
{
throw
new
ServiceException
(
ResultServiceEnums
.
PARAMETER_ERROR
.
getCode
(),
throw
new
ServiceException
(
ResultServiceEnums
.
PARAMETER_ERROR
.
getCode
(),
...
@@ -52,9 +54,10 @@ public class TQuestionController extends PaginationController<TQuestion> {
...
@@ -52,9 +54,10 @@ public class TQuestionController extends PaginationController<TQuestion> {
tQuestion
);
tQuestion
);
}
}
@ApiOperation
(
value
=
"逻辑删除"
,
notes
=
"逻辑删除"
)
@ApiOperation
(
value
=
"删除题目"
,
notes
=
"根据ID删除一个题"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"id"
,
required
=
false
,
dataType
=
"varchar"
)})
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
)})
@DeleteMapping
(
"/{id:\\d+}"
)
@PostMapping
(
"/remove"
)
@PreAuthorize
(
"hasRole('ROLE_1001')"
)
public
Result
delete
(
@PathVariable
String
id
)
{
public
Result
delete
(
@PathVariable
String
id
)
{
TQuestion
tQuestion
=
new
TQuestion
();
TQuestion
tQuestion
=
new
TQuestion
();
tQuestion
.
setBusinessId
(
id
);
tQuestion
.
setBusinessId
(
id
);
...
@@ -69,6 +72,7 @@ public class TQuestionController extends PaginationController<TQuestion> {
...
@@ -69,6 +72,7 @@ public class TQuestionController extends PaginationController<TQuestion> {
@ApiOperation
(
value
=
"修改"
,
notes
=
"修改"
)
@ApiOperation
(
value
=
"修改"
,
notes
=
"修改"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
)})
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
)})
@PutMapping
(
"/{id:\\d+}"
)
@PutMapping
(
"/{id:\\d+}"
)
@PreAuthorize
(
"hasRole('ROLE_1001')"
)
public
Result
update
(
@Valid
TQuestion
tQuestion
,
BindingResult
bindingResult
)
{
public
Result
update
(
@Valid
TQuestion
tQuestion
,
BindingResult
bindingResult
)
{
if
(
bindingResult
.
hasErrors
())
{
if
(
bindingResult
.
hasErrors
())
{
throw
new
ServiceException
(
ResultServiceEnums
.
PARAMETER_ERROR
.
getCode
(),
throw
new
ServiceException
(
ResultServiceEnums
.
PARAMETER_ERROR
.
getCode
(),
...
@@ -82,8 +86,9 @@ public class TQuestionController extends PaginationController<TQuestion> {
...
@@ -82,8 +86,9 @@ public class TQuestionController extends PaginationController<TQuestion> {
tQuestion
);
tQuestion
);
}
}
@ApiOperation
(
value
=
"查看单 "
,
notes
=
"查看单 "
)
@ApiOperation
(
value
=
"唯一查找"
,
notes
=
"根据ID查找一条记录"
)
@GetMapping
(
"/{id:\\d+}"
)
@GetMapping
(
"/one"
)
@PreAuthorize
(
"hasRole('ROLE_1001')"
)
public
Result
detail
(
@PathVariable
String
id
)
{
public
Result
detail
(
@PathVariable
String
id
)
{
return
Result
.
builder
(
new
PersistModel
(
1
),
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
...
@@ -91,14 +96,24 @@ public class TQuestionController extends PaginationController<TQuestion> {
...
@@ -91,14 +96,24 @@ public class TQuestionController extends PaginationController<TQuestion> {
tQuestionServiceImpl
.
findById
(
id
));
tQuestionServiceImpl
.
findById
(
id
));
}
}
@ApiOperation
(
value
=
"
查看 集合"
,
notes
=
"查看单 集合
"
)
@ApiOperation
(
value
=
"
根据条件分页查询"
,
notes
=
"根据URL中的参数分页查询
"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"qtype"
,
value
=
"题目类型"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"qtype"
,
value
=
"题目类型"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"qtitle"
,
value
=
"关键字"
,
required
=
false
,
dataType
=
"varchar"
)})
@ApiImplicitParam
(
name
=
"qtitle"
,
value
=
"关键字"
,
required
=
false
,
dataType
=
"varchar"
)})
@GetMapping
(
value
=
"/queryTQuestionByPagination"
)
@GetMapping
(
value
=
"/queryTQuestionByPagination"
)
public
GridModel
listByPagination
(
TQuestion
tQuestion
)
{
public
GridModel
listByPagination
(
TQuestion
tQuestion
)
{
tQuestion
.
setCreateBy
(
UserUtil
.
getUserInfoProp
(
getToken
(),
UserUtil
.
USER_ID
));
tQuestion
.
setCreateBy
(
UserUtil
.
getUserInfoProp
(
getToken
(),
UserUtil
.
USER_ID
));
tQuestionServiceImpl
.
findAllByPagination
(
getPaginationUtility
(),
tQuestion
);
tQuestionServiceImpl
.
findAllByPagination
(
getPaginationUtility
(),
tQuestion
);
return
getGridModelResponse
();
return
getGridModelResponse
();
}
}
@ApiOperation
(
value
=
"根据条件查询"
,
notes
=
"根据URL中的参数查询全部"
)
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
)
@GetMapping
(
value
=
"/queryTQestions"
)
public
Result
queryTQestion
(
TQuestion
tQuestion
)
{
tQuestion
.
setCreateBy
(
UserUtil
.
getUserInfoProp
(
getToken
(),
UserUtil
.
USER_ID
));
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
tQuestionServiceImpl
.
queryTQuestions
(
tQuestion
));
}
}
}
src/main/java/org/rcisoft/business/tquestion/dao/TQuestionRepository.java
View file @
e8b4830e
package
org
.
rcisoft
.
business
.
tquestion
.
dao
;
package
org
.
rcisoft
.
business
.
tquestion
.
dao
;
import
org.apache.ibatis.annotations.Insert
;
import
org.rcisoft.business.tquestion.entity.TQuestionOptions
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.rcisoft.business.tquestion.entity.TQuestion
;
import
org.rcisoft.business.tquestion.entity.TQuestion
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.ResultMap
;
...
@@ -26,6 +28,22 @@ public interface TQuestionRepository extends BaseMapper<TQuestion> {
...
@@ -26,6 +28,22 @@ public interface TQuestionRepository extends BaseMapper<TQuestion> {
+
"<if test=\"qtitle != null and qtitle != '' \">and qtitle LIKE CONCAT ('%',#{qtitle},'%')</if>"
+
"<if test=\"qtitle != null and qtitle != '' \">and qtitle LIKE CONCAT ('%',#{qtitle},'%')</if>"
+
"</script>"
)
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
TQuestion
>
queryTQuestionsByPagination
(
TQuestion
tQuestion
);
@Insert
(
"<script>INSERT INTO t_question_options (business_id,qid,alias,desc) VALUES "
+
"(#{businessId},#{qid},#{alias},#{slId})</script>"
)
void
insertQuestionOptions
(
TQuestionOptions
model
);
@Select
(
"<script>select * "
+
"from t_question tq"
+
"left join t_question_options tqo on tqo.business_id = tq.business_id"
+
"where 1=1"
+
"<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+
"<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+
"<if test=\"business_id != null and business_id != ''\">and business_id = #{business_id}</if>"
)
List
<
TQuestion
>
queryTQuestions
(
TQuestion
tQuestion
);
List
<
TQuestion
>
queryTQuestions
(
TQuestion
tQuestion
);
}
}
src/main/java/org/rcisoft/business/tquestion/entity/TQuestion.java
View file @
e8b4830e
...
@@ -34,6 +34,14 @@ public class TQuestion extends IdEntity<TQuestion> {
...
@@ -34,6 +34,14 @@ public class TQuestion extends IdEntity<TQuestion> {
private
String
qanswer
;
private
String
qanswer
;
@Transient
private
String
qid
;
@Transient
private
String
alias
;
private
String
desc
;
}
}
src/main/java/org/rcisoft/business/tquestion/service/TQuestionService.java
View file @
e8b4830e
...
@@ -48,6 +48,6 @@ public interface TQuestionService {
...
@@ -48,6 +48,6 @@ public interface TQuestionService {
TQuestion
tQuestion
);
TQuestion
tQuestion
);
List
<
TQuestion
>
queryTQuestions
(
TQuestion
tQuestion
);
}
}
src/main/java/org/rcisoft/business/tquestion/service/impl/TQuestionServiceImpl.java
View file @
e8b4830e
package
org
.
rcisoft
.
business
.
tquestion
.
service
.
impl
;
package
org
.
rcisoft
.
business
.
tquestion
.
service
.
impl
;
import
org.rcisoft.business.tquestion.entity.TQuestionOptions
;
import
org.rcisoft.core.constant.MessageConstant
;
import
org.rcisoft.core.util.UserUtil
;
import
org.rcisoft.core.util.UserUtil
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.model.PersistModel
;
...
@@ -38,10 +40,16 @@ public class TQuestionServiceImpl implements TQuestionService {
...
@@ -38,10 +40,16 @@ public class TQuestionServiceImpl implements TQuestionService {
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@Override
@Override
public
PersistModel
save
(
TQuestion
tQuestion
){
public
PersistModel
save
(
TQuestion
tQuestion
){
TQuestionOptions
tQuestionOptions
=
new
TQuestionOptions
();
tQuestion
.
setCommonBusinessId
();
tQuestion
.
setCommonBusinessId
();
//增加操作
//增加操作
UserUtil
.
setCurrentPersistOperation
(
tQuestion
);
UserUtil
.
setCurrentPersistOperation
(
tQuestion
);
int
line
=
tQuestionRepository
.
insertSelective
(
tQuestion
);
int
line
=
tQuestionRepository
.
insertSelective
(
tQuestion
);
//增加选项信息
tQuestionOptions
.
setQid
(
tQuestion
.
getQid
());
tQuestionOptions
.
setAlias
(
tQuestion
.
getAlias
());
tQuestionOptions
.
setDesc
(
tQuestion
.
getDesc
());
tQuestionRepository
.
insertQuestionOptions
(
tQuestionOptions
);
log
.
info
(
UserUtil
.
getUserInfoProp
(
tQuestion
.
getToken
(),
UserUtil
.
USER_USERNAME
)+
"新增了ID为"
+
log
.
info
(
UserUtil
.
getUserInfoProp
(
tQuestion
.
getToken
(),
UserUtil
.
USER_USERNAME
)+
"新增了ID为"
+
tQuestion
.
getBusinessId
()+
"的信息"
);
tQuestion
.
getBusinessId
()+
"的信息"
);
return
new
PersistModel
(
line
);
return
new
PersistModel
(
line
);
...
@@ -59,7 +67,7 @@ public class TQuestionServiceImpl implements TQuestionService {
...
@@ -59,7 +67,7 @@ public class TQuestionServiceImpl implements TQuestionService {
int
line
=
tQuestionRepository
.
logicalDelete
(
tQuestion
);
int
line
=
tQuestionRepository
.
logicalDelete
(
tQuestion
);
log
.
info
(
UserUtil
.
getUserInfoProp
(
tQuestion
.
getToken
(),
UserUtil
.
USER_USERNAME
)+
"逻辑删除了ID为"
+
log
.
info
(
UserUtil
.
getUserInfoProp
(
tQuestion
.
getToken
(),
UserUtil
.
USER_USERNAME
)+
"逻辑删除了ID为"
+
tQuestion
.
getBusinessId
()+
"的信息"
);
tQuestion
.
getBusinessId
()+
"的信息"
);
return
new
PersistModel
(
line
);
return
new
PersistModel
(
line
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
);
}
}
/**
/**
...
@@ -95,6 +103,11 @@ public class TQuestionServiceImpl implements TQuestionService {
...
@@ -95,6 +103,11 @@ public class TQuestionServiceImpl implements TQuestionService {
TQuestion
tQuestion
){
TQuestion
tQuestion
){
tQuestion
.
setStart
();
tQuestion
.
setStart
();
tQuestion
.
setNotDeleted
();
tQuestion
.
setNotDeleted
();
return
tQuestionRepository
.
queryTQuestionsByPagination
(
tQuestion
);
}
@Override
public
List
<
TQuestion
>
queryTQuestions
(
TQuestion
tQuestion
)
{
return
tQuestionRepository
.
queryTQuestions
(
tQuestion
);
return
tQuestionRepository
.
queryTQuestions
(
tQuestion
);
}
}
...
...
src/main/java/org/rcisoft/core/entity/IdEntity.java
View file @
e8b4830e
...
@@ -8,6 +8,7 @@ import org.rcisoft.core.util.IdGen;
...
@@ -8,6 +8,7 @@ import org.rcisoft.core.util.IdGen;
import
javax.persistence.Id
;
import
javax.persistence.Id
;
import
javax.persistence.MappedSuperclass
;
import
javax.persistence.MappedSuperclass
;
import
javax.persistence.Transient
;
import
java.io.Serializable
;
import
java.io.Serializable
;
/**
/**
...
@@ -28,6 +29,7 @@ public abstract class IdEntity<T> extends DataEntity<T> implements Serializable
...
@@ -28,6 +29,7 @@ public abstract class IdEntity<T> extends DataEntity<T> implements Serializable
@Id
@Id
protected
String
businessId
;
// 编号
protected
String
businessId
;
// 编号
@Transient
protected
String
token
;
protected
String
token
;
...
...
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