| @@ -7,6 +7,7 @@ import com.iformall.domain.po.WxBrand; | |||||
| import com.iformall.service.WxBrandService; | import com.iformall.service.WxBrandService; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -78,5 +79,15 @@ public class WxBrandController extends BaseController { | |||||
| } | } | ||||
| @ApiOperation("查询品牌名称是否存在") | |||||
| @GetMapping("hasBrand") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "name", value = "name", dataType = "String", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query")}) | |||||
| public ResultData hasBrand(String name, Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBrandController::hasBrand"); | |||||
| return wxBrandService.hasBrand(getTenantId(), name, id); | |||||
| } | |||||
| } | } | ||||
| @@ -17,4 +17,6 @@ public interface WxBrandMapper extends CommonMapper<WxBrand, String> { | |||||
| List<Map<String,Object>> queryBrand(String tenantId); | List<Map<String,Object>> queryBrand(String tenantId); | ||||
| int hasBrand(WxBrand wxBrand); | |||||
| } | } | ||||
| @@ -43,4 +43,7 @@ public interface WxBrandService { | |||||
| ResultData update(WxBrand wxBrand); | ResultData update(WxBrand wxBrand); | ||||
| List<Map<String,Object>> queryBrand(String id); | List<Map<String,Object>> queryBrand(String id); | ||||
| ResultData hasBrand(String tenantId, String name, Long id); | |||||
| } | } | ||||
| @@ -7,6 +7,7 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxBrand; | import com.iformall.domain.po.WxBrand; | ||||
| import com.iformall.domain.po.WxShop; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.WxBrandMapper; | import com.iformall.mapper.WxBrandMapper; | ||||
| import com.iformall.service.WxBrandService; | import com.iformall.service.WxBrandService; | ||||
| @@ -86,5 +87,15 @@ public class WxBrandServiceImpl implements WxBrandService { | |||||
| return wxBrandMapper.queryBrand(tenantId); | return wxBrandMapper.queryBrand(tenantId); | ||||
| } | } | ||||
| @Override | |||||
| public ResultData hasBrand(String tenantId, String name, Long id) { | |||||
| WxBrand wxBrand = new WxBrand(); | |||||
| wxBrand.setTenantId(tenantId); | |||||
| wxBrand.setName(name); | |||||
| wxBrand.setId(id); | |||||
| int count = wxBrandMapper.hasBrand(wxBrand); | |||||
| return new ResultData(ResultData.SUCCESS, "查询成功", count > 0 ? true : false); | |||||
| } | |||||
| } | } | ||||
| @@ -42,7 +42,12 @@ | |||||
| select id,`name` value from wx_brand where tenant_id=#{value} | select id,`name` value from wx_brand where tenant_id=#{value} | ||||
| </select> | </select> | ||||
| <select id="hasBrand" parameterType="com.iformall.domain.po.WxBrand" resultType="Integer"> | |||||
| select count(*) from wx_brand where tenant_id=#{tenantId} and name=#{name} | |||||
| <if test=" null != id"> | |||||
| and id = #{id} | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||