修改详情的项目图像和项目评价

hhw
杜函宇 1 month ago
parent 035a0535da
commit 5643e85503

@ -6,6 +6,8 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.gysl.entity.Xmpjqd; import com.ruoyi.gysl.entity.Xmpjqd;
import com.ruoyi.gysl.entity.request.XmpjqdPageReq; import com.ruoyi.gysl.entity.request.XmpjqdPageReq;
import com.ruoyi.gysl.entity.response.XmhxResponse;
import com.ruoyi.gysl.entity.response.XmpjqdOneResponse;
import com.ruoyi.gysl.service.XmpjqdService; import com.ruoyi.gysl.service.XmpjqdService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -34,63 +36,39 @@ public class XmpjqdController extends BaseController {
private XmpjqdService xmpjqdService; private XmpjqdService xmpjqdService;
/** /**
* *
* *
* @param page * @param page
* @return * @return
*/ */
@ApiOperation("分页查询所有目录") @ApiOperation("分页查询所有项目评价清单")
@GetMapping("/page") @GetMapping("/page")
public AjaxResult selectAll(Page<Xmpjqd> page, XmpjqdPageReq req) { public AjaxResult selectAll(Page<Xmpjqd> page, XmpjqdPageReq req) {
return success(xmpjqdService.page(page, req)); return success(xmpjqdService.page(page, req));
} }
/** /**
* *
* *
* @param id * @param id
* @return * @return
*/ */
@ApiOperation("通过主键查询单条数据") @ApiOperation(value = "通过主键查询单条项目评价清单",response = XmpjqdOneResponse.class)
@GetMapping("/{id}") @GetMapping("/{id}")
public AjaxResult selectOne(@PathVariable Serializable id) { public AjaxResult selectOne(@PathVariable Serializable id) {
return success(xmpjqdService.getById(id)); return success(xmpjqdService.selectOnePj(id));
} }
/** /**
* *
* *
* @param xmpjqd * @param id
* @return * @return
*/
@ApiOperation("新增数据")
@PostMapping("/add")
public AjaxResult insert(@RequestBody Xmpjqd xmpjqd) {
return success(xmpjqdService.save(xmpjqd));
}
/**
*
*
* @param xmpjqd
* @return
*/
@ApiOperation("修改数据")
@PutMapping("/edit")
public AjaxResult update(@RequestBody Xmpjqd xmpjqd) {
return success(xmpjqdService.updateById(xmpjqd));
}
/**
*
*
* @param idList
* @return
*/ */
@ApiOperation("删除数据") @ApiOperation(value = "通过主键查询单条项目画像",response = XmhxResponse.class)
@DeleteMapping("/delete") @GetMapping("/oneXmhx/{id}")
public AjaxResult delete(@RequestParam("idList") List<Long> idList) { public AjaxResult oneXmhx(@PathVariable Serializable id) {
return success(xmpjqdService.removeByIds(idList)); return success(xmpjqdService.oneXmhx(id));
} }
} }

@ -21,27 +21,25 @@ import java.time.LocalDate;
* @author makejava * @author makejava
* @since 2025-03-22 09:22:33 * @since 2025-03-22 09:22:33
*/ */
@EqualsAndHashCode(callSuper = true)
@Data @Data
@TableName("xmpjqd") @TableName("xmpjqd")
public class Xmpjqd extends BaseModel implements Serializable { public class Xmpjqd implements Serializable {
@ApiModelProperty(value = "主键id") @ApiModelProperty(value = "主键id")
@TableField("id") @TableField("id")
@TableId(type = IdType.AUTO)
private Long id; private Long id;
@ApiModelProperty(value = "项目名称") @ApiModelProperty(value = "项目名称")
private String xmmc; private String name;
@ApiModelProperty(value = "项目建设开始时间 yyyy-MM") @ApiModelProperty(value = "项目建设开始时间 yyyy-MM")
@DateTimeFormat(pattern = "yyyy-MM") @DateTimeFormat(pattern = "yyyy-MM")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM", timezone = "GMT+8")
private LocalDate xmqzsj; private LocalDate begainTime;
@ApiModelProperty(value = "项目建设结束时间 yyyy-MM") @ApiModelProperty(value = "项目建设结束时间 yyyy-MM")
@DateTimeFormat(pattern = "yyyy-MM") @DateTimeFormat(pattern = "yyyy-MM")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM", timezone = "GMT+8")
private LocalDate xmjssj; private LocalDate endTime;
@ApiModelProperty(value = "现状分类") @ApiModelProperty(value = "现状分类")
private Integer xzfl; private Integer xzfl;
@ -49,10 +47,10 @@ public class Xmpjqd extends BaseModel implements Serializable {
@ApiModelProperty(value = "评价等级") @ApiModelProperty(value = "评价等级")
private Integer pjdj; private Integer pjdj;
@ApiModelProperty(value = "项目法人单位") @ApiModelProperty(value = "总数")
private String xmfrdw; private Integer count;
@ApiModelProperty(value = "项目评价") @ApiModelProperty(value = "项目法人单位")
private String xmpj; private String xmfrdwxz;
} }

@ -22,16 +22,16 @@ public class XmpjqdPageReq {
private Integer pjdj; private Integer pjdj;
@ApiModelProperty(value = "项目名称") @ApiModelProperty(value = "项目名称")
private String xmmc; private String name;
@ApiModelProperty(value = "项目建设开始时间 yyyy-MM") @ApiModelProperty(value = "项目建设开始时间 yyyy-MM")
@DateTimeFormat(pattern = "yyyy-MM") @DateTimeFormat(pattern = "yyyy-MM")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM", timezone = "GMT+8")
private LocalDate xmqzsj; private LocalDate begainTime;
@ApiModelProperty(value = "项目建设结束时间 yyyy-MM") @ApiModelProperty(value = "项目建设结束时间 yyyy-MM")
@DateTimeFormat(pattern = "yyyy-MM") @DateTimeFormat(pattern = "yyyy-MM")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM", timezone = "GMT+8")
private LocalDate xmjssj; private LocalDate endTime;
} }

@ -0,0 +1,18 @@
package com.ruoyi.gysl.entity.response.XmhxDetail;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
* @author du
* @since 2025/3/28 16:05
*/
@Data
public class XmhxDetail {
@ApiModelProperty("要素名称")
private String ysmc;
@ApiModelProperty("具体数值")
private String pjpm;
}

@ -0,0 +1,22 @@
package com.ruoyi.gysl.entity.response;
import com.ruoyi.gysl.entity.response.XmhxDetail.XmhxDetail;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
*
* @author du
* @since 2025/3/28 15:53
*/
@Data
public class XmhxResponse {
@ApiModelProperty("分类 1最大值 2本项目 3中位数")
private Integer type;
@ApiModelProperty("具体数值")
private List<XmhxDetail> list;
}

@ -0,0 +1,22 @@
package com.ruoyi.gysl.entity.response;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
* @author du
* @since 2025/3/28 15:09
*/
@Data
public class XmpjqdOneResponse {
@ApiModelProperty("要素名称")
private String ysmc;
@ApiModelProperty("评价排名")
private Integer pjpm;
@ApiModelProperty("总数")
private String count;
}

@ -1,12 +1,15 @@
package com.ruoyi.gysl.mapper; package com.ruoyi.gysl.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.gysl.entity.Xmpjqd;
import com.ruoyi.gysl.entity.request.XmpjqdPageReq; import com.ruoyi.gysl.entity.request.XmpjqdPageReq;
import com.ruoyi.gysl.entity.response.XmhxDetail.XmhxDetail;
import com.ruoyi.gysl.entity.response.XmpjqdOneResponse;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.ruoyi.gysl.entity.Xmpjqd;
import java.io.Serializable;
import java.util.List;
/** /**
* (Xmpjqd)访 * (Xmpjqd)访
@ -23,5 +26,31 @@ public interface XmpjqdMapper extends BaseMapper<Xmpjqd> {
* @return * @return
*/ */
Page<Xmpjqd> page(Page<Xmpjqd> page, @Param("req") XmpjqdPageReq req); Page<Xmpjqd> page(Page<Xmpjqd> page, @Param("req") XmpjqdPageReq req);
/**
*
*
* @param id
* @return
*/
List<XmpjqdOneResponse> selectOnePj(@Param("id") Serializable id);
/**
*
*
* @param id
* @return
*/
List<XmhxDetail> oneXmhx(@Param("id") Serializable id);
/**
*
*/
List<XmhxDetail> zwsXmhx();
/**
*
*/
List<XmhxDetail> maxXmhx();
} }

@ -4,6 +4,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.gysl.entity.Xmpjqd; import com.ruoyi.gysl.entity.Xmpjqd;
import com.ruoyi.gysl.entity.request.XmpjqdPageReq; import com.ruoyi.gysl.entity.request.XmpjqdPageReq;
import com.ruoyi.gysl.entity.response.XmhxResponse;
import com.ruoyi.gysl.entity.response.XmpjqdOneResponse;
import java.io.Serializable;
import java.util.List;
/** /**
* (Xmpjqd) * (Xmpjqd)
@ -20,5 +25,21 @@ public interface XmpjqdService extends IService<Xmpjqd> {
* @return * @return
*/ */
Page<Xmpjqd> page(Page<Xmpjqd> page, XmpjqdPageReq req); Page<Xmpjqd> page(Page<Xmpjqd> page, XmpjqdPageReq req);
/**
*
*
* @param id
* @return
*/
List<XmpjqdOneResponse> selectOnePj(Serializable id);
/**
*
*
* @param id
* @return
*/
List<XmhxResponse> oneXmhx(Serializable id);
} }

@ -3,11 +3,18 @@ package com.ruoyi.gysl.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.gysl.entity.request.XmpjqdPageReq; import com.ruoyi.gysl.entity.request.XmpjqdPageReq;
import com.ruoyi.gysl.entity.response.XmhxResponse;
import com.ruoyi.gysl.entity.response.XmpjqdOneResponse;
import com.ruoyi.gysl.mapper.XmpjqdMapper; import com.ruoyi.gysl.mapper.XmpjqdMapper;
import com.ruoyi.gysl.entity.Xmpjqd; import com.ruoyi.gysl.entity.Xmpjqd;
import com.ruoyi.gysl.service.XmpjqdService; import com.ruoyi.gysl.service.XmpjqdService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/** /**
* (Xmpjqd) * (Xmpjqd)
* *
@ -17,6 +24,9 @@ import org.springframework.stereotype.Service;
@Service("xmpjqdService") @Service("xmpjqdService")
public class XmpjqdServiceImpl extends ServiceImpl<XmpjqdMapper, Xmpjqd> implements XmpjqdService { public class XmpjqdServiceImpl extends ServiceImpl<XmpjqdMapper, Xmpjqd> implements XmpjqdService {
@Resource
private XmpjqdMapper xmpjqdMapper;
/** /**
* *
* *
@ -25,7 +35,42 @@ public class XmpjqdServiceImpl extends ServiceImpl<XmpjqdMapper, Xmpjqd> impleme
*/ */
@Override @Override
public Page<Xmpjqd> page(Page<Xmpjqd> page, XmpjqdPageReq req) { public Page<Xmpjqd> page(Page<Xmpjqd> page, XmpjqdPageReq req) {
return baseMapper.page(page,req); return xmpjqdMapper.page(page,req);
}
/**
*
*
* @param id
* @return
*/
@Override
public List<XmpjqdOneResponse> selectOnePj(Serializable id) {
return xmpjqdMapper.selectOnePj(id);
}
/**
*
*
* @param id
* @return
*/
@Override
public List<XmhxResponse> oneXmhx(Serializable id) {
List<XmhxResponse> obj = new ArrayList<>();
XmhxResponse xr = new XmhxResponse();
xr.setType(1);
xr.setList(xmpjqdMapper.maxXmhx());
XmhxResponse xr1 = new XmhxResponse();
xr1.setType(2);
xr1.setList(xmpjqdMapper.oneXmhx(id));
XmhxResponse xr2 = new XmhxResponse();
xr2.setType(3);
xr2.setList(xmpjqdMapper.zwsXmhx());
obj.add(xr);
obj.add(xr1);
obj.add(xr2);
return obj;
} }
} }

@ -2,7 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.gysl.mapper.XmpjqdMapper"> <mapper namespace="com.ruoyi.gysl.mapper.XmpjqdMapper">
<select id="page" resultType="com.ruoyi.gysl.entity.Xmpjqd"> <select id="page" resultType="com.ruoyi.gysl.entity.Xmpjqd">
select * from xmpjqd SELECT
ROW_NUMBER() OVER (ORDER BY ztze DESC) AS pjdj,
a.id,
a.NAME,
a.begain_time,
a.end_time,
a.xzfl,
a.xmfrdwxz,
a.ztze,
COUNT(*) OVER () AS count
FROM basic_information a
<where> <where>
<if test="req.xzfl != null"> <if test="req.xzfl != null">
AND xzfl = #{req.xzfl} AND xzfl = #{req.xzfl}
@ -10,17 +20,68 @@
<if test="req.pjdj != null"> <if test="req.pjdj != null">
AND pjdj = #{req.pjdj} AND pjdj = #{req.pjdj}
</if> </if>
<if test="req.xmmc != null and req.xmmc != '' "> <if test="req.name != null and req.name != '' ">
AND xmmc like concat('%',#{req.xmmc},'%') AND name like concat('%',#{req.name},'%')
</if> </if>
<if test="req.xmqzsj != null"> <if test="req.begainTime != null">
AND xmqzsj = #{req.xmqzsj} AND begain_time = #{req.begainTime}
</if> </if>
<if test="req.xmjssj != null"> <if test="req.endTime != null">
AND xmjssj = #{req.xmjssj} AND end_time = #{req.endTime}
</if> </if>
</where> </where>
group by a.id
</select>
<select id="selectOnePj" resultType="com.ruoyi.gysl.entity.response.XmpjqdOneResponse">
SELECT
c.pjpm,
'总投资额' AS ysmc,
c.total_count AS count
FROM
(
SELECT
ROW_NUMBER() OVER ( ORDER BY a.ztze DESC ) AS pjpm,
a.id,
a.NAME,
a.begain_time,
a.end_time,
a.xzfl,
a.xmfrdwxz,
a.ztze,
COUNT(*) OVER () AS total_count
FROM
basic_information a
GROUP BY
a.id
) c
WHERE
c.id = #{id}
</select>
<select id="oneXmhx" resultType="com.ruoyi.gysl.entity.response.XmhxDetail.XmhxDetail">
select ztze as pjpm,
'总投资额' as ysmc
from basic_information
where id = #{id}
</select>
<select id="zwsXmhx" resultType="com.ruoyi.gysl.entity.response.XmhxDetail.XmhxDetail">
SELECT AVG(ztze) AS pjpm,
'总投资额' as ysmc
FROM (
SELECT
ztze,
ROW_NUMBER() OVER (ORDER BY ztze) AS row_num,
COUNT(*) OVER () AS total_rows
FROM basic_information
) AS ranked
WHERE row_num IN (
(total_rows + 1) DIV 2,
(total_rows + 2) DIV 2
)
</select>
<select id="maxXmhx" resultType="com.ruoyi.gysl.entity.response.XmhxDetail.XmhxDetail">
select MAX(ztze) as pjpm,
'总投资额' as ysmc
from basic_information
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save