Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
dc9add1d
Commit
dc9add1d
authored
Jun 27, 2022
by
翁国栋
Committed by
284718418@qq.com
Mar 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
8小时后台--
投保需求变更,需要在被保险人信息组增加省市区
parent
a8485e19
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
217 additions
and
1 deletions
+217
-1
src/main/java/cn/timer/api/bean/insure/InsureProvince.java
+54
-0
src/main/java/cn/timer/api/controller/insure/InsureApplicantController.java
+27
-1
src/main/java/cn/timer/api/dao/insure/InsureProvinceMapper.java
+18
-0
src/main/resources/mapping/insure/InsureProvinceMapper.xml
+118
-0
No files found.
src/main/java/cn/timer/api/bean/insure/InsureProvince.java
0 → 100644
View file @
dc9add1d
package
cn
.
timer
.
api
.
bean
.
insure
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 省市区
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-06-27 15:09:26
*/
@Entity
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table
(
name
=
"insure_province"
)
@ApiModel
(
"省市区"
)
public
class
InsureProvince
extends
Model
<
InsureProvince
>
{
private
static
final
long
serialVersionUID
=
4347130709431957277L
;
@Id
private
Integer
id
;
/**
* 名字
*/
private
String
name
;
/**
* 值
*/
private
Integer
pid
;
/**
* 值
*/
private
Integer
value
;
}
src/main/java/cn/timer/api/controller/insure/InsureApplicantController.java
View file @
dc9add1d
package
cn
.
timer
.
api
.
controller
.
insure
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.Random
;
import
cn.hutool.core.lang.tree.Tree
;
import
cn.hutool.core.lang.tree.TreeNodeConfig
;
import
cn.hutool.core.lang.tree.TreeUtil
;
import
cn.timer.api.bean.insure.InsureApplicant
;
import
cn.timer.api.bean.insure.InsureProvince
;
import
cn.timer.api.bean.qyzx.QyzxEntInfoM
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
...
...
@@ -93,7 +98,6 @@ public class InsureApplicantController {
insureApplicant
.
setApplicantType
(
"2"
);
insureApplicant
.
setApplicantENoType
(
"3646"
);
insureApplicant
.
setApplicantENo
(
qyzxEntInfoM
.
getCreditCode
());
insureApplicant
.
setApplicantProvinceCity
(
"21721"
);
return
insureApplicant
;
}
...
...
@@ -115,5 +119,27 @@ public class InsureApplicantController {
throw
new
CustomException
(
"获取投保人异常"
);
}
}
@GetMapping
(
"/getProvince"
)
@ApiOperation
(
value
=
"获取投保省市区"
,
httpMethod
=
"GET"
,
notes
=
"获取投保人"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
Object
>
getRegion
(){
List
<
InsureProvince
>
nodeList
=
InsureProvince
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
InsureProvince
>().
lambda
().
isNotNull
(
InsureProvince:
:
getId
));
// 配置
TreeNodeConfig
treeNodeConfig
=
new
TreeNodeConfig
();
// 自定义属性名 都要默认值的
treeNodeConfig
.
setIdKey
(
"id"
);
treeNodeConfig
.
setParentIdKey
(
"parentId"
);
// 最大递归深度
treeNodeConfig
.
setDeep
(
4
);
List
<
Tree
<
String
>>
treeNodes
=
TreeUtil
.
build
(
nodeList
,
"0"
,
treeNodeConfig
,
(
treeNode
,
tree
)
->
{
tree
.
setId
(
treeNode
.
getId
().
toString
());
tree
.
setParentId
(
treeNode
.
getPid
().
toString
());
tree
.
setName
(
treeNode
.
getName
());
tree
.
putExtra
(
"value"
,
treeNode
.
getValue
());
});
return
ResultUtil
.
data
(
treeNodes
);
}
}
src/main/java/cn/timer/api/dao/insure/InsureProvinceMapper.java
0 → 100644
View file @
dc9add1d
package
cn
.
timer
.
api
.
dao
.
insure
;
import
cn.timer.api.bean.insure.InsureProvince
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.springframework.stereotype.Repository
;
/**
* 省市区
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-06-27 15:09:26
*/
@Repository
public
interface
InsureProvinceMapper
extends
BaseMapper
<
InsureProvince
>
{
}
src/main/resources/mapping/insure/InsureProvinceMapper.xml
0 → 100644
View file @
dc9add1d
<?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=
"cn.timer.api.dao.insure.InsureProvinceMapper"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"cn.timer.api.bean.insure.InsureProvince"
id=
"insureProvinceMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"pid"
column=
"pid"
/>
<result
property=
"value"
column=
"value"
/>
</resultMap>
<select
id=
"queryObject"
resultType=
"cn.timer.api.bean.insure.InsureProvince"
>
select *
from insure_province
where id = #{value}
</select>
<select
id=
"queryList"
resultType=
"cn.timer.api.bean.insure.InsureProvince"
>
select * from insure_province
<where>
<if
test=
"name != null and name != ''"
>
AND `name` = #{name}
</if>
<if
test=
"pid != null and pid != ''"
>
AND `pid` = #{pid}
</if>
<if
test=
"value != null and value != ''"
>
AND `value` = #{value}
</if>
</where>
<choose>
<when
test=
"sidx != null and sidx.trim() != ''"
>
order by ${sidx} ${order}
</when>
<otherwise>
order by id desc
</otherwise>
</choose>
<if
test=
"offset != null and limit != null"
>
limit #{offset}, #{limit}
</if>
</select>
<select
id=
"queryTotal"
resultType=
"int"
>
select count(*) from insure_province
<where>
<if
test=
"name != null and name != ''"
>
AND `name` = #{name}
</if>
<if
test=
"pid != null and pid != ''"
>
AND `pid` = #{pid}
</if>
<if
test=
"value != null and value != ''"
>
AND `value` = #{value}
</if>
</where>
</select>
<insert
id=
"save"
parameterType=
"cn.timer.api.bean.insure.InsureProvince"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into insure_province
(`name`,
`pid`,
`value`)
values (#{name},
#{pid},
#{value})
</insert>
<insert
id=
"saveSelective"
parameterType=
"cn.timer.api.bean.insure.InsureProvince"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into insure_province
(
<if
test=
"name != null"
>
,`name`
</if>
<if
test=
"pid != null"
>
,`pid`
</if>
<if
test=
"value != null"
>
,`value`
</if>
)
values
(
<if
test=
"name != null"
>
,#{name}
</if>
<if
test=
"pid != null"
>
,#{pid}
</if>
<if
test=
"value != null"
>
,#{value}
</if>
)
</insert>
<insert
id=
"saveList"
parameterType=
"cn.timer.api.bean.insure.InsureProvince"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into insure_province
(
`name`,
`pid`,
`value`
)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.name},
#{item.pid},
#{item.value}
)
</foreach>
</insert>
<update
id=
"update"
parameterType=
"cn.timer.api.bean.insure.InsureProvince"
>
update insure_province
<set>
<if
test=
"name != null"
>
`name` = #{name},
</if>
<if
test=
"pid != null"
>
`pid` = #{pid},
</if>
<if
test=
"value != null"
>
`value` = #{value}
</if>
</set>
where id = #{id}
</update>
<delete
id=
"delete"
>
delete
from insure_province
where id = #{value}
</delete>
<delete
id=
"deleteBatch"
>
delete from insure_province where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
</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