Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
石磊
/
cihai
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0767928c
authored
Dec 07, 2017
by
侯昆
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
commit
1 parent
04701e41
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
155 additions
and
3 deletions
serverside/cihai-core/src/main/java/com/dookay/cihai/core/CihaiCoreApplication.java
serverside/cihai-core/src/main/java/com/dookay/cihai/core/word/domain/CustomDictionaryDomain.java
serverside/cihai-core/src/main/java/com/dookay/cihai/core/word/mapper/CustomDictionaryMapper.java
serverside/cihai-core/src/main/java/com/dookay/cihai/core/word/query/CustomDictionaryQuery.java
serverside/cihai-core/src/main/java/com/dookay/cihai/core/word/service/ICustomDictionaryService.java
serverside/cihai-core/src/main/java/com/dookay/cihai/core/word/service/impl/CustomDictionaryServiceImpl.java
serverside/cihai-core/src/main/resources/generator.xml
serverside/cihai-core/src/main/resources/mapper/CustomDictionaryMapper.xml
serverside/cihai-wechat/src/main/java/com/dookay/cihai/wechat/controller/HomeController.java
serverside/cihai-core/src/main/java/com/dookay/cihai/core/CihaiCoreApplication.java
View file @
0767928
package
com
.
dookay
.
cihai
.
core
;
import
com.dookay.coral.common.core.CoralCommonCoreMarker
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
...
...
@@ -12,7 +11,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
CoralCommonCoreMarker
.
class
,
CiHaiCoreApplication
.
class
})
@MapperScan
(
basePackageClasses
=
CiHaiCoreApplication
.
class
)
public
class
CiHaiCoreApplication
{
public
static
void
main
(
String
[]
args
)
{
...
...
serverside/cihai-core/src/main/java/com/dookay/cihai/core/word/domain/CustomDictionaryDomain.java
0 → 100644
View file @
0767928
package
com
.
dookay
.
cihai
.
core
.
word
.
domain
;
import
lombok.Data
;
import
java.io.Serializable
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.util.Date
;
import
java.util.List
;
/**
* 自定义词条
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
@Data
@Table
(
name
=
"t_custom_dictionary"
)
public
class
CustomDictionaryDomain
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@Id
private
Long
id
;
/**
*
*/
private
String
word
;
/**
*
*/
private
Date
createTime
;
/**
*
*/
private
Date
updateTime
;
}
serverside/cihai-core/src/main/java/com/dookay/cihai/core/word/mapper/CustomDictionaryMapper.java
0 → 100644
View file @
0767928
package
com
.
dookay
.
cihai
.
core
.
word
.
mapper
;
import
com.dookay.coral.common.core.persistence.Mapper
;
import
com.dookay.cihai.core.word.domain.CustomDictionaryDomain
;
/**
* 自定义词条
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public
interface
CustomDictionaryMapper
extends
Mapper
<
CustomDictionaryDomain
>
{
}
serverside/cihai-core/src/main/java/com/dookay/cihai/core/word/query/CustomDictionaryQuery.java
0 → 100644
View file @
0767928
package
com
.
dookay
.
cihai
.
core
.
word
.
query
;
import
com.dookay.coral.common.core.persistence.Query
;
import
lombok.Data
;
import
tk.mybatis.mapper.entity.Example
;
import
com.dookay.coral.common.core.persistence.criteria.QueryCriteria
;
import
com.dookay.cihai.core.word.domain.CustomDictionaryDomain
;
/**
* 自定义词条
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
@Data
public
class
CustomDictionaryQuery
extends
Query
{
private
String
word
;
@Override
public
QueryCriteria
toCriteria
()
{
QueryCriteria
queryCriteria
=
new
QueryCriteria
(
CustomDictionaryDomain
.
class
);
Example
.
Criteria
criteria
=
queryCriteria
.
createCriteria
();
if
(
valid
(
word
))
{
criteria
.
andEqualTo
(
"word"
);
}
//todo 写查询逻辑
return
queryCriteria
;
}
}
serverside/cihai-core/src/main/java/com/dookay/cihai/core/word/service/ICustomDictionaryService.java
0 → 100644
View file @
0767928
package
com
.
dookay
.
cihai
.
core
.
word
.
service
;
import
com.dookay.coral.common.core.service.IBaseService
;
import
com.dookay.cihai.core.word.domain.CustomDictionaryDomain
;
/**
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public
interface
ICustomDictionaryService
extends
IBaseService
<
CustomDictionaryDomain
>
{
}
serverside/cihai-core/src/main/java/com/dookay/cihai/core/word/service/impl/CustomDictionaryServiceImpl.java
0 → 100644
View file @
0767928
package
com
.
dookay
.
cihai
.
core
.
word
.
service
.
impl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.dookay.coral.common.core.service.impl.BaseServiceImpl
;
import
com.dookay.cihai.core.word.mapper.CustomDictionaryMapper
;
import
com.dookay.cihai.core.word.domain.CustomDictionaryDomain
;
import
com.dookay.cihai.core.word.service.ICustomDictionaryService
;
/**
* 自定义词条
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
@SuppressWarnings
(
"ALL"
)
@Service
(
"customDictionaryService"
)
public
class
CustomDictionaryServiceImpl
extends
BaseServiceImpl
<
CustomDictionaryDomain
>
implements
ICustomDictionaryService
{
@Autowired
private
CustomDictionaryMapper
customDictionaryMapper
;
}
serverside/cihai-core/src/main/resources/generator.xml
View file @
0767928
...
...
@@ -24,6 +24,9 @@
<property
name=
"smallint"
value=
"Boolean"
/>
</javaTypeResolver>
<table
tableName=
"t_custom_dictionary"
domainObjectName=
"CustomDictionary"
packageName=
"com.dookay.cihai.core.word"
desc=
"自定义字典"
author=
"wangwei"
>
</table>
<table
tableName=
"t_word"
domainObjectName=
"Word"
packageName=
"com.dookay.cihai.core.word"
desc=
"词条"
author=
"wangwei"
>
</table>
...
...
serverside/cihai-core/src/main/resources/mapper/CustomDictionaryMapper.xml
0 → 100644
View file @
0767928
<?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.dookay.cihai.core.word.mapper.CustomDictionaryMapper"
>
<!-- 公共查询语句 -->
<sql
id=
"selectSql"
>
select
<trim
suffixOverrides=
","
>
a.`id` as 'id',
a.`word` as 'word',
a.`create_time` as 'createTime',
a.`update_time` as 'updateTime',
</trim>
from
`t_custom_dictionary` as a
</sql>
</mapper>
\ No newline at end of file
serverside/cihai-wechat/src/main/java/com/dookay/cihai/wechat/controller/HomeController.java
View file @
0767928
...
...
@@ -18,8 +18,11 @@ import com.dookay.cihai.core.aip.AipWordUtilBean;
import
com.dookay.cihai.core.theme.domain.ThemeDomain
;
import
com.dookay.cihai.core.theme.query.ThemeQuery
;
import
com.dookay.cihai.core.theme.service.IThemeService
;
import
com.dookay.cihai.core.word.domain.CustomDictionaryDomain
;
import
com.dookay.cihai.core.word.domain.WordDomain
;
import
com.dookay.cihai.core.word.query.CustomDictionaryQuery
;
import
com.dookay.cihai.core.word.query.WordQuery
;
import
com.dookay.cihai.core.word.service.ICustomDictionaryService
;
import
com.dookay.cihai.core.word.service.IWordService
;
import
com.dookay.coral.common.web.controller.BaseController
;
import
com.dookay.coral.common.web.response.JsonResult
;
...
...
@@ -43,6 +46,8 @@ public class HomeController extends BaseController {
@Autowired
private
IThemeService
themeService
;
@Autowired
private
ICustomDictionaryService
customDictionaryService
;
@Autowired
private
AipWordUtilBean
aipWordUtilBean
;
...
...
@@ -70,7 +75,7 @@ public class HomeController extends BaseController {
try
{
String
result
=
aipWordUtilBean
.
extractQueryKeyword
(
keyword
);
ThemeQuery
query
=
new
ThemeQuery
();
query
.
setKeyword
(
keyword
);
query
.
setKeyword
(
result
);
ThemeDomain
themeDomain
=
themeService
.
getFirst
(
query
);
if
(
themeDomain
==
null
)
return
errorResult
(
"暂无检索结果"
);
System
.
out
.
println
(
themeDomain
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment