Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
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
fangxinjiang
yifu-mvp
Commits
c6fe8a3f
Commit
c6fe8a3f
authored
Jan 03, 2023
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
B端服务添加:政策中心
parent
13292350
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
347 additions
and
0 deletions
+347
-0
TPolicy.java
.../java/com/yifu/cloud/plus/v1/business/entity/TPolicy.java
+86
-0
TPolicyController.java
.../cloud/plus/v1/business/controller/TPolicyController.java
+119
-0
TPolicyMapper.java
...com/yifu/cloud/plus/v1/business/mapper/TPolicyMapper.java
+27
-0
TPolicyService.java
...m/yifu/cloud/plus/v1/business/service/TPolicyService.java
+25
-0
TPolicyServiceImpl.java
...oud/plus/v1/business/service/impl/TPolicyServiceImpl.java
+31
-0
TPolicyMapper.xml
...-business-biz/src/main/resources/mapper/TPolicyMapper.xml
+59
-0
No files found.
yifu-business/yifu-business-api/src/main/java/com/yifu/cloud/plus/v1/business/entity/TPolicy.java
0 → 100644
View file @
c6fe8a3f
package
com
.
yifu
.
cloud
.
plus
.
v1
.
business
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
import
java.time.LocalDateTime
;
/**
* @Author fxj
* @Description B端-政策
* @Date 16:44 2023/1/3
* @Param
* @return
**/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@TableName
(
"t_policy"
)
@Tag
(
name
=
"B端-政策"
)
public
class
TPolicy
extends
Model
<
TPolicy
>
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@Schema
(
description
=
"主键"
,
name
=
"id"
)
private
String
id
;
/**
*
*/
@NotBlank
(
message
=
"标题不能为空"
)
@Length
(
max
=
200
,
message
=
"标题不能超过200个字符"
)
@ExcelAttribute
(
name
=
"标题"
,
isNotEmpty
=
true
,
errorInfo
=
"标题不能为空"
,
maxLength
=
200
)
@Schema
(
description
=
"标题"
,
name
=
"title"
)
private
String
title
;
/**
*
*/
@ExcelAttribute
(
name
=
"内容"
)
@Schema
(
description
=
"内容"
,
name
=
"content"
)
private
String
content
;
/**
* 省
*/
@ExcelAttribute
(
name
=
"省"
)
@Schema
(
description
=
"省"
,
name
=
"province"
)
private
Integer
province
;
/**
* 市
*/
@Length
(
max
=
200
,
message
=
"市不能超过200个字符"
)
@ExcelAttribute
(
name
=
"市"
,
maxLength
=
200
)
@Schema
(
description
=
"市"
,
name
=
"city"
)
private
String
city
;
/**
* 创建人
*/
@NotBlank
(
message
=
"创建人不能为空"
)
@Length
(
max
=
32
,
message
=
"创建人不能超过32个字符"
)
@ExcelAttribute
(
name
=
"创建人"
,
isNotEmpty
=
true
,
errorInfo
=
"创建人不能为空"
,
maxLength
=
32
)
@Schema
(
description
=
"创建人"
,
name
=
"createUser"
)
private
String
createUser
;
/**
* 创建时间
*/
@ExcelAttribute
(
name
=
"创建时间"
)
@Schema
(
description
=
"创建时间"
,
name
=
"createTime"
)
private
LocalDateTime
createTime
;
/**
* 阅读量
*/
@ExcelAttribute
(
name
=
"阅读量"
)
@Schema
(
description
=
"阅读量"
,
name
=
"readings"
)
private
Integer
readings
;
}
yifu-business/yifu-business-biz/src/main/java/com/yifu/cloud/plus/v1/business/controller/TPolicyController.java
0 → 100644
View file @
c6fe8a3f
package
com
.
yifu
.
cloud
.
plus
.
v1
.
business
.
controller
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.business.entity.TPolicy
;
import
com.yifu.cloud.plus.v1.business.service.TPolicyService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.AllArgsConstructor
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
java.time.LocalDateTime
;
/**
* B端-政策
*
* @author hgw
* @date 2020-8-27 11:31:42
*/
@RestController
@AllArgsConstructor
@RequestMapping
(
"/customerBusiness/tpolicy"
)
@Tag
(
name
=
"B端-政策"
)
public
class
TPolicyController
{
private
final
TPolicyService
tPolicyService
;
/**
* 简单分页查询
*
* @param page 分页对象
* @param tPolicy B端-政策
* @return
*/
@Operation
(
description
=
"简单分页查询"
)
@GetMapping
(
"/page"
)
public
R
<
IPage
<
TPolicy
>>
getTPolicyPage
(
Page
<
TPolicy
>
page
,
TPolicy
tPolicy
)
{
// 倒序
OrderItem
order
=
new
OrderItem
();
order
.
setColumn
(
"CREATE_TIME"
);
order
.
setAsc
(
false
);
page
.
addOrder
(
order
);
return
new
R
<>(
tPolicyService
.
getTPolicyPage
(
page
,
tPolicy
));
}
/**
* 通过id查询单条记录
*
* @param id
* @return R
*/
@Operation
(
description
=
"id查询"
)
@GetMapping
(
"/{id}"
)
public
R
<
TPolicy
>
getById
(
@PathVariable
(
"id"
)
String
id
)
{
TPolicy
policy
=
tPolicyService
.
getById
(
id
);
if
(
policy
!=
null
)
{
policy
.
setReadings
(
policy
.
getReadings
()
==
null
?
1
:
policy
.
getReadings
()
+
1
);
tPolicyService
.
updateById
(
policy
);
}
return
new
R
<>(
policy
);
}
/**
* 新增记录
*
* @param tPolicy
* @return R
*/
@Operation
(
description
=
"新增(wxhr:tpolicy_add)"
)
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('wxhr:tpolicy_add')"
)
public
R
<
Boolean
>
save
(
@RequestBody
TPolicy
tPolicy
)
{
if
(
Common
.
isEmpty
(
tPolicy
.
getTitle
()))
{
return
R
.
failed
(
"请输入标题!"
);
}
YifuUser
user
=
SecurityUtils
.
getUser
();
tPolicy
.
setCreateUser
(
String
.
valueOf
(
user
.
getId
()));
tPolicy
.
setCreateTime
(
LocalDateTime
.
now
());
return
new
R
<>(
tPolicyService
.
save
(
tPolicy
));
}
/**
* 修改记录
*
* @param tPolicy
* @return R
*/
@Operation
(
description
=
"修改(wxhr:tpolicy_edit)"
)
@SysLog
(
"修改B端-政策"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('wxhr:tpolicy_edit')"
)
public
R
<
Boolean
>
update
(
@RequestBody
TPolicy
tPolicy
)
{
return
new
R
<>(
tPolicyService
.
updateById
(
tPolicy
));
}
/**
* 通过id删除一条记录
*
* @param id
* @return R
*/
@Operation
(
description
=
"删除(wxhr:tpolicy_del)"
)
@SysLog
(
"删除B端-政策"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('wxhr:tpolicy_del')"
)
public
R
<
Boolean
>
removeById
(
@PathVariable
String
id
)
{
return
new
R
<>(
tPolicyService
.
removeById
(
id
));
}
}
yifu-business/yifu-business-biz/src/main/java/com/yifu/cloud/plus/v1/business/mapper/TPolicyMapper.java
0 → 100644
View file @
c6fe8a3f
package
com
.
yifu
.
cloud
.
plus
.
v1
.
business
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.business.entity.TPolicy
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* B端-政策
*
* @author hgw
* @date 2020-08-26 17:41:55
*/
@Mapper
public
interface
TPolicyMapper
extends
BaseMapper
<
TPolicy
>
{
/**
* B端-政策简单分页查询
*
* @param tPolicy B端-政策
* @return
*/
IPage
<
TPolicy
>
getTPolicyPage
(
Page
<
TPolicy
>
page
,
@Param
(
"tPolicy"
)
TPolicy
tPolicy
);
}
yifu-business/yifu-business-biz/src/main/java/com/yifu/cloud/plus/v1/business/service/TPolicyService.java
0 → 100644
View file @
c6fe8a3f
package
com
.
yifu
.
cloud
.
plus
.
v1
.
business
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.business.entity.TPolicy
;
/**
* B端-政策
*
* @author hgw
* @date 2020-08-26 17:41:55
*/
public
interface
TPolicyService
extends
IService
<
TPolicy
>
{
/**
* B端-政策简单分页查询
*
* @param tPolicy B端-政策
* @return
*/
IPage
<
TPolicy
>
getTPolicyPage
(
Page
<
TPolicy
>
page
,
TPolicy
tPolicy
);
}
yifu-business/yifu-business-biz/src/main/java/com/yifu/cloud/plus/v1/business/service/impl/TPolicyServiceImpl.java
0 → 100644
View file @
c6fe8a3f
package
com
.
yifu
.
cloud
.
plus
.
v1
.
business
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.business.entity.TPolicy
;
import
com.yifu.cloud.plus.v1.business.mapper.TPolicyMapper
;
import
com.yifu.cloud.plus.v1.business.service.TPolicyService
;
import
org.springframework.stereotype.Service
;
/**
* B端-政策
*
* @author hgw
* @date 2020-08-26 17:41:55
*/
@Service
(
"tPolicyService"
)
public
class
TPolicyServiceImpl
extends
ServiceImpl
<
TPolicyMapper
,
TPolicy
>
implements
TPolicyService
{
/**
* B端-政策简单分页查询
*
* @param tPolicy B端-政策
* @return
*/
@Override
public
IPage
<
TPolicy
>
getTPolicyPage
(
Page
<
TPolicy
>
page
,
TPolicy
tPolicy
)
{
return
baseMapper
.
getTPolicyPage
(
page
,
tPolicy
);
}
}
yifu-business/yifu-business-biz/src/main/resources/mapper/TPolicyMapper.xml
0 → 100644
View file @
c6fe8a3f
<?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.yifu.cloud.plus.v1.business.mapper.TPolicyMapper"
>
<resultMap
id=
"tPolicyMap"
type=
"com.yifu.cloud.plus.v1.business.entity.TPolicy"
>
<id
property=
"id"
column=
"ID"
/>
<result
property=
"title"
column=
"TITLE"
/>
<result
property=
"content"
column=
"CONTENT"
/>
<result
property=
"province"
column=
"PROVINCE"
/>
<result
property=
"city"
column=
"CITY"
/>
<result
property=
"createUser"
column=
"CREATE_USER"
/>
<result
property=
"createTime"
column=
"CREATE_TIME"
/>
<result
property=
"readings"
column=
"READINGS"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
a.ID,
a.TITLE,
a.CONTENT,
a.PROVINCE,
a.CITY,
a.CREATE_USER,
a.CREATE_TIME,
a.READINGS
</sql>
<sql
id=
"tPolicy_where"
>
<if
test=
"tPolicy != null"
>
<if
test=
"tPolicy.id != null and tPolicy.id.trim() != ''"
>
AND a.ID = #{tPolicy.id}
</if>
<if
test=
"tPolicy.title != null and tPolicy.title.trim() != ''"
>
AND a.TITLE = #{tPolicy.title}
</if>
<if
test=
"tPolicy.content != null and tPolicy.content.trim() != ''"
>
AND a.CONTENT = #{tPolicy.content}
</if>
<if
test=
"tPolicy.province != null"
>
AND a.PROVINCE = #{tPolicy.province}
</if>
<if
test=
"tPolicy.city != null and tPolicy.city.trim() != ''"
>
AND a.CITY like '%${tPolicy.city}%'
</if>
<if
test=
"tPolicy.createUser != null and tPolicy.createUser.trim() != ''"
>
AND a.CREATE_USER = #{tPolicy.createUser}
</if>
<if
test=
"tPolicy.createTime != null"
>
AND a.CREATE_TIME = #{tPolicy.createTime}
</if>
</if>
</sql>
<!--tPolicy简单分页查询-->
<select
id=
"getTPolicyPage"
resultMap=
"tPolicyMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM t_policy a
<where>
1=1
<include
refid=
"tPolicy_where"
/>
</where>
</select>
</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