oying-system/src/main/java/com/oying/modules/system/domain/Merchant.java | ●●●●● patch | view | raw | blame | history | |
oying-system/src/main/java/com/oying/modules/system/mapper/MerchantMapper.java | ●●●●● patch | view | raw | blame | history | |
oying-system/src/main/java/com/oying/modules/system/rest/MerchantController.java | ●●●●● patch | view | raw | blame | history | |
oying-system/src/main/java/com/oying/modules/system/service/MerchantService.java | ●●●●● patch | view | raw | blame | history | |
oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java | ●●●●● patch | view | raw | blame | history | |
oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantsServiceImpl.java | ●●●●● patch | view | raw | blame | history | |
oying-system/src/main/resources/mapper/system/MerchantMapper.xml | ●●●●● patch | view | raw | blame | history |
oying-system/src/main/java/com/oying/modules/system/domain/Merchant.java
File was renamed from oying-system/src/main/java/com/oying/modules/system/domain/Merchants.java @@ -20,12 +20,12 @@ **/ @Getter @Setter @TableName("sys_merchants") public class Merchants extends BaseEntity implements Serializable { @TableName("sys_merchant") public class Merchant extends BaseEntity implements Serializable { @TableId(value = "merchants_id", type = IdType.AUTO) @TableId(value = "merchant_id", type = IdType.AUTO) @ApiModelProperty(value = "ID") private Long merchantsId; private Long merchantId; @NotBlank @ApiModelProperty(value = "名称") @@ -48,21 +48,21 @@ private String contactMobile; @ApiModelProperty(value = "排序") private Integer merchantsSort; private Integer merchantSort; @ApiModelProperty(value = "状态") private String enabled = "1"; @ApiModelProperty(value = "审核人") private String authUser; private String auditUser; @ApiModelProperty(value = "审核时间") private Timestamp authTime; private Timestamp auditTime; @ApiModelProperty(value = "审核信息") private String authMessage; private String auditMessage; public void copy(Merchants source){ public void copy(Merchant source){ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); } } oying-system/src/main/java/com/oying/modules/system/mapper/MerchantMapper.java
File was renamed from oying-system/src/main/java/com/oying/modules/system/mapper/MerchantsMapper.java @@ -1,6 +1,6 @@ package com.oying.modules.system.mapper; import com.oying.modules.system.domain.Merchants; import com.oying.modules.system.domain.Merchant; import com.oying.modules.system.domain.dto.MerchantsQueryCriteria; import java.util.List; import org.apache.ibatis.annotations.Param; @@ -14,9 +14,9 @@ * @date 2025-05-29 **/ @Mapper public interface MerchantsMapper extends BaseMapper<Merchants> { public interface MerchantMapper extends BaseMapper<Merchant> { IPage<Merchants> findAll(@Param("criteria") MerchantsQueryCriteria criteria, Page<Object> page); IPage<Merchant> findAll(@Param("criteria") MerchantsQueryCriteria criteria, Page<Object> page); List<Merchants> findAll(@Param("criteria") MerchantsQueryCriteria criteria); List<Merchant> findAll(@Param("criteria") MerchantsQueryCriteria criteria); } oying-system/src/main/java/com/oying/modules/system/rest/MerchantController.java
File was renamed from oying-system/src/main/java/com/oying/modules/system/rest/MerchantsController.java @@ -1,8 +1,8 @@ package com.oying.modules.system.rest; import com.oying.annotation.Log; import com.oying.modules.system.domain.Merchants; import com.oying.modules.system.service.MerchantsService; import com.oying.modules.system.domain.Merchant; import com.oying.modules.system.service.MerchantService; import com.oying.modules.system.domain.dto.MerchantsQueryCriteria; import lombok.RequiredArgsConstructor; import java.util.List; @@ -24,50 +24,50 @@ @RestController @RequiredArgsConstructor @Api(tags = "系统:商户信息") @RequestMapping("/api/merchants") public class MerchantsController { @RequestMapping("/api/merchant") public class MerchantController { private final MerchantsService merchantsService; private final MerchantService merchantService; @ApiOperation("导出数据") @GetMapping(value = "/download") @PreAuthorize("@el.check('merchants:list')") @PreAuthorize("@el.check('merchant:list')") public void exportMerchants(HttpServletResponse response, MerchantsQueryCriteria criteria) throws IOException { merchantsService.download(merchantsService.queryAll(criteria), response); merchantService.download(merchantService.queryAll(criteria), response); } @GetMapping @ApiOperation("查询商户信息") @PreAuthorize("@el.check('merchants:list')") public ResponseEntity<PageResult<Merchants>> queryMerchants(MerchantsQueryCriteria criteria){ @PreAuthorize("@el.check('merchant:list')") public ResponseEntity<PageResult<Merchant>> queryMerchants(MerchantsQueryCriteria criteria){ Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); return new ResponseEntity<>(merchantsService.queryAll(criteria,page),HttpStatus.OK); return new ResponseEntity<>(merchantService.queryAll(criteria,page),HttpStatus.OK); } @PostMapping @Log("新增商户信息") @ApiOperation("新增商户信息") @PreAuthorize("@el.check('merchants:add')") public ResponseEntity<Object> createMerchants(@Validated @RequestBody Merchants resources){ merchantsService.create(resources); @PreAuthorize("@el.check('merchant:add')") public ResponseEntity<Object> createMerchants(@Validated @RequestBody Merchant resources){ merchantService.create(resources); return new ResponseEntity<>(HttpStatus.CREATED); } @PutMapping @Log("修改商户信息") @ApiOperation("修改商户信息") @PreAuthorize("@el.check('merchants:edit')") public ResponseEntity<Object> updateMerchants(@Validated @RequestBody Merchants resources){ merchantsService.update(resources); @PreAuthorize("@el.check('merchant:edit')") public ResponseEntity<Object> updateMerchants(@Validated @RequestBody Merchant resources){ merchantService.update(resources); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @DeleteMapping @Log("删除商户信息") @ApiOperation("删除商户信息") @PreAuthorize("@el.check('merchants:del')") @PreAuthorize("@el.check('merchant:del')") public ResponseEntity<Object> deleteMerchants(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) { merchantsService.deleteAll(ids); merchantService.deleteAll(ids); return new ResponseEntity<>(HttpStatus.OK); } } oying-system/src/main/java/com/oying/modules/system/service/MerchantService.java
File was renamed from oying-system/src/main/java/com/oying/modules/system/service/MerchantsService.java @@ -1,6 +1,6 @@ package com.oying.modules.system.service; import com.oying.modules.system.domain.Merchants; import com.oying.modules.system.domain.Merchant; import com.oying.modules.system.domain.dto.MerchantsQueryCriteria; import java.util.List; import java.io.IOException; @@ -14,7 +14,7 @@ * @author lixin * @date 2025-05-29 **/ public interface MerchantsService extends IService<Merchants> { public interface MerchantService extends IService<Merchant> { /** * 查询数据分页 @@ -22,26 +22,26 @@ * @param page 分页参数 * @return PageResult */ PageResult<Merchants> queryAll(MerchantsQueryCriteria criteria, Page<Object> page); PageResult<Merchant> queryAll(MerchantsQueryCriteria criteria, Page<Object> page); /** * 查询所有数据不分页 * @param criteria 条件参数 * @return List<MerchantsDto> */ List<Merchants> queryAll(MerchantsQueryCriteria criteria); List<Merchant> queryAll(MerchantsQueryCriteria criteria); /** * 创建 * @param resources / */ void create(Merchants resources); void create(Merchant resources); /** * 编辑 * @param resources / */ void update(Merchants resources); void update(Merchant resources); /** * 多选删除 @@ -55,5 +55,5 @@ * @param response / * @throws IOException / */ void download(List<Merchants> all, HttpServletResponse response) throws IOException; void download(List<Merchant> all, HttpServletResponse response) throws IOException; } oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java
New file @@ -0,0 +1,86 @@ package com.oying.modules.system.service.impl; import com.oying.modules.system.domain.Merchant; import com.oying.modules.system.mapper.MerchantMapper; import com.oying.utils.FileUtil; import lombok.RequiredArgsConstructor; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.oying.modules.system.service.MerchantService; import com.oying.modules.system.domain.dto.MerchantsQueryCriteria; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.oying.utils.PageUtil; import java.util.List; import java.util.Map; import java.io.IOException; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.LinkedHashMap; import com.oying.utils.PageResult; /** * @description 服务实现 * @author lixin * @date 2025-05-29 **/ @Service @RequiredArgsConstructor public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> implements MerchantService { private final MerchantMapper merchantMapper; @Override public PageResult<Merchant> queryAll(MerchantsQueryCriteria criteria, Page<Object> page){ return PageUtil.toPage(merchantMapper.findAll(criteria, page)); } @Override public List<Merchant> queryAll(MerchantsQueryCriteria criteria){ return merchantMapper.findAll(criteria); } @Override @Transactional(rollbackFor = Exception.class) public void create(Merchant resources) { merchantMapper.insert(resources); } @Override @Transactional(rollbackFor = Exception.class) public void update(Merchant resources) { Merchant merchant = getById(resources.getMerchantId()); merchant.copy(resources); merchantMapper.updateById(merchant); } @Override @Transactional(rollbackFor = Exception.class) public void deleteAll(List<Long> ids) { merchantMapper.deleteBatchIds(ids); } @Override public void download(List<Merchant> all, HttpServletResponse response) throws IOException { List<Map<String, Object>> list = new ArrayList<>(); for (Merchant merchant : all) { Map<String, Object> map = new LinkedHashMap<>(); map.put("名称", merchant.getMerchantName()); map.put("商户编码", merchant.getMerchantCode()); map.put("营业执照号", merchant.getBusinessLicense()); map.put("营业执照号路径", merchant.getBusinessLicensePath()); map.put("联系手机", merchant.getContactMobile()); map.put("排序", merchant.getMerchantSort()); map.put("状态", merchant.getEnabled()); map.put("审核人", merchant.getAuditUser()); map.put("审核时间", merchant.getAuditTime()); map.put("审核信息", merchant.getAuditMessage()); map.put("创建者", merchant.getCreateBy()); map.put("更新者", merchant.getUpdateBy()); map.put("创建日期", merchant.getCreateTime()); map.put("更新时间", merchant.getUpdateTime()); list.add(map); } FileUtil.downloadExcel(list, response); } } oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantsServiceImpl.java
File was deleted oying-system/src/main/resources/mapper/system/MerchantMapper.xml
File was renamed from oying-system/src/main/resources/mapper/system/MerchantsMapper.xml @@ -1,32 +1,32 @@ <?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.oying.modules.system.mapper.MerchantsMapper"> <resultMap id="BaseResultMap" type="com.oying.modules.system.domain.Merchants"> <id column="merchants_id" property="merchantsId"/> <mapper namespace="com.oying.modules.system.mapper.MerchantMapper"> <resultMap id="BaseResultMap" type="com.oying.modules.system.domain.Merchant"> <id column="merchant_id" property="merchantId"/> <result column="merchant_name" property="merchantName"/> <result column="merchant_code" property="merchantCode"/> <result column="business_license" property="businessLicense"/> <result column="business_license_path" property="businessLicensePath"/> <result column="contact_mobile" property="contactMobile"/> <result column="merchants_sort" property="merchantsSort"/> <result column="merchant_sort" property="merchantSort"/> <result column="enabled" property="enabled"/> <result column="create_by" property="createBy"/> <result column="update_by" property="updateBy"/> <result column="create_time" property="createTime"/> <result column="update_time" property="updateTime"/> <result column="auth_user" property="authUser"/> <result column="auth_time" property="authTime"/> <result column="auth_message" property="authMessage"/> <result column="audit_user" property="auditUser"/> <result column="audit_time" property="auditTime"/> <result column="audit_message" property="auditMessage"/> </resultMap> <sql id="Base_Column_List"> merchants_id, merchant_name, merchant_code, business_license, business_license_path, contact_mobile, merchants_sort, enabled, create_by, update_by, create_time, update_time, auth_user, auth_time, auth_message merchant_id, merchant_name, merchant_code, business_license, business_license_path, contact_mobile, merchant_sort, enabled, create_by, update_by, create_time, update_time, audit_user, audit_time, audit_message </sql> <select id="findAll" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from sys_merchants from sys_merchant <where> <if test="criteria.blurry != null and criteria.blurry != ''"> and ( @@ -43,6 +43,6 @@ AND create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]} </if> </where> order by merchants_sort desc order by merchant_sort desc </select> </mapper>