Преглед изворни кода

修改sql语法不兼容

tags/24080901
WendyYang пре 1 година
родитељ
комит
ac420f4e24
15 измењених фајлова са 120 додато и 52 уклоњено
  1. +1
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/config/BeanConfig.java
  2. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/common/constant/BizConst.java
  3. +17
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/constant/BooleanBit.java
  4. +58
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/handler/BooleanBitTypeHandler.java
  5. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/mapper/CockpitStatsMapper.xml
  6. +4
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertMapper.xml
  7. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.xml
  8. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.java
  9. +6
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml
  10. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml
  11. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java
  12. +17
    -24
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectServiceImpl.java
  13. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/ResourceMapper.xml
  14. +2
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/config/RedisSessionConfig.java
  15. +5
    -5
      hz-pm-api/src/main/resources/application-dev.yml

+ 1
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/config/BeanConfig.java Прегледај датотеку

@@ -108,4 +108,5 @@ public class BeanConfig {
.setRetryHandler(new DefaultHttpRequestRetryHandler(2, true))
.build();
}

}

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/common/constant/BizConst.java Прегледај датотеку

@@ -19,7 +19,7 @@ public interface BizConst {
*/
String LIMIT_1 = "limit 1";

String COOKIE_KEY = "ND_PROJECT_MANAGEMENT_JSESSION";
String COOKIE_KEY = "HZPM_SESSION";

/**
* 一小时秒数


+ 17
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/constant/BooleanBit.java Прегледај датотеку

@@ -0,0 +1,17 @@
package com.hz.pm.api.common.constant;

/**
* <p>
* BooleanBit
* </p>
*
* @author WendyYang
* @since 16:12 2023/12/15
*/
public interface BooleanBit {

int TRUE = 1;

int FALSE = 0;

}

+ 58
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/handler/BooleanBitTypeHandler.java Прегледај датотеку

@@ -0,0 +1,58 @@
package com.hz.pm.api.common.handler;


import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;

import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
* <p>
* BooleanBitTypeHandler
* </p>
*
* @author WendyYang
* @since 15:39 2023/12/15
*/
@Slf4j
@MappedJdbcTypes(value = JdbcType.BIT)
@MappedTypes(value = {Boolean.class, boolean.class})
public class BooleanBitTypeHandler extends BaseTypeHandler<Boolean> {

public BooleanBitTypeHandler() {
log.info(this.getClass().getSimpleName());
}

@Override
public void setNonNullParameter(PreparedStatement ps, int i, Boolean parameter, JdbcType jdbcType) throws SQLException {
if (parameter == null) {
ps.setInt(i, 1);
} else {
ps.setInt(i, parameter ? 1 : 0);
}
}

@Override
public Boolean getNullableResult(ResultSet rs, String columnName) throws SQLException {
Byte man = rs.getObject(columnName, Byte.class);
return man == null ? null : (man == 1);
}

@Override
public Boolean getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
Byte man = rs.getObject(columnIndex, Byte.class);
return man == null ? null : (man == 1);
}

@Override
public Boolean getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
Byte man = cs.getObject(columnIndex, Byte.class);
return man == null ? null : (man == 1);
}
}

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/mapper/CockpitStatsMapper.xml Прегледај датотеку

@@ -15,7 +15,7 @@
sum(CASE WHEN a.password_grade = 5 THEN 1 ELSE 0 end) monitorPasswordGrade5Num
FROM nd_project_application a
LEFT JOIN nd_project p ON a."project_code" = p."project_code" AND a."project_version" = p.version
WHERE p."newest" = TRUE
WHERE p."newest" = 1
<if test="regionCode != null and regionCode != 'TOTAL'">
AND p."area_code" =#{regionCode}
</if>


+ 4
- 4
hz-pm-api/src/main/java/com/hz/pm/api/meeting/mapper/MeetingExpertMapper.xml Прегледај датотеку

@@ -84,11 +84,11 @@
<sql id="reviewedByHeadman">
<if test="p.reviewed">
exists(select 1 from nd_expert_review ner where ner.meeting_id = m.id and ner.project_id = np.id and ner.create_by =
me.expert_id and is_final = true)
me.expert_id and is_final = 1)
</if>
<if test="!p.reviewed">
not exists(select 1 from nd_expert_review ner where ner.meeting_id = m.id and ner.project_id = np.id and ner.create_by =
me.expert_id and is_final = true)
me.expert_id and is_final = 1)
</if>
</sql>

@@ -111,9 +111,9 @@
from nd_project np inner join meeting_inner_project mip on mip.project_id = np.id
inner join meeting m on m.id = mip.meeting_id
inner join meeting_expert me on m.id = me.meeting_id
where m.is_inner_project = true and m.status != 3 and me.status = 3 and m.confirmed_roster = true
where m.is_inner_project = 1 and m.status != 3 and me.status = 3 and m.confirmed_roster = 1
<if test="p.reviewed != null">
and if(me.is_headman,<include refid="reviewedByHeadman"/>,<include refid="reviewedByNotHeadman"/>)
and if(me.is_headman,'<include refid="reviewedByHeadman"/>','<include refid="reviewedByNotHeadman"/>')
</if>
and me.expert_id = #{p.userId}
<if test="p.projectName != null and p.projectName.length > 0">


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.xml Прегледај датотеку

@@ -16,7 +16,7 @@
sum(p.approval_amount) approvalAmount
FROM
nd_project p
WHERE build_org_code = #{orgCode} and project_year = #{year} and newest = true
WHERE build_org_code = #{orgCode} and project_year = #{year} and newest = 1
</select>

<select id="getRegionStatistics" resultType="com.hz.pm.api.projectdeclared.model.po.DeclaredProjectStatisticsPO">
@@ -33,6 +33,6 @@
sum(p.approval_amount) approvalAmount
FROM
nd_project p
WHERE area_code = #{regionCode} and project_year = #{year} and newest = true
WHERE area_code = #{regionCode} and project_year = #{year} and newest = 1
</select>
</mapper>

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.java Прегледај датотеку

@@ -19,5 +19,5 @@ public interface ProjectMapper extends BaseMapper<Project> {

Page<ProjectPO> pageAllWithPermission(Page<ProjectPO> page, @Param("req") ProjectListReq req);

Page<ProjectPO> pagelibWithPermission(Page<ProjectPO> page, @Param("req") ProjectListReq req);
Page<ProjectPO> pageLibWithPermission(Page<ProjectPO> page, @Param("req") ProjectListReq req);
}

+ 6
- 6
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml Прегледај датотеку

@@ -49,7 +49,7 @@
create_on,
update_on
FROM nd_project p
WHERE p.newest = TRUE
WHERE p.newest = 1
<if test="req.id != null">
and p.id = #{req.id}
</if>
@@ -140,7 +140,7 @@
FROM gov_biz_project_baseinfo b
LEFT JOIN gov_biz_project_apply apply ON b.base_proj_id = apply.base_proj_id
LEFT JOIN gov_biz_project_approve approve ON b.base_proj_id = approve.base_proj_id
WHERE b.deleted = false
WHERE b.deleted = 0
<if test="req.id != null">
and b.id = #{req.id}
</if>
@@ -231,7 +231,7 @@
FROM gov_operation_project_baseinfo b
LEFT JOIN gov_biz_project_apply apply ON b.base_proj_id = apply.base_proj_id
LEFT JOIN gov_biz_project_approve approve ON b.base_proj_id = approve.base_proj_id
WHERE b.deleted = false
WHERE b.deleted = 0
<if test="req.id != null">
and b.id = #{req.id}
</if>
@@ -298,7 +298,7 @@
) ORDER BY update_on DESC
</select>

<select id="pagelibWithPermission" resultType="com.hz.pm.api.projectlib.model.po.ProjectPO"
<select id="pageLibWithPermission" resultType="com.hz.pm.api.projectlib.model.po.ProjectPO"
parameterType="com.hz.pm.api.projectlib.model.req.ProjectListReq">
SELECT
from_type,
@@ -346,7 +346,7 @@
create_on,
update_on
FROM nd_project p
WHERE p.newest = TRUE
WHERE p.newest = 1
<if test="req.id != null">
and p.id = #{req.id}
</if>
@@ -437,7 +437,7 @@
FROM gov_operation_project_baseinfo b
LEFT JOIN gov_biz_project_apply apply ON b.base_proj_id = apply.base_proj_id
LEFT JOIN gov_biz_project_approve approve ON b.base_proj_id = approve.base_proj_id
WHERE b.deleted = false and b.base_proj_type in ('04','05')
WHERE b.deleted = 0 and b.base_proj_type in ('04','05')
<if test="req.id != null">
and b.id = #{req.id}
</if>


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml Прегледај датотеку

@@ -21,10 +21,10 @@
else ob.base_build_deprt end) build_org_name,
prfd.project_code
from nd_project_renewal_fund_declaration prfd
left join nd_project p on prfd.project_code = p.project_code and p.newest = true
left join nd_project p on prfd.project_code = p.project_code and p.newest = 1
left join gov_biz_project_baseinfo b on prfd.project_code = b.base_proj_id and b.deleted = false
left join gov_operation_project_baseinfo ob on prfd.project_code = ob.base_proj_id and ob.deleted = false
where prfd.deleted = false
where prfd.deleted = 0
<if test="param.projectName != null and param.projectName != ''">
and (p.project_name like concat('%',#{param.projectName},'%') or
b.base_proj_name like concat('%',#{param.projectName},'%') or


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java Прегледај датотеку

@@ -19,8 +19,8 @@ import java.time.LocalDateTime;
* @since 2023-02-03
*/
@Data
@TableName("nd_project")
@ApiModel(value = "NdProject对象", description = "")
@TableName(value = "nd_project")
@ApiModel(value = "NdProject对象")
public class Project implements Serializable {

private static final long serialVersionUID = 1L;


+ 17
- 24
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectServiceImpl.java Прегледај датотеку

@@ -4,15 +4,14 @@ import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hz.pm.api.common.constant.BizConst;
import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.common.constant.BooleanBit;
import com.hz.pm.api.projectlib.mapper.ProjectMapper;
import com.hz.pm.api.projectlib.model.entity.ProjectApplication;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.po.ProjectPO;
import com.hz.pm.api.projectlib.model.req.ProjectListReq;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@@ -23,7 +22,7 @@ import java.util.stream.Collectors;

/**
* <p>
* 服务实现类
* 服务实现类
* </p>
*
* @author WendyYang
@@ -43,21 +42,18 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
List<Project> projects = list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectCode, projectCode));

if(CollUtil.isEmpty(projects)){
if (CollUtil.isEmpty(projects)) {
return Collections.emptyList();
}

return projects.stream().map(Project::getId).collect(Collectors.toList());
}

@Override
public List<Long> getAllVersionProjectId(Long projectId) {
Project project = getById(projectId);

if(Objects.isNull(project)){
return null;
if (Objects.isNull(project)) {
return Collections.emptyList();
}

return getAllVersionProjectId(project);
}

@@ -65,7 +61,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
public Project getNewProject(Long projectId) {
Project project = getById(projectId);

if(Objects.isNull(project)){
if (Objects.isNull(project)) {
return null;
}

@@ -75,47 +71,44 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
.eq(Project::getNewest, Boolean.TRUE)
.eq(Project::getProjectCode, projectCode)
.last(BizConst.LIMIT_1);
Project newest = getOne(last);

return newest;
return getOne(last);
}

@Override
public Project getNewConstructProject(Long projectId) {
Project project = getById(projectId);

if(Objects.isNull(project)){
if (Objects.isNull(project)) {
return null;
}

String projectCode = project.getProjectCode();

LambdaQueryWrapper<Project> last = Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, Boolean.TRUE)
.eq(Project::getNewest, BooleanBit.TRUE)
.eq(Project::getProjectCode, projectCode)
.eq(Project::getIsConstruct, Boolean.TRUE)
.eq(Project::getIsConstruct, BooleanBit.TRUE)
.last(BizConst.LIMIT_1);
Project newest = getOne(last);

return newest;
return getOne(last);
}

@Override
public Project getProjectByCode(String projectCode) {
Project project = this.getOne(Wrappers.lambdaQuery(Project.class)
return this.getOne(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectCode, projectCode)
.eq(Project::getNewest,Boolean.TRUE)
.eq(Project::getNewest, BooleanBit.TRUE)
.last(BizConst.LIMIT_1));
return project;
}

@Override
public Page<ProjectPO> pageAllWithPermission(Page<ProjectPO> page, ProjectListReq req) {
return projectMapper.pageAllWithPermission(page,req);
return projectMapper.pageAllWithPermission(page, req);
}

@Override
public Page<ProjectPO> pagelibWithPermission(Page<ProjectPO> page, ProjectListReq req) {
return projectMapper.pagelibWithPermission(page,req);
return projectMapper.pageLibWithPermission(page, req);
}
}

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/ResourceMapper.xml Прегледај датотеку

@@ -30,7 +30,7 @@
and id in (
SELECT authority_id FROM nd_role_authority ra INNER JOIN nd_user_role ur on ra.role_id = ur.role_id
INNER JOIN c_role r on r.id = ra.role_id
where ur.user_id = #{userId, jdbcType=BIGINT} and r.`state` = true
where ur.user_id = #{userId, jdbcType=BIGINT} and r.`state` = 1
and ra.authority_type = 'RESOURCE'
)
</select>


+ 2
- 3
hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/config/RedisSessionConfig.java Прегледај датотеку

@@ -13,9 +13,8 @@ import org.springframework.session.web.http.DefaultCookieSerializer;
* 设置session的过期时间为一天
* </p>
*
* @Author LiuXinXin
* @Date 2020/7/29 9:46 上午
* @Version 1.0
* @author LiuXinXin
* @since 2020/7/29 9:46 上午
**/
@Configuration
@EnableRedisHttpSession


+ 5
- 5
hz-pm-api/src/main/resources/application-dev.yml Прегледај датотеку

@@ -1,5 +1,5 @@
server:
port: 68888
port: 8002
servlet:
context-path: /hzpm

@@ -16,7 +16,7 @@ spring:
timeout: 5000
host: 47.98.125.47
port: 26379
database: 4
database: 5
password: Ndkj1234
jedis:
pool:
@@ -25,7 +25,7 @@ spring:
min-idle: 8
max-wait: 10000
application:
name: pm
name: hzpm
jackson:
default-property-inclusion: non_null
time-zone: GMT+8
@@ -74,8 +74,8 @@ mybatis-plus:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
logic-delete-value: true
logic-not-delete-value: false
logic-delete-value: 1
logic-not-delete-value: 0
logging:
config: classpath:logback-spring.xml
#日志配置


Loading…
Откажи
Сачувај