10 changed files with 331 additions and 4 deletions
@ -0,0 +1,58 @@ |
|||
package com.kms.yg.znjg.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.kms.yg.znjg.domain.SyLayerStyle; |
|||
import com.kms.yg.znjg.qo.SyLayerStyleQo; |
|||
import com.kms.yg.znjg.service.SyLayerStyleService; |
|||
import com.kms.yxgh.base.Response; |
|||
import com.shuili.common.core.domain.SearchParam; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 图层样式管理 |
|||
* |
|||
* @author huangzhiy |
|||
* @create 2023-07-06 17:02 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/map/layer/style") |
|||
@Api(tags = "图层样式管理") |
|||
public class SyLayerStyleManagerController { |
|||
|
|||
private final SyLayerStyleService syLayerStyleService; |
|||
|
|||
/** |
|||
* 根据id查询样式信息 |
|||
* |
|||
* @param id 主键id |
|||
* @return |
|||
*/ |
|||
@GetMapping("findById/{id}") |
|||
@ApiOperation("根据id查询样式信息") |
|||
public Response<SyLayerStyle> getById(@PathVariable("id") String id) { |
|||
return Response.ok(syLayerStyleService.getById(id)); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 分页查询图层样式信息 |
|||
* |
|||
* @param spLayerStyleQo |
|||
* @return |
|||
*/ |
|||
@PostMapping("layerStylePage") |
|||
@ApiOperation("分页查询图层样式信息") |
|||
public IPage<SyLayerStyle> getLayerStylePage(@RequestBody SearchParam<SyLayerStyleQo> spLayerStyleQo) { |
|||
SyLayerStyleQo syLayerStyleInfo = spLayerStyleQo.getData(); |
|||
Page<SyLayerStyle> page = new Page<>(spLayerStyleQo.getPageNum(), spLayerStyleQo.getPageSize()); |
|||
Map<String, Object> params = spLayerStyleQo.getParams(); |
|||
return syLayerStyleService.selectPage(page, syLayerStyleInfo, params); |
|||
} |
|||
} |
@ -0,0 +1,73 @@ |
|||
package com.kms.yg.znjg.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 图层样式 |
|||
* @author huangzhiy |
|||
* @TableName bs_sgc_qqjd_layer_style |
|||
*/ |
|||
@TableName(value ="bs_sgc_qqjd_layer_style") |
|||
@Data |
|||
public class SyLayerStyle { |
|||
|
|||
/** |
|||
* 主键id |
|||
*/ |
|||
@TableId |
|||
private String id; |
|||
|
|||
/** |
|||
* 样式名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 图层类型 |
|||
*/ |
|||
private String layerType; |
|||
|
|||
/** |
|||
* 样式信息 |
|||
*/ |
|||
private String information; |
|||
|
|||
/** |
|||
* 样式备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 试用类型 |
|||
*/ |
|||
private String styleType; |
|||
|
|||
/** |
|||
* 样式图片Url |
|||
*/ |
|||
private String viewImg; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
|
|||
/** |
|||
* 修改时间 |
|||
*/ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date modifyTime; |
|||
|
|||
@TableField(exist = false) |
|||
private static final long serialVersionUID = 1L; |
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.kms.yg.znjg.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.kms.yg.znjg.domain.SyLayerStyle; |
|||
import com.kms.yg.znjg.qo.SyLayerStyleQo; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* @author huangzhiy |
|||
* @description 针对表【bs_sgc_qqjd_layer_style】的数据库操作Mapper |
|||
* @createDate 2023-07-06 17:01:54 |
|||
* @Entity com.sy.layerstylemanager.domain.SyLayerStyleQo |
|||
*/ |
|||
@Mapper |
|||
public interface SyLayerStyleMapper extends BaseMapper<SyLayerStyle> { |
|||
|
|||
Page<SyLayerStyle> findSyLayerList(@Param("page") Page<SyLayerStyle> page, @Param("syLayerStyle") SyLayerStyleQo syLayerStyleInfo, @Param("orderBy") String orderBy, @Param("sortBy") String sortBy); |
|||
} |
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,53 @@ |
|||
package com.kms.yg.znjg.qo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* 图层样式Qo |
|||
* @author huangzhiy |
|||
* @TableName bs_sgc_qqjd_layer_style |
|||
*/ |
|||
@Data |
|||
public class SyLayerStyleQo implements Serializable { |
|||
|
|||
/** |
|||
* 主键id |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 样式名称 |
|||
*/ |
|||
@NotBlank(message = "样式名称不能为空") |
|||
private String name; |
|||
|
|||
/** |
|||
* 图层类型 |
|||
*/ |
|||
private String layerType; |
|||
|
|||
/** |
|||
* 样式信息 |
|||
*/ |
|||
private String information; |
|||
|
|||
/** |
|||
* 样式备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 适用类型 |
|||
*/ |
|||
private String styleType; |
|||
|
|||
/** |
|||
* 样式图片Url |
|||
*/ |
|||
private String viewImg; |
|||
|
|||
} |
@ -0,0 +1,67 @@ |
|||
package com.kms.yg.znjg.service; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.kms.yg.znjg.domain.SyLayerStyle; |
|||
import com.kms.yg.znjg.mapper.SyLayerStyleMapper; |
|||
import com.kms.yg.znjg.qo.SyLayerStyleQo; |
|||
import com.kms.yxgh.util.BeanCopyUtils; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import java.util.Date; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author huangzhiy |
|||
* @description 针对表【bs_sgc_qqjd_layer_style】的数据库操作Service实现 |
|||
* @createDate 2023-07-06 17:01:54 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
public class SyLayerStyleService extends ServiceImpl<SyLayerStyleMapper, SyLayerStyle> { |
|||
|
|||
private final SyLayerStyleMapper baseMapper; |
|||
|
|||
|
|||
public Boolean add(SyLayerStyleQo syLayerStyleQo, String viwImgUrl) { |
|||
SyLayerStyle syLayerStyle = BeanCopyUtils.copy(syLayerStyleQo, SyLayerStyle.class); |
|||
syLayerStyle.setCreateTime(new Date()); |
|||
syLayerStyle.setViewImg(viwImgUrl); |
|||
return baseMapper.insert(syLayerStyle) > 0; |
|||
} |
|||
|
|||
|
|||
|
|||
public SyLayerStyle getById(String id) { |
|||
return baseMapper.selectById(id); |
|||
} |
|||
|
|||
|
|||
public Boolean deleteById(String id) { |
|||
baseMapper.deleteById(id); |
|||
return true; |
|||
} |
|||
|
|||
public IPage<SyLayerStyle> selectPage(Page<SyLayerStyle> page, SyLayerStyleQo syLayerStyleInfo, Map<String, Object> params) { |
|||
String orderBy = ""; |
|||
String sortBy = ""; |
|||
if (params != null) { |
|||
if (params.get("orderBy") != null) { |
|||
orderBy = (String) params.get("orderBy"); |
|||
} |
|||
if (params.get("sortBy") != null) { |
|||
sortBy = (String) params.get("sortBy"); |
|||
} |
|||
} |
|||
baseMapper.findSyLayerList(page, syLayerStyleInfo, orderBy, sortBy); |
|||
return page; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,48 @@ |
|||
<?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.kms.yg.znjg.mapper.SyLayerStyleMapper"> |
|||
|
|||
<resultMap id="BaseResultMap" type="com.kms.yg.znjg.domain.SyLayerStyle"> |
|||
<id property="id" column="id" jdbcType="VARCHAR"/> |
|||
<result property="name" column="name" jdbcType="VARCHAR"/> |
|||
<result property="layerType" column="layer_type" jdbcType="VARCHAR"/> |
|||
<result property="information" column="information" jdbcType="VARCHAR"/> |
|||
<result property="remark" column="remark" jdbcType="VARCHAR"/> |
|||
<result property="styleType" column="style_type" jdbcType="VARCHAR"/> |
|||
<result property="viewImg" column="view_img" jdbcType="VARCHAR"/> |
|||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
|||
<result property="modifyTime" column="modify_time" jdbcType="TIMESTAMP"/> |
|||
</resultMap> |
|||
|
|||
<sql id="Base_Column_List"> |
|||
id |
|||
,name,layer_type, |
|||
information,remark,style_type, |
|||
view_img,create_time,modify_time |
|||
</sql> |
|||
<select id="findSyLayerList" resultType="com.kms.yg.znjg.domain.SyLayerStyle"> |
|||
select |
|||
<include refid="Base_Column_List"/> |
|||
from bs_sgc_qqjd_layer_style |
|||
where is_valid = 1 |
|||
<if test="syLayerStyle.name != null and syLayerStyle.name != ''"> |
|||
AND name LIKE CONCAT(CONCAT('%', TRIM(#{syLayerStyle.name,jdbcType=VARCHAR})), '%') |
|||
</if> |
|||
<if test="syLayerStyle.layerType != null and syLayerStyle.layerType != ''"> |
|||
AND layer_type LIKE CONCAT(CONCAT('%', TRIM(#{syLayerStyle.layerType,jdbcType=VARCHAR})), '%') |
|||
</if> |
|||
order by |
|||
<if test="orderBy !=null and orderBy != '' "> |
|||
<choose> |
|||
<when test="orderBy =='name'"> |
|||
CONVERT(name USING gb2312) ${sortBy} |
|||
</when> |
|||
<otherwise> |
|||
${orderBy} ${sortBy} |
|||
</otherwise> |
|||
</choose> |
|||
</if> |
|||
</select> |
|||
</mapper> |
Loading…
Reference in new issue