22 changed files with 1912 additions and 1 deletions
@ -0,0 +1,61 @@
|
||||
package com.biutag.supervisiondata.config.db; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType; |
||||
import com.baomidou.mybatisplus.core.config.GlobalConfig; |
||||
import com.baomidou.mybatisplus.core.toolkit.GlobalConfigUtils; |
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; |
||||
import com.zaxxer.hikari.HikariDataSource; |
||||
import org.apache.ibatis.session.SqlSessionFactory; |
||||
import org.mybatis.spring.annotation.MapperScan; |
||||
import org.springframework.beans.factory.annotation.Qualifier; |
||||
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
import org.springframework.boot.jdbc.DataSourceBuilder; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; |
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
||||
|
||||
import javax.sql.DataSource; |
||||
|
||||
@Configuration |
||||
@MapperScan(basePackages = {"com.biutag.supervisiondata.mapper.dm"}, |
||||
sqlSessionFactoryRef = "dmSqlSessionFactory") |
||||
public class Dm { |
||||
|
||||
@Bean(name = "dmBean") |
||||
@ConfigurationProperties(prefix = "spring.datasource.dm") |
||||
public DataSource dmDataSource() { |
||||
return DataSourceBuilder.create().type(HikariDataSource.class).build(); |
||||
} |
||||
|
||||
@Bean(name = "dmTransactionManager") |
||||
public DataSourceTransactionManager dmTransactionManager() { |
||||
return new DataSourceTransactionManager(dmDataSource()); |
||||
} |
||||
|
||||
@Bean(name = "dmSqlSessionFactory") |
||||
public SqlSessionFactory dmSqlSessionFactory(@Qualifier("dmBean") DataSource mysqlDataSource, |
||||
@Qualifier("dmInterceptor") MybatisPlusInterceptor mybatisPlusInterceptor) throws Exception { |
||||
final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean(); |
||||
sessionFactory.setPlugins(mybatisPlusInterceptor); |
||||
sessionFactory.setDataSource(mysqlDataSource); |
||||
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); |
||||
sessionFactory.setMapperLocations(resolver.getResources("classpath:mapper/dm/*Mapper.xml")); |
||||
GlobalConfig globalConfig = GlobalConfigUtils.defaults(); |
||||
sessionFactory.setGlobalConfig(globalConfig); |
||||
return sessionFactory.getObject(); |
||||
} |
||||
|
||||
/** |
||||
* mp分页配置 |
||||
* @return MybatisPlusInterceptor |
||||
*/ |
||||
@Bean(name = "dmInterceptor") |
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() { |
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.GBASE)); |
||||
return interceptor; |
||||
} |
||||
} |
||||
@ -0,0 +1,15 @@
|
||||
package com.biutag.supervisiondata.mapper.dm; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.biutag.supervisiondata.pojo.entity.mine.ModelClue; |
||||
import org.apache.ibatis.annotations.Select; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public interface ModelClueDataDMMapper extends BaseMapper<ModelClue> { |
||||
|
||||
@Select("${newSql}") |
||||
List<Map<String, Object>> selectByUniqueKeys(@org.apache.ibatis.annotations.Param("newSql") String newSql); |
||||
|
||||
} |
||||
@ -0,0 +1,19 @@
|
||||
package com.biutag.supervisiondata.mapper.dwd; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.biutag.supervisiondata.pojo.entity.mine.ModelClue; |
||||
import org.apache.ibatis.annotations.Select; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public interface ModelClueDataMapper extends BaseMapper<ModelClue> { |
||||
@Select("${sql}") |
||||
List<ModelClue> selectDataByDynamicSql(@org.apache.ibatis.annotations.Param("sql") String sql); |
||||
|
||||
@Select("${newSql}") |
||||
List<Map<String, Object>> selectByUniqueKeys(@org.apache.ibatis.annotations.Param("newSql") String newSql); |
||||
|
||||
@Select("SELECT XM, JH FROM dwd_ry_zfba_baryxx WHERE ZJ = #{barID}") |
||||
Map<String, Object> selectBAR(String barID); |
||||
} |
||||
@ -0,0 +1,25 @@
|
||||
package com.biutag.supervisiondata.mapper.mine; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.biutag.supervisiondata.pojo.entity.mine.ModelClue; |
||||
import com.biutag.supervisiondata.pojo.entity.mine.ModelClueModel; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Select; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public interface ModelClueMapper extends BaseMapper<ModelClue> { |
||||
|
||||
Page<ModelClueModel> queryPage(@Param("page") Page<ModelClue> page, @Param(Constants.WRAPPER) QueryWrapper<ModelClue> queryWrapper); |
||||
|
||||
@Select("${newSql}") |
||||
List<Map<String, Object>> selectByUniqueKeys(@org.apache.ibatis.annotations.Param("newSql") String newSql); |
||||
|
||||
List<ModelClue> selectByModelId(@Param("modelId") int modelId); |
||||
|
||||
int updateInvolveDepartId(@Param("id") int id, @Param("newDepartId") String newDepartId); |
||||
} |
||||
@ -0,0 +1,7 @@
|
||||
package com.biutag.supervisiondata.mapper.mine; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.biutag.supervisiondata.pojo.entity.mine.ModelClueRecord; |
||||
|
||||
public interface ModelClueRecordMapper extends BaseMapper<ModelClueRecord> { |
||||
} |
||||
@ -0,0 +1,7 @@
|
||||
package com.biutag.supervisiondata.mapper.mine; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.biutag.supervisiondata.pojo.entity.mine.StatisticsDepart; |
||||
|
||||
public interface StatisticsDepartMapper extends BaseMapper<StatisticsDepart> { |
||||
} |
||||
@ -0,0 +1,102 @@
|
||||
package com.biutag.supervisiondata.pojo.entity.mine; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.time.LocalDateTime; |
||||
|
||||
@Setter |
||||
@Getter |
||||
public class ModelClue { |
||||
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO) |
||||
private Integer id; |
||||
|
||||
//
|
||||
@TableField("model_id") |
||||
private Integer modelId; |
||||
|
||||
// 涉及单位
|
||||
@TableField("involve_depart_name") |
||||
private String involveDepartName; |
||||
|
||||
@TableField("involve_depart_id") |
||||
private String involveDepartId; |
||||
|
||||
// 涉及人员
|
||||
@TableField("involve_police_name") |
||||
private String involvePoliceName; |
||||
|
||||
// 涉及人员警号
|
||||
@TableField("involve_police_emp_no") |
||||
private String involvePoliceEmpNo; |
||||
|
||||
// 预警内容
|
||||
@TableField("thing_desc") |
||||
private String thingDesc; |
||||
|
||||
// 状态 默认 0-未分发 1-已分发 2-已处理
|
||||
@TableField("distribution_state") |
||||
private String distributionState; |
||||
|
||||
@TableField("create_time") |
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm") |
||||
private LocalDateTime createTime; |
||||
|
||||
@TableField("update_time") |
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm") |
||||
private LocalDateTime updateTime; |
||||
|
||||
// 数据详情 JSON
|
||||
private String data; |
||||
|
||||
// 问题ID
|
||||
@TableField("negative_id") |
||||
private String negativeId; |
||||
@TableField("notification_id") |
||||
private String notificationId; |
||||
|
||||
// 问题ID
|
||||
@TableField("negative_id_ex") |
||||
private String negativeIdEx; |
||||
|
||||
// 外部主键
|
||||
@TableField("unique_key") |
||||
private String uniqueKey; |
||||
|
||||
// 任务ID
|
||||
private Integer taskId; |
||||
|
||||
|
||||
// 总警情数
|
||||
@TableField(exist = false) |
||||
private Long zjjs; |
||||
|
||||
// 104号模型用
|
||||
@TableField(exist = false) |
||||
private Long allZjjs; |
||||
|
||||
// 执法场所登记数
|
||||
@TableField(exist = false) |
||||
private Long zfcsdjs; |
||||
|
||||
// 比例
|
||||
@TableField(exist = false) |
||||
private BigDecimal bl; |
||||
|
||||
@TableField(exist = false) |
||||
private String parentId; |
||||
|
||||
@TableField(exist = false) |
||||
private String thisId; |
||||
|
||||
@TableField(exist = false) |
||||
private Integer departLevel; |
||||
|
||||
} |
||||
@ -0,0 +1,15 @@
|
||||
package com.biutag.supervisiondata.pojo.entity.mine; |
||||
|
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
@Setter |
||||
@Getter |
||||
public class ModelClue18 { |
||||
private String zhrq; |
||||
private String zhdd; |
||||
private String ajbh; |
||||
private String zhr; |
||||
private String badwIDdm; |
||||
private String badwIDmc; |
||||
} |
||||
@ -0,0 +1,46 @@
|
||||
package com.biutag.supervisiondata.pojo.entity.mine; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.time.LocalDateTime; |
||||
|
||||
@Setter |
||||
@Getter |
||||
public class ModelClueModel { |
||||
private Integer id; |
||||
|
||||
private Integer modelId; |
||||
|
||||
private String modelName; |
||||
|
||||
private String involveDepartId; |
||||
// 涉及单位
|
||||
private String involveDepartName; |
||||
|
||||
private String involveParentDepartName; |
||||
|
||||
// 涉及人员
|
||||
private String involvePoliceName; |
||||
|
||||
// 涉及人员警号
|
||||
private String involvePoliceEmpNo; |
||||
|
||||
// 预警内容
|
||||
private String thingDesc; |
||||
|
||||
// 分发状态
|
||||
private String distributionState; |
||||
|
||||
@JsonFormat(pattern = "YYYY-MM-dd HH:mm") |
||||
private LocalDateTime createTime; |
||||
|
||||
private String data; |
||||
|
||||
private String negativeId; |
||||
|
||||
private String notificationId; |
||||
|
||||
private String status; |
||||
} |
||||
@ -0,0 +1,42 @@
|
||||
package com.biutag.supervisiondata.pojo.entity.mine; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
import java.time.LocalDateTime; |
||||
|
||||
@Accessors(chain = true) |
||||
@Setter |
||||
@Getter |
||||
public class ModelClueRecord { |
||||
|
||||
//
|
||||
@TableId(type = IdType.AUTO) |
||||
private Integer id; |
||||
|
||||
// 模型ID
|
||||
private Integer modelId; |
||||
|
||||
// 条数
|
||||
@TableField("size") |
||||
private Integer size; |
||||
|
||||
// 创建时间
|
||||
@TableField("create_time") |
||||
@JsonFormat(pattern = "YYYY-MM-dd HH:mm") |
||||
private LocalDateTime createTime; |
||||
|
||||
// 状态 success-成功 fail-失败
|
||||
@TableField("state") |
||||
private String state; |
||||
|
||||
// 异常详情
|
||||
@TableField("err_msg") |
||||
private String errMsg; |
||||
|
||||
} |
||||
@ -0,0 +1,44 @@
|
||||
package com.biutag.supervisiondata.pojo.entity.mine; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
@Setter |
||||
@Getter |
||||
public class StatisticsDepart { |
||||
|
||||
//
|
||||
@TableId(value = "departId") |
||||
private String departId; |
||||
|
||||
//
|
||||
@TableField("name") |
||||
private String name; |
||||
|
||||
//
|
||||
@TableField("level") |
||||
private Integer level; |
||||
|
||||
//
|
||||
@TableField("groupId") |
||||
private Long groupId; |
||||
|
||||
//
|
||||
@TableField("pid") |
||||
private String pid; |
||||
|
||||
// 总人数
|
||||
@TableField("total") |
||||
private Integer total; |
||||
|
||||
// 警察人数
|
||||
@TableField("policeNumber") |
||||
private Integer policeNumber; |
||||
|
||||
// 辅警人数
|
||||
@TableField("auxiliaryPoliceNumber") |
||||
private Integer auxiliaryPoliceNumber; |
||||
|
||||
} |
||||
@ -0,0 +1,21 @@
|
||||
package com.biutag.supervisiondata.repository; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.biutag.supervisiondata.mapper.dm.ModelClueDataDMMapper; |
||||
import com.biutag.supervisiondata.pojo.entity.mine.ModelClue; |
||||
import lombok.RequiredArgsConstructor; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@RequiredArgsConstructor |
||||
@Service |
||||
public class ModelClueDataDMRepository extends ServiceImpl<ModelClueDataDMMapper, ModelClue> { |
||||
|
||||
private final ModelClueDataDMMapper modelClueDataDMMapper; |
||||
|
||||
public List<Map<String, Object>> selectByUniqueKeys(String sql) { |
||||
return modelClueDataDMMapper.selectByUniqueKeys(sql); |
||||
} |
||||
} |
||||
@ -0,0 +1,10 @@
|
||||
package com.biutag.supervisiondata.repository; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.biutag.supervisiondata.mapper.mine.ModelClueRecordMapper; |
||||
import com.biutag.supervisiondata.pojo.entity.mine.ModelClueRecord; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service |
||||
public class ModelClueRecordRepository extends ServiceImpl<ModelClueRecordMapper, ModelClueRecord> { |
||||
} |
||||
@ -0,0 +1,10 @@
|
||||
package com.biutag.supervisiondata.repository; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.biutag.supervisiondata.mapper.mine.ModelClueMapper; |
||||
import com.biutag.supervisiondata.pojo.entity.mine.ModelClue; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service |
||||
public class ModelClueRepository extends ServiceImpl<ModelClueMapper, ModelClue> { |
||||
} |
||||
@ -0,0 +1,10 @@
|
||||
package com.biutag.supervisiondata.repository; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.biutag.supervisiondata.mapper.mine.StatisticsDepartMapper; |
||||
import com.biutag.supervisiondata.pojo.entity.mine.StatisticsDepart; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service |
||||
public class StatisticsDepartRepository extends ServiceImpl<StatisticsDepartMapper, StatisticsDepart> { |
||||
} |
||||
@ -0,0 +1,4 @@
|
||||
package com.biutag.supervisiondata.service; |
||||
|
||||
public interface ModelClueService { |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,24 @@
|
||||
<?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.biutag.supervisiondata.mapper.mine.ModelClueMapper"> |
||||
|
||||
<select id="queryPage" resultType="com.biutag.supervisiondata.pojo.entity.mine.ModelClueModel"> |
||||
select *, m.model_name, d1.short_name involve_parent_depart_name from model_clue mc |
||||
left join model m on mc.model_id = m.id |
||||
left join sup_depart d on mc.involve_depart_id = d.id |
||||
left join sup_depart d1 on d.pid = d1.id |
||||
${ew.getCustomSqlSegment} |
||||
</select> |
||||
|
||||
<select id="selectByModelId" resultType="com.biutag.supervisiondata.pojo.entity.mine.ModelClue"> |
||||
SELECT * FROM model_clue WHERE model_id = #{modelId} |
||||
</select> |
||||
|
||||
<update id="updateInvolveDepartId"> |
||||
UPDATE model_clue SET involve_depart_id = #{newDepartId} WHERE id = #{id} |
||||
</update> |
||||
|
||||
|
||||
</mapper> |
||||
Loading…
Reference in new issue