6 changed files with 206 additions and 0 deletions
-
84modules/cbam/src/main/java/com/thing/cbam/dict/controller/CbamCountryDictController.java
-
33modules/cbam/src/main/java/com/thing/cbam/dict/dto/CbamCountryDictDTO.java
-
48modules/cbam/src/main/java/com/thing/cbam/dict/entity/CbamCountryDictEntity.java
-
9modules/cbam/src/main/java/com/thing/cbam/dict/mapper/CbamCountryDictMapper.java
-
10modules/cbam/src/main/java/com/thing/cbam/dict/service/CbamCountryDictService.java
-
22modules/cbam/src/main/java/com/thing/cbam/dict/service/impl/CbamCountryDictServiceImpl.java
@ -0,0 +1,84 @@ |
|||||
|
package com.thing.cbam.dict.controller; |
||||
|
|
||||
|
import com.thing.cbam.dict.dto.CbamCountryDictDTO; |
||||
|
import com.thing.cbam.dict.service.CbamCountryDictService; |
||||
|
import com.thing.common.core.annotation.LogOperation; |
||||
|
import com.thing.common.core.constants.Constant; |
||||
|
import com.thing.common.core.validator.AssertUtils; |
||||
|
import com.thing.common.core.web.response.PageData; |
||||
|
import com.thing.common.core.web.response.Result; |
||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||
|
import io.swagger.v3.oas.annotations.Parameter; |
||||
|
import io.swagger.v3.oas.annotations.Parameters; |
||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("v2/cbam/country/dict") |
||||
|
@Tag(name = "国家字典表") |
||||
|
@RequiredArgsConstructor |
||||
|
public class CbamCountryDictController { |
||||
|
private final CbamCountryDictService cbamCountryDictService; |
||||
|
@GetMapping("page") |
||||
|
@Operation(summary = "分页") |
||||
|
@Parameters({ |
||||
|
@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true), |
||||
|
@Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true), |
||||
|
@Parameter(name = Constant.ORDER_FIELD, description = "排序字段"), |
||||
|
@Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)") |
||||
|
}) |
||||
|
public Result<PageData<CbamCountryDictDTO>> page(@Parameter(hidden = true) @RequestParam Map<String,Object> param) { |
||||
|
PageData<CbamCountryDictDTO> pageList = cbamCountryDictService.getPageData(param,CbamCountryDictDTO.class); |
||||
|
return new Result<PageData<CbamCountryDictDTO>>().ok(pageList); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
@Operation(summary = "信息") |
||||
|
public Result<CbamCountryDictDTO> get(@PathVariable("id") Long id) { |
||||
|
CbamCountryDictDTO dto = cbamCountryDictService.getByIdAs(id,CbamCountryDictDTO.class); |
||||
|
return new Result<CbamCountryDictDTO>().ok(dto); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
@Operation(summary = "保存") |
||||
|
@LogOperation("保存") |
||||
|
public Result<Void> save(@RequestBody CbamCountryDictDTO dto) { |
||||
|
cbamCountryDictService.saveDto(dto); |
||||
|
return new Result<>(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
@Operation(summary = "修改") |
||||
|
@LogOperation("修改") |
||||
|
public Result<Void> update(@RequestBody CbamCountryDictDTO dto) { |
||||
|
//效验数据 |
||||
|
//ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
cbamCountryDictService.updateDto(dto); |
||||
|
return new Result<>(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
@Operation(summary = "删除") |
||||
|
@LogOperation("删除") |
||||
|
public Result<Void> delete(@RequestBody Long[] ids) { |
||||
|
//效验数据 |
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
cbamCountryDictService.batchDelete(ids); |
||||
|
return new Result<>(); |
||||
|
} |
||||
|
@GetMapping("list") |
||||
|
@Operation(summary = "查询国家列表") |
||||
|
@Parameters({ |
||||
|
@Parameter(name = Constant.ORDER_FIELD, description = "排序字段") , |
||||
|
@Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)") |
||||
|
}) |
||||
|
public Result<List<CbamCountryDictDTO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> params){ |
||||
|
List<CbamCountryDictDTO> list = cbamCountryDictService.listAs(params, CbamCountryDictDTO.class); |
||||
|
return new Result<List<CbamCountryDictDTO>>().ok(list); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
package com.thing.cbam.dict.dto; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 国家字典表 |
||||
|
* |
||||
|
* @author xc |
||||
|
* @since 3.0 2024-12-04 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Schema(description = "国家字典表") |
||||
|
public class CbamCountryDictDTO implements Serializable { |
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@Schema(description = "主键") |
||||
|
private Long id; |
||||
|
@Schema(description = "国家名称") |
||||
|
private String name; |
||||
|
@Schema(description = "国家英文名称") |
||||
|
private String ename; |
||||
|
@Schema(description = "是否默认:0.默认 1.不默认") |
||||
|
private Integer isDefault; |
||||
|
@Schema(description = "排序") |
||||
|
private String sort; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
package com.thing.cbam.dict.entity; |
||||
|
|
||||
|
import com.mybatisflex.annotation.Id; |
||||
|
import com.mybatisflex.annotation.Table; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import lombok.experimental.Accessors; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 国家字典表 |
||||
|
* |
||||
|
* @author xc |
||||
|
* @since 3.0 2024-12-04 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Accessors(chain = true) |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@Table("cbam_country_dict") |
||||
|
public class CbamCountryDictEntity implements Serializable { |
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键 |
||||
|
*/ |
||||
|
@Id |
||||
|
private Long id; |
||||
|
/** |
||||
|
* 国家名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
/** |
||||
|
* 国家英文名称 |
||||
|
*/ |
||||
|
private String ename; |
||||
|
/** |
||||
|
* 是否默认:0.默认 1.不默认 |
||||
|
*/ |
||||
|
private Integer isDefault; |
||||
|
/** |
||||
|
* 排序 |
||||
|
*/ |
||||
|
private String sort; |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
package com.thing.cbam.dict.mapper; |
||||
|
|
||||
|
import com.thing.cbam.dict.entity.CbamCountryDictEntity; |
||||
|
import com.thing.common.orm.mapper.PowerBaseMapper; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface CbamCountryDictMapper extends PowerBaseMapper<CbamCountryDictEntity> { |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
package com.thing.cbam.dict.service; |
||||
|
|
||||
|
|
||||
|
import com.thing.cbam.dict.entity.CbamCountryDictEntity; |
||||
|
import com.thing.common.orm.service.IBaseService; |
||||
|
|
||||
|
|
||||
|
public interface CbamCountryDictService extends IBaseService<CbamCountryDictEntity> { |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.cbam.dict.service.impl; |
||||
|
|
||||
|
|
||||
|
import com.mybatisflex.core.query.QueryWrapper; |
||||
|
import com.thing.cbam.dict.dto.CbamCountryDictDTO; |
||||
|
import com.thing.cbam.dict.entity.CbamCountryDictEntity; |
||||
|
import com.thing.cbam.dict.mapper.CbamCountryDictMapper; |
||||
|
import com.thing.cbam.dict.service.CbamCountryDictService; |
||||
|
import com.thing.common.orm.service.impl.BaseServiceImpl; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Service |
||||
|
public class CbamCountryDictServiceImpl extends BaseServiceImpl<CbamCountryDictMapper, CbamCountryDictEntity> implements CbamCountryDictService { |
||||
|
@Override |
||||
|
public QueryWrapper getWrapper(Map<String, Object> params) { |
||||
|
QueryWrapper queryWrapper = new QueryWrapper(); |
||||
|
return queryWrapper; |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue